Skip to content

Commit

Permalink
- Modelica 3.0 grammar updates!
Browse files Browse the repository at this point in the history
  + added constrainedby to the grammar
  + now the entire Modelica Standard Library 3.0 can be parsed.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@3383 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
adrpo committed Mar 16, 2008
1 parent 421ebaa commit 7f7a1ea
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
18 changes: 16 additions & 2 deletions Compiler/absyn_builder/walker.g
Expand Up @@ -856,8 +856,22 @@ extends_clause returns [void* ast]
)
;
constraining_clause returns [void *ast] :
(ast = extends_clause)
constraining_clause returns [void *ast]
{
void* path;
void* mod = 0;
}
:
(ast = extends_clause)
| (#(e:CONSTRAINEDBY
path = name_path
( mod = class_modification )?
)
{
if (!mod) mod = mk_nil();
ast = Absyn__EXTENDS(path,mod);
}
)
;
// returns datatype ElementSpec
Expand Down
1 change: 1 addition & 0 deletions flat_modelica_parser/src/flat_modelica_lexer.g
Expand Up @@ -69,6 +69,7 @@ tokens {
ENCAPSULATED = "encapsulated";
EXPANDABLE = "expandable";
EXTENDS = "extends" ;
CONSTRAINEDBY = "constrainedby" ;
EXTERNAL = "external" ;
FALSE = "false" ;
FINAL = "final" ;
Expand Down
2 changes: 1 addition & 1 deletion flat_modelica_parser/src/flat_modelica_parser.g
Expand Up @@ -408,7 +408,7 @@ extends_clause :
;
constraining_clause :
extends_clause
extends_clause | CONSTRAINEDBY^ name_path ( class_modification )?
;
/*
Expand Down
3 changes: 2 additions & 1 deletion modelica_parser/src/modelica_lexer.g
Expand Up @@ -68,7 +68,8 @@ tokens {
EQUATION = "equation" ;
ENCAPSULATED = "encapsulated";
EXPANDABLE = "expandable";
EXTENDS = "extends" ;
EXTENDS = "extends" ;
CONSTRAINEDBY = "constrainedby" ;
EXTERNAL = "external" ;
FALSE = "false" ;
FINAL = "final" ;
Expand Down
2 changes: 1 addition & 1 deletion modelica_parser/src/modelica_parser.g
Expand Up @@ -408,7 +408,7 @@ extends_clause :
;
constraining_clause :
extends_clause
extends_clause | CONSTRAINEDBY^ name_path ( class_modification )?
;
/*
Expand Down

0 comments on commit 7f7a1ea

Please sign in to comment.