Changeset 15386


Ignore:
Timestamp:
2013-02-28T14:45:42+01:00 (11 years ago)
Author:
sjoelund.se
Message:

#2096

Added special lexer rules for &&,
, !, telling the user the proper Modelica keyword to use
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Parser/BaseModelica_Lexer.g

    r15300 r15386  
    185185
    186186T_ALGORITHM : 'algorithm';
    187 T_AND : 'and';
     187T_AND : 'and' | '&&' {
     188            ModelicaParser_lexerError = ANTLR3_TRUE;
     189            c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Please use 'and' for logical and since '&&' is not a valid Modelica construct.",
     190               NULL, 0, $line, $pos+1, $line, $pos+3,
     191               ModelicaParser_readonly, ModelicaParser_filename_C_testsuiteFriendly);
     192     };
    188193T_ANNOTATION : 'annotation';
    189194BLOCK : 'block';
     
    219224LOOP : 'loop';
    220225MODEL : 'model';
    221 T_NOT : 'not';
     226T_NOT : 'not' | '!' {
     227            ModelicaParser_lexerError = ANTLR3_TRUE;
     228            c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Please use 'not' for logical not since '!' is not a valid Modelica construct.",
     229               NULL, 0, $line, $pos+1, $line, $pos+2,
     230               ModelicaParser_readonly, ModelicaParser_filename_C_testsuiteFriendly);
     231     };
    222232T_OUTER : 'outer';
    223233OPERATOR : 'operator';
    224234OVERLOAD : '$overload'; // OpenModelica extension
    225 T_OR : 'or';
     235T_OR : 'or' | '||' {
     236            ModelicaParser_lexerError = ANTLR3_TRUE;
     237            c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Please use 'or' for logical or since '||' is not a valid Modelica construct.",
     238               NULL, 0, $line, $pos+1, $line, $pos+3,
     239               ModelicaParser_readonly, ModelicaParser_filename_C_testsuiteFriendly);
     240     };
    226241T_OUTPUT : 'output';
    227242T_PACKAGE : 'package';
Note: See TracChangeset for help on using the changeset viewer.