Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Added special lexer rules for &&, ||, !, telling the user the proper Modelica keyword to use


git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15386 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Feb 28, 2013
1 parent 53a9614 commit 3df5835
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions Parser/BaseModelica_Lexer.g
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ IDENT;
}
T_ALGORITHM : 'algorithm';
T_AND : 'and';
T_AND : 'and' | '&&' {
ModelicaParser_lexerError = ANTLR3_TRUE;
c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Please use 'and' for logical and since '&&' is not a valid Modelica construct.",
NULL, 0, $line, $pos+1, $line, $pos+3,
ModelicaParser_readonly, ModelicaParser_filename_C_testsuiteFriendly);
};
T_ANNOTATION : 'annotation';
BLOCK : 'block';
CLASS : 'class';
Expand Down Expand Up @@ -218,11 +223,21 @@ INNER : 'inner';
T_INPUT : 'input';
LOOP : 'loop';
MODEL : 'model';
T_NOT : 'not';
T_NOT : 'not' | '!' {
ModelicaParser_lexerError = ANTLR3_TRUE;
c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Please use 'not' for logical not since '!' is not a valid Modelica construct.",
NULL, 0, $line, $pos+1, $line, $pos+2,
ModelicaParser_readonly, ModelicaParser_filename_C_testsuiteFriendly);
};
T_OUTER : 'outer';
OPERATOR : 'operator';
OVERLOAD : '$overload'; // OpenModelica extension
T_OR : 'or';
T_OR : 'or' | '||' {
ModelicaParser_lexerError = ANTLR3_TRUE;
c_add_source_message(2, ErrorType_syntax, ErrorLevel_error, "Please use 'or' for logical or since '||' is not a valid Modelica construct.",
NULL, 0, $line, $pos+1, $line, $pos+3,
ModelicaParser_readonly, ModelicaParser_filename_C_testsuiteFriendly);
};
T_OUTPUT : 'output';
T_PACKAGE : 'package';
PARAMETER : 'parameter';
Expand Down

0 comments on commit 3df5835

Please sign in to comment.