From 9eb34cee4a68d54a0943f41a7977899a36a60a80 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Mon, 14 Oct 2013 18:16:07 +0200 Subject: [PATCH] macroprocessor: if you encounter dates(date), insert quotes --- preprocessor/macro/MacroFlex.ll | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/preprocessor/macro/MacroFlex.ll b/preprocessor/macro/MacroFlex.ll index 9235cf3b5..09c04da01 100644 --- a/preprocessor/macro/MacroFlex.ll +++ b/preprocessor/macro/MacroFlex.ll @@ -51,7 +51,8 @@ typedef Macro::parser::token token; %x FOR_BODY %x THEN_BODY %x ELSE_BODY -%x END_DATE +%x DATE_MATCH +%x CLOSE_DATE %{ // Increments location counter for every token read @@ -92,8 +93,10 @@ DATE (-[1-9][0-9]*|[0-9]+)([YyAa]|[Mm]([1-9]|1[0-2])|[Qq][1-4]|[Ww]([1-9]{1}|[1- {DATE} { yylloc->step(); *yyout << "dates('" << yytext << "')"; } ${DATE} { yylloc->step(); *yyout << yytext + 1; } -dates{SPC}*\({SPC}*\'{DATE} { yylloc->step(); *yyout << yytext; BEGIN(END_DATE); } -{SPC}*\'{SPC}*\) { yylloc->step(); *yyout << yytext; BEGIN(INITIAL); } +dates{SPC}*\({SPC}* { yylloc->step(); *yyout << "dates("; BEGIN(DATE_MATCH); } +\'{SPC}*{DATE}{SPC}*\' { yylloc->step(); *yyout << yytext; BEGIN(CLOSE_DATE); } +{DATE} { yylloc->step(); *yyout << "'" << yytext << "'"; BEGIN(CLOSE_DATE); } +{SPC}*\) { yylloc->step(); *yyout << ")"; BEGIN(INITIAL); } \} { BEGIN(INITIAL); return token::EOL; }