disallow -0 year

time-shift
Houtan Bastani 2013-10-14 16:30:17 +02:00
parent 7894e8eee7
commit 858159a4f5
2 changed files with 2 additions and 2 deletions

View File

@ -690,7 +690,7 @@ string eofbuff;
return token::INT_NUMBER;
}
<DYNARE_STATEMENT,DYNARE_BLOCK>dates[[:space:]]*\([[:space:]]*\'[[:space:]]*-?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2]))[[:space:]]*\'[[:space:]]*\) {
<DYNARE_STATEMENT,DYNARE_BLOCK>dates[[:space:]]*\([[:space:]]*\'[[:space:]]*(-[1-9][0-9]*|[0-9]+)([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2]))[[:space:]]*\'[[:space:]]*\) {
yylval->string_val = new string(yytext);
return token::DATE_NUMBER;
}

View File

@ -61,7 +61,7 @@ typedef Macro::parser::token token;
SPC [ \t]+
EOL (\r)?\n
CONT \\\\
DATE -?[0-9]+([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2]))
DATE (-[1-9][0-9]*|[0-9]+)([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1-4][0-9]|5[0-2]))
%%
/* Code put at the beginning of yylex() */