From 9c6ee7838845971ea005ad7548f3d43456d2ca0d Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Mon, 14 Oct 2013 16:30:17 +0200 Subject: [PATCH] disallow -0 year --- preprocessor/DynareFlex.ll | 2 +- preprocessor/macro/MacroFlex.ll | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/preprocessor/DynareFlex.ll b/preprocessor/DynareFlex.ll index c836be7f7..a5a3f6d73 100644 --- a/preprocessor/DynareFlex.ll +++ b/preprocessor/DynareFlex.ll @@ -690,7 +690,7 @@ string eofbuff; return token::INT_NUMBER; } -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:]]*\) { +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; } diff --git a/preprocessor/macro/MacroFlex.ll b/preprocessor/macro/MacroFlex.ll index 792efce71..9235cf3b5 100644 --- a/preprocessor/macro/MacroFlex.ll +++ b/preprocessor/macro/MacroFlex.ll @@ -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() */