/[svn]/linuxsampler/trunk/src/scriptvm/parser.y
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/parser.y

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

revision 3257 by schoenebeck, Tue May 30 17:20:02 2017 UTC revision 3311 by schoenebeck, Sat Jul 15 16:24:59 2017 UTC
# Line 23  Line 23 
23      #define scanner context->scanner      #define scanner context->scanner
24      #define PARSE_ERR(loc,txt)  yyerror(&loc, context, txt)      #define PARSE_ERR(loc,txt)  yyerror(&loc, context, txt)
25      #define PARSE_WRN(loc,txt)  InstrScript_warning(&loc, context, txt)      #define PARSE_WRN(loc,txt)  InstrScript_warning(&loc, context, txt)
26        #define PARSE_DROP(loc)     context->addPreprocessorComment(loc.first_line, loc.last_line, loc.first_column+1, loc.last_column+1);
27      #define yytnamerr(res,str)  InstrScript_tnamerr(res, str)      #define yytnamerr(res,str)  InstrScript_tnamerr(res, str)
28  %}  %}
29    
# Line 52  Line 53 
53  %token CONST_ "keyword 'const'"  %token CONST_ "keyword 'const'"
54  %token POLYPHONIC "keyword 'polyphonic'"  %token POLYPHONIC "keyword 'polyphonic'"
55  %token WHILE "keyword 'while'"  %token WHILE "keyword 'while'"
56    %token SYNCHRONIZED "keyword 'synchronized'"
57  %token IF "keyword 'if'"  %token IF "keyword 'if'"
58  %token ELSE "keyword 'else'"  %token ELSE "keyword 'else'"
59  %token SELECT "keyword 'select'"  %token SELECT "keyword 'select'"
# Line 69  Line 71 
71  %token LE "operator '<='"  %token LE "operator '<='"
72  %token GE "operator '>='"  %token GE "operator '>='"
73  %token END_OF_FILE 0 "end of file"  %token END_OF_FILE 0 "end of file"
74    %token UNKNOWN_CHAR "unknown character"
75    
76  %type <nEventHandlers> script sections  %type <nEventHandlers> script sections
77  %type <nEventHandler> section eventhandler  %type <nEventHandler> section eventhandler
# Line 404  statement: Line 407  statement:
407              $$ = new While(new IntLiteral(0), $5);              $$ = new While(new IntLiteral(0), $5);
408          }          }
409      }      }
410        | SYNCHRONIZED opt_statements END SYNCHRONIZED  {
411            $$ = new SyncBlock($2);
412        }
413      | IF '(' expr ')' opt_statements ELSE opt_statements END IF  {      | IF '(' expr ')' opt_statements ELSE opt_statements END IF  {
414          $$ = new If($3, $5, $7);          $$ = new If($3, $5, $7);
415      }      }
# Line 469  functioncall: Line 475  functioncall:
475          } else if (!fn) {          } else if (!fn) {
476              PARSE_ERR(@1, (String("No built-in function with name '") + name + "'.").c_str());              PARSE_ERR(@1, (String("No built-in function with name '") + name + "'.").c_str());
477              $$ = new FunctionCall(name, args, NULL);              $$ = new FunctionCall(name, args, NULL);
478            } else if (context->functionProvider->isFunctionDisabled(fn,context)) {
479                PARSE_DROP(@$);
480                $$ = new NoFunctionCall;
481          } else if (args->argsCount() < fn->minRequiredArgs()) {          } else if (args->argsCount() < fn->minRequiredArgs()) {
482              PARSE_ERR(@3, (String("Built-in function '") + name + "' requires at least " + ToString(fn->minRequiredArgs()) + " arguments.").c_str());              PARSE_ERR(@3, (String("Built-in function '") + name + "' requires at least " + ToString(fn->minRequiredArgs()) + " arguments.").c_str());
483              $$ = new FunctionCall(name, args, NULL);              $$ = new FunctionCall(name, args, NULL);
# Line 502  functioncall: Line 511  functioncall:
511          } else if (!fn) {          } else if (!fn) {
512              PARSE_ERR(@1, (String("No built-in function with name '") + name + "'.").c_str());              PARSE_ERR(@1, (String("No built-in function with name '") + name + "'.").c_str());
513              $$ = new FunctionCall(name, args, NULL);              $$ = new FunctionCall(name, args, NULL);
514            } else if (context->functionProvider->isFunctionDisabled(fn,context)) {
515                PARSE_DROP(@$);
516                $$ = new NoFunctionCall;
517          } else if (fn->minRequiredArgs() > 0) {          } else if (fn->minRequiredArgs() > 0) {
518              PARSE_ERR(@3, (String("Built-in function '") + name + "' requires at least " + ToString(fn->minRequiredArgs()) + " arguments.").c_str());              PARSE_ERR(@3, (String("Built-in function '") + name + "' requires at least " + ToString(fn->minRequiredArgs()) + " arguments.").c_str());
519              $$ = new FunctionCall(name, args, NULL);              $$ = new FunctionCall(name, args, NULL);
# Line 520  functioncall: Line 532  functioncall:
532          } else if (!fn) {          } else if (!fn) {
533              PARSE_ERR(@1, (String("No built-in function with name '") + name + "'.").c_str());              PARSE_ERR(@1, (String("No built-in function with name '") + name + "'.").c_str());
534              $$ = new FunctionCall(name, args, NULL);              $$ = new FunctionCall(name, args, NULL);
535            } else if (context->functionProvider->isFunctionDisabled(fn,context)) {
536                PARSE_DROP(@$);
537                $$ = new NoFunctionCall;
538          } else if (fn->minRequiredArgs() > 0) {          } else if (fn->minRequiredArgs() > 0) {
539              PARSE_ERR(@1, (String("Built-in function '") + name + "' requires at least " + ToString(fn->minRequiredArgs()) + " arguments.").c_str());              PARSE_ERR(@1, (String("Built-in function '") + name + "' requires at least " + ToString(fn->minRequiredArgs()) + " arguments.").c_str());
540              $$ = new FunctionCall(name, args, NULL);              $$ = new FunctionCall(name, args, NULL);

Legend:
Removed from v.3257  
changed lines
  Added in v.3311

  ViewVC Help
Powered by ViewVC