Skip to content

Commit

Permalink
- Added parser error for equations containing assignments
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@7521 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 20, 2010
1 parent 32f1ce5 commit 2898ea9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion Compiler/FrontEnd/Builtin.mo
Expand Up @@ -213,7 +213,6 @@ end print;
function classDirectory \"Not standard Modelica\"
output String str;
annotation(__OpenModelica_Impure = true);
external \"builtin\";
end classDirectory;
"
Expand Down
8 changes: 6 additions & 2 deletions Parser/Modelica.g
Expand Up @@ -691,8 +691,12 @@ assign_clause_a returns [void* ast] @declarations {

equality_or_noretcall_equation returns [void* ast] :
e1=simple_expression
( EQUALS e2=expression {ast = Absyn__EQ_5fEQUALS(e1,e2);}
| {LA(1) != EQUALS && RML_GETHDR(e1) == RML_STRUCTHDR(2, Absyn__CALL_3dBOX2)}? /* It has to be a CALL */
( (EQUALS | ass=ASSIGN) e2=expression
{
modelicaParserAssert(ass==0,"Equations can not contain assignments (':='), use equality ('=') instead", equality_or_noretcall_equation, $ass->line, $ass->charPosition+1, $ass->line, $ass->charPosition+2);
ast = Absyn__EQ_5fEQUALS(e1,e2);
}
| {LA(1) != EQUALS && LA(1) != ASSIGN && RML_GETHDR(e1) == RML_STRUCTHDR(2, Absyn__CALL_3dBOX2)}? /* It has to be a CALL */
{
struct rml_struct *p = (struct rml_struct*)RML_UNTAGPTR(e1);
ast = Absyn__EQ_5fNORETCALL(p->data[0+UNBOX_OFFSET],p->data[1+UNBOX_OFFSET]);
Expand Down

0 comments on commit 2898ea9

Please sign in to comment.