Fix pragma with double bracket token stripping
authorLaurent Bessard
Wed, 31 Oct 2012 19:21:09 +0100
changeset 701 562c01f82afb
parent 639 f0ef73eceb57
child 702 56337e796ab0
Fix pragma with double bracket token stripping
stage1_2/iec_flex.ll
--- a/stage1_2/iec_flex.ll	Thu Oct 25 11:09:06 2012 +0200
+++ b/stage1_2/iec_flex.ll	Wed Oct 31 19:21:09 2012 +0100
@@ -855,8 +855,9 @@
 		 return pragma_token;
 		}
 <body_state>{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;
 		}