Skip to content

Commit

Permalink
Fixed bug with flat modelica parsing. Now parses Real x.y=1.0;
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@2544 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Sep 26, 2006
1 parent 785154e commit 336c335
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
9 changes: 8 additions & 1 deletion Compiler/absyn_builder/walker.g
Expand Up @@ -969,6 +969,13 @@ declaration returns [void* ast=0]
ast = Absyn__COMPONENT(id, arr, mod ? mk_some(mod) : mk_none());
}
/* For flat modelica parsing */
| #(FLAT_IDENT id2 = flat_component_reference[&arr] (mod=modification)? )
{
if (!arr) arr = mk_nil();
id = mk_scon((char*)id2);
ast = Absyn__COMPONENT(id, arr, mod ? mk_some(mod) : mk_none());
}
/* For flat modelica parsing */
|#(DOT #(i2:IDENT (id2 = flat_array_subscripts)?)
(id3 = flat_component_reference[&arr])) (mod=modification)?
{
Expand Down Expand Up @@ -997,7 +1004,7 @@ modification returns [void* ast]
void* cm = 0;
}
:
( cm = class_modification ( e = expression )?
( cm = class_modification ( EQUALS e = expression )?
|#(EQUALS e = expression)
|#(ASSIGN e = expression)
)
Expand Down
5 changes: 3 additions & 2 deletions flat_modelica_parser/src/flat_modelica_parser.g
Expand Up @@ -71,6 +71,7 @@ tokens {
UNARY_MINUS ;
UNARY_PLUS ;
UNQUALIFIED;
FLAT_IDENT;

}

Expand Down Expand Up @@ -398,7 +399,7 @@ declaration !
comp:component_reference /* was: IDENT^ (array_subscripts)?*/ (mod:modification)?
{
if (#mod) {
#declaration = #(#comp,#mod);
#declaration = #([FLAT_IDENT,"FLAT_IDENT"],#comp,#mod);
} else {
#declaration = #comp;
}
Expand All @@ -410,7 +411,7 @@ declaration !
*/

modification :
( class_modification ( EQUALS! expression )?
( class_modification ( EQUALS expression )?
| EQUALS^ expression
| ASSIGN^ expression
)
Expand Down
3 changes: 2 additions & 1 deletion modelica_parser/src/modelica_parser.g
Expand Up @@ -71,6 +71,7 @@ tokens {
UNARY_MINUS ;
UNARY_PLUS ;
UNQUALIFIED;
FLAT_IDENT;

}

Expand Down Expand Up @@ -402,7 +403,7 @@ declaration :
*/

modification :
( class_modification ( EQUALS! expression )?
( class_modification ( EQUALS expression )?
| EQUALS^ expression
| ASSIGN^ expression
)
Expand Down

0 comments on commit 336c335

Please sign in to comment.