stage1_2/iec_flex.ll
changeset 634 736b36a83548
parent 627 e7caa7d32ef5
child 637 1b6f337222e0
equal deleted inserted replaced
633:73b56dc69e61 634:736b36a83548
   511 enable_code_generation_pragma	"{enable code generation}"
   511 enable_code_generation_pragma	"{enable code generation}"
   512 
   512 
   513 
   513 
   514 /* Any other pragma... */
   514 /* Any other pragma... */
   515 
   515 
   516 pragma "{"[^}]*"}"
   516 pragma "{"[^}]*"}"|"{{"([^}]|"}"[^}])*"}}"
   517 
   517 
   518 /* NOTE: this seemingly unnecessary complex definition is required
   518 /* NOTE: this seemingly unnecessary complex definition is required
   519  *       to be able to eat up comments such as:
   519  *       to be able to eat up comments such as:
   520  *          '(* Testing... ! ***** ******)'
   520  *          '(* Testing... ! ***** ******)'
   521  *       without using the trailing context command in flex (/{context})
   521  *       without using the trailing context command in flex (/{context})
   847 <body_state>{enable_code_generation_pragma}    return enable_code_generation_pragma_token;
   847 <body_state>{enable_code_generation_pragma}    return enable_code_generation_pragma_token;
   848 
   848 
   849 	/* Any other pragma we find, we just pass it up to the syntax parser...   */
   849 	/* Any other pragma we find, we just pass it up to the syntax parser...   */
   850 	/* Note that the <body_state> state is exclusive, so we have to include it here too. */
   850 	/* Note that the <body_state> state is exclusive, so we have to include it here too. */
   851 {pragma}	{/* return the pragmma without the enclosing '{' and '}' */
   851 {pragma}	{/* return the pragmma without the enclosing '{' and '}' */
   852 		 yytext[strlen(yytext)-1] = '\0';
   852          uint cut = yytext[1]=='{'?2:1;
   853 		 yylval.ID=strdup(yytext+1);
   853 		 yytext[strlen(yytext)-cut] = '\0';
       
   854 		 yylval.ID=strdup(yytext+cut);
   854 		 return pragma_token;
   855 		 return pragma_token;
   855 		}
   856 		}
   856 <body_state>{pragma} {/* return the pragmma without the enclosing '{' and '}' */
   857 <body_state>{pragma} {/* return the pragmma without the enclosing '{' and '}' */
   857 		 yytext[strlen(yytext)-1] = '\0';
   858 		 yytext[strlen(yytext)-1] = '\0';
   858 		 yylval.ID=strdup(yytext+1);
   859 		 yylval.ID=strdup(yytext+1);