Skip to content

Commit

Permalink
- Fix parsing of if-expressions in mos-files
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6141 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 15, 2010
1 parent 12d1f8e commit 7b1c9a8
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions Parser/Modelica.g
Expand Up @@ -1200,33 +1200,29 @@ code_algorithm_clause returns [void* ast] :
top_algorithm returns [void* ast, int isExp] :
( aa=top_assign_clause_a
| a=conditional_equation_a
| a=for_clause_a
| a=while_clause
( (expression (SEMICOLON|EOF))=> e=expression
| ( a=top_assign_clause_a
| a=conditional_equation_a
| a=for_clause_a
| a=while_clause
)
cmt=comment
)
cmt=comment
{
if (a || !aa.isExp) {
$ast = Absyn__ALGORITHMITEM(a ? a : aa.ast, mk_some_or_none(cmt), INFO($start));
if (!e) {
$ast = Absyn__ALGORITHMITEM(a, mk_some_or_none(cmt), INFO($start));
$isExp = 0;
} else {
$ast = aa.ast;
$ast = e;
$isExp = 1;
}
}
;
top_assign_clause_a returns [void* ast, int isExp] :
(e1=simple_expression|e1=code_expression) (ASSIGN e2=expression)?
top_assign_clause_a returns [void* ast] :
e1=simple_expression ASSIGN e2=expression
{
if (e2) {
$ast = Absyn__ALG_5fASSIGN(e1,e2);
$isExp = 0;
} else {
$ast = e1;
$isExp = 1;
}
ast = Absyn__ALG_5fASSIGN(e1,e2);
}
;
Expand Down

0 comments on commit 7b1c9a8

Please sign in to comment.