/[svn]/linuxsampler/trunk/src/scriptvm/scanner.l
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/scanner.l

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3307 by schoenebeck, Thu Jun 22 10:45:38 2017 UTC revision 3308 by schoenebeck, Sat Jul 15 01:14:20 2017 UTC
# Line 76  static int countCharsPastLastNewLine(con Line 76  static int countCharsPastLastNewLine(con
76      if (nl) yycolumn = countCharsPastLastNewLine(yytext); \      if (nl) yycolumn = countCharsPastLastNewLine(yytext); \
77  }  }
78    
79    // if compiled for debugging, throw an exception instead of exiting on fatal
80    // lexer errors (so the debugger may pause with the appropriate back trace)
81    #if DEBUG
82    # include <stdexcept>
83    # define YY_FATAL_ERROR(msg) throw std::runtime_error(msg)
84    #endif
85    
86  %}  %}
87    
88  /* use Flex's built-in support for line numbers  /* use Flex's built-in support for line numbers
# Line 176  ID       [a-zA-Z0-9_]+ Line 183  ID       [a-zA-Z0-9_]+
183   */   */
184    
185  <*>"USE_CODE_IF"[ \t]*"(" {  <*>"USE_CODE_IF"[ \t]*"(" {
186      //printf("USE_CODE_IF\n");      //printf("{%s}\n", yytext);
187      yy_push_state(PREPROC_IF, yyscanner);      yy_push_state(PREPROC_IF, yyscanner);
188  }  }
189    <PREPROC_BODY_EAT>"USE_CODE_IF"[ \t]*"("{ID}")" {
190        //printf("[EAT{%s}\n", yytext);
191        yy_push_state(PREPROC_BODY_EAT, yyscanner);
192    }
193  <*>"USE_CODE_IF_NOT"[ \t]*"(" {  <*>"USE_CODE_IF_NOT"[ \t]*"(" {
194      //printf("USE_CODE_IF_NOT\n");      //printf("USE_CODE_IF_NOT\n");
195      yy_push_state(PREPROC_IF_NOT, yyscanner);      yy_push_state(PREPROC_IF_NOT, yyscanner);
196  }  }
197    <PREPROC_BODY_EAT>"USE_CODE_IF_NOT"[ \t]*"("{ID}")" {
198        //printf("[EAT{%s}\n", yytext);
199        yy_push_state(PREPROC_BODY_EAT, yyscanner);
200    }
201  <PREPROC_IF>{ID} {  <PREPROC_IF>{ID} {
202      //printf("preproc use code if '%s'\n", yytext);      //printf("preproc use code if '%s'\n", yytext);
203      yy_pop_state(yyscanner);      yy_pop_state(yyscanner);
# Line 204  ID       [a-zA-Z0-9_]+ Line 219  ID       [a-zA-Z0-9_]+
219      yy_push_state(PREPROC_BODY_USE, yyscanner);      yy_push_state(PREPROC_BODY_USE, yyscanner);
220  }  }
221  <PREPROC_PRE_BODY_EAT>[ \t]*")" {  <PREPROC_PRE_BODY_EAT>[ \t]*")" {
222      //printf("PREPROCESSOR EAT : \n");      //printf("PREPROCESSOR EAT : {%s}\n", yytext);
223      yy_pop_state(yyscanner);      yy_pop_state(yyscanner);
224      yy_push_state(PREPROC_BODY_EAT, yyscanner);      yy_push_state(PREPROC_BODY_EAT, yyscanner);
225  }  }
226  <*>.*"END_USE_CODE" {  <PREPROC_BODY_EAT,PREPROC_BODY_USE>"END_USE_CODE" {
227      //printf("-->END_USE_CODE\n");      //printf("-->END_USE_CODE\n");
228      yy_pop_state(yyscanner);      yy_pop_state(yyscanner);
229  }  }
230  <PREPROC_BODY_EAT>[ \t\r\n]* { /* eat up code block filtered out by preprocessor */  <PREPROC_BODY_EAT>[ \t\r\n]* { /* eat up code block filtered out by preprocessor */
231        //printf("PREPROCESSOR EAT2 : {%s}\n", yytext);
232      processLocation();      processLocation();
233  }  }
234  <PREPROC_BODY_EAT>.* { /* eat up code block filtered out by preprocessor */  <PREPROC_BODY_EAT>.* { /* eat up code block filtered out by preprocessor */
235        //printf("PREPROCESSOR EAT3 : {%s}\n", yytext);
236      yyextra->addPreprocessorComment(yylloc->first_line, yylloc->last_line,      yyextra->addPreprocessorComment(yylloc->first_line, yylloc->last_line,
237                                      yylloc->first_column+1, yylloc->last_column+1);                                      yylloc->first_column+1, yylloc->last_column+1);
238  }  }

Legend:
Removed from v.3307  
changed lines
  Added in v.3308

  ViewVC Help
Powered by ViewVC