Skip to content

Commit

Permalink
Remove the NONE check from the parser; we no longer need special chec…
Browse files Browse the repository at this point in the history
…ks for RML stuff

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@22952 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Oct 26, 2014
1 parent 7c246ab commit 24cec03
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
7 changes: 7 additions & 0 deletions Compiler/FrontEnd/Patternm.mo
Expand Up @@ -312,9 +312,16 @@ algorithm
Error.addSourceMessage(Error.LOOKUP_VARIABLE_ERROR,{id,""},info);
then fail();

case (cache,_,Absyn.CREF(Absyn.CREF_IDENT("NONE",{})),_,_,_)
equation
failure((_,_,_,_,_,_) = Lookup.lookupIdent(cache,env,"NONE"));
Error.addSourceMessage(Error.META_NONE_CREF,{},info);
then fail();

case (cache,_,Absyn.CREF(Absyn.CREF_IDENT(id,{})),_,_,_)
equation
failure((_,_,_,_,_,_) = Lookup.lookupIdent(cache,env,id));
false = "NONE" == id;
Error.addSourceMessage(Error.LOOKUP_VARIABLE_ERROR,{id,""},info);
then fail();

Expand Down
9 changes: 4 additions & 5 deletions Parser/Modelica.g
Expand Up @@ -1237,7 +1237,7 @@ factor returns [void* ast]

primary returns [void* ast]
@declarations { int tupleExpressionIsTuple = 0; }
@init { v = 0; ptr.ast = 0; el = 0; for_or_el.ast = 0; for_or_el.isFor = 0; } :
@init { v = 0; ptr = 0; el = 0; for_or_el.ast = 0; for_or_el.isFor = 0; } :
( v=UNSIGNED_INTEGER
{
char* chars = (char*)$v.text->chars;
Expand Down Expand Up @@ -1292,7 +1292,7 @@ primary returns [void* ast]
| v=STRING { $ast = Absyn__STRING(mmc_mk_scon((char*)$v.text->chars)); }
| T_FALSE { $ast = Absyn__BOOL(MMC_FALSE); }
| T_TRUE { $ast = Absyn__BOOL(MMC_TRUE); }
| ptr=component_reference__function_call { $ast = ptr.ast; }
| ptr=component_reference__function_call { $ast = ptr; }
| DER el=function_call { $ast = Absyn__CALL(Absyn__CREF_5fIDENT(mmc_mk_scon("der"), mmc_mk_nil()),el); }
| LPAR el=output_expression_list[&tupleExpressionIsTuple]
{
Expand Down Expand Up @@ -1320,10 +1320,9 @@ matrix_expression_list returns [void* ast]
component_reference__function_call returns [void* ast]
@init{ cr.ast = 0; fc = 0; i = 0; } :
cr=component_reference ( fc=function_call )? {
if (fc != NULL)
if (fc != NULL) {
$ast = Absyn__CALL(cr.ast,fc);
else {
modelicaParserAssert(!cr.isNone, "NONE is not valid MetaModelica syntax regardless of what tricks OMC has played on you! Use NONE() instead.", component_reference__function_call, $start->line, $start->charPosition+1, LT(1)->line, LT(1)->charPosition);
} else {
$ast = Absyn__CREF(cr.ast);
}
}
Expand Down

0 comments on commit 24cec03

Please sign in to comment.