/[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 2942 by schoenebeck, Wed Jul 13 15:51:06 2016 UTC revision 3285 by schoenebeck, Thu Jun 22 10:45:38 2017 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014-2016 Christian Schoenebeck and Andreas Persson   * Copyright (c) 2014-2017 Christian Schoenebeck and Andreas Persson
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 48  static void scanner_warning(YYLTYPE* loc Line 48  static void scanner_warning(YYLTYPE* loc
48  #define SCANNER_ERR(txt)  scanner_error(yylloc, yyextra, txt)  #define SCANNER_ERR(txt)  scanner_error(yylloc, yyextra, txt)
49  #define SCANNER_WRN(txt)  scanner_warning(yylloc, yyextra, txt)  #define SCANNER_WRN(txt)  scanner_warning(yylloc, yyextra, txt)
50    
51    // shut up warning that 'register' keyword is deprecated as of C++11
52    #if defined(__cplusplus) && __cplusplus >= 201103L
53    # define register
54    #endif
55    
56  using namespace LinuxSampler;  using namespace LinuxSampler;
57    
58  static int countNewLineChars(const char* txt) {  static int countNewLineChars(const char* txt) {
# Line 58  static int countNewLineChars(const char* Line 63  static int countNewLineChars(const char*
63  }  }
64    
65  static int countCharsPastLastNewLine(const char* txt) {  static int countCharsPastLastNewLine(const char* txt) {
66      const int n = strlen(txt);      const int n = (int)strlen(txt);
67      for (int i = n - 1; i >= 0; --i)      for (int i = n - 1; i >= 0; --i)
68          if (txt[i] == '\n')          if (txt[i] == '\n')
69              return n - i - 1;              return n - i - 1;
# Line 211  ID       [a-zA-Z0-9_]+ Line 216  ID       [a-zA-Z0-9_]+
216      processLocation();      processLocation();
217  }  }
218  <PREPROC_BODY_EAT>.* { /* eat up code block filtered out by preprocessor */  <PREPROC_BODY_EAT>.* { /* eat up code block filtered out by preprocessor */
219      processLocation();      yyextra->addPreprocessorComment(yylloc->first_line, yylloc->last_line,
220                                        yylloc->first_column+1, yylloc->last_column+1);
221  }  }
222    
223    
# Line 241  ID       [a-zA-Z0-9_]+ Line 247  ID       [a-zA-Z0-9_]+
247  "const" return CONST_; // note: "CONST" is already defined for C/C++ compilers on Windows by default  "const" return CONST_; // note: "CONST" is already defined for C/C++ compilers on Windows by default
248  "polyphonic" return POLYPHONIC;  "polyphonic" return POLYPHONIC;
249  "mod" return MOD;  "mod" return MOD;
250    "function" return FUNCTION;
251    "call" return CALL;
252    "synchronized" return SYNCHRONIZED;
253    
254  [&,()[\]<>=*+#/-] {  [&,()[\]<>=*+#/-] {
255      return *yytext;      return *yytext;
# Line 271  ID       [a-zA-Z0-9_]+ Line 280  ID       [a-zA-Z0-9_]+
280    
281  [ \t\r]+ /* eat up whitespace */  [ \t\r]+ /* eat up whitespace */
282    
283  . printf( "Unrecognized character: '%s' (line %d, column %d)\n", yytext, yylineno, yycolumn);  . {
284        printf( "Unrecognized character: '%s' (line %d, column %d)\n", yytext, yylineno, yycolumn);
285        return UNKNOWN_CHAR;
286    }
287    
288  %%  %%
289    

Legend:
Removed from v.2942  
changed lines
  Added in v.3285

  ViewVC Help
Powered by ViewVC