stage1_2/iec_flex.ll
changeset 793 268bf4ca5fa1
parent 761 7b52623a2f37
parent 701 562c01f82afb
child 822 a7d9e0b8636b
child 866 c8c48ab075e0
equal deleted inserted replaced
785:b08167f156a1 793:268bf4ca5fa1
   520 enable_code_generation_pragma	"{enable code generation}"
   520 enable_code_generation_pragma	"{enable code generation}"
   521 
   521 
   522 
   522 
   523 /* Any other pragma... */
   523 /* Any other pragma... */
   524 
   524 
   525 pragma "{"[^}]*"}"
   525 pragma "{"[^}]*"}"|"{{"([^}]|"}"[^}])*"}}"
   526 
   526 
   527 /* NOTE: this seemingly unnecessary complex definition is required
   527 /* NOTE: this seemingly unnecessary complex definition is required
   528  *       to be able to eat up comments such as:
   528  *       to be able to eat up comments such as:
   529  *          '(* Testing... ! ***** ******)'
   529  *          '(* Testing... ! ***** ******)'
   530  *       without using the trailing context command in flex (/{context})
   530  *       without using the trailing context command in flex (/{context})
   857 <body_state>{enable_code_generation_pragma}    return enable_code_generation_pragma_token;
   857 <body_state>{enable_code_generation_pragma}    return enable_code_generation_pragma_token;
   858 
   858 
   859 	/* Any other pragma we find, we just pass it up to the syntax parser...   */
   859 	/* Any other pragma we find, we just pass it up to the syntax parser...   */
   860 	/* Note that the <body_state> state is exclusive, so we have to include it here too. */
   860 	/* Note that the <body_state> state is exclusive, so we have to include it here too. */
   861 {pragma}	{/* return the pragmma without the enclosing '{' and '}' */
   861 {pragma}	{/* return the pragmma without the enclosing '{' and '}' */
   862 		 yytext[strlen(yytext)-1] = '\0';
   862          int cut = yytext[1]=='{'?2:1;
   863 		 yylval.ID=strdup(yytext+1);
   863 		 yytext[strlen(yytext)-cut] = '\0';
       
   864 		 yylval.ID=strdup(yytext+cut);
   864 		 return pragma_token;
   865 		 return pragma_token;
   865 		}
   866 		}
   866 <body_state>{pragma} {/* return the pragmma without the enclosing '{' and '}' */
   867 <body_state>{pragma} {/* return the pragmma without the enclosing '{' and '}' */
   867 		 yytext[strlen(yytext)-1] = '\0';
   868 		 int cut = yytext[1]=='{'?2:1;
   868 		 yylval.ID=strdup(yytext+1);
   869          yytext[strlen(yytext)-cut] = '\0';
       
   870 		 yylval.ID=strdup(yytext+cut);
   869 		 return pragma_token;
   871 		 return pragma_token;
   870 		}
   872 		}
   871 
   873 
   872 
   874 
   873 	/*********************************/
   875 	/*********************************/