diff -r b08167f156a1 -r 268bf4ca5fa1 stage1_2/iec_flex.ll --- a/stage1_2/iec_flex.ll Thu Jan 03 17:04:04 2013 +0000 +++ b/stage1_2/iec_flex.ll Thu Jan 03 18:23:07 2013 +0000 @@ -522,7 +522,7 @@ /* Any other pragma... */ -pragma "{"[^}]*"}" +pragma "{"[^}]*"}"|"{{"([^}]|"}"[^}])*"}}" /* NOTE: this seemingly unnecessary complex definition is required * to be able to eat up comments such as: @@ -859,13 +859,15 @@ /* Any other pragma we find, we just pass it up to the syntax parser... */ /* Note that the state is exclusive, so we have to include it here too. */ {pragma} {/* return the pragmma without the enclosing '{' and '}' */ - yytext[strlen(yytext)-1] = '\0'; - yylval.ID=strdup(yytext+1); + int cut = yytext[1]=='{'?2:1; + yytext[strlen(yytext)-cut] = '\0'; + yylval.ID=strdup(yytext+cut); return pragma_token; } {pragma} {/* return the pragmma without the enclosing '{' and '}' */ - yytext[strlen(yytext)-1] = '\0'; - yylval.ID=strdup(yytext+1); + int cut = yytext[1]=='{'?2:1; + yytext[strlen(yytext)-cut] = '\0'; + yylval.ID=strdup(yytext+cut); return pragma_token; }