diff options
author | bnewbold <bnewbold@robocracy.org> | 2016-11-02 19:50:13 -0700 |
---|---|---|
committer | bnewbold <bnewbold@robocracy.org> | 2016-11-02 19:50:13 -0700 |
commit | 57c8bea738990b9cd5efcfbc081249025fa5d608 (patch) | |
tree | c968254b68766a44e476a4b415d399241ac5b62d /src/modelica_parser.lalrpop | |
parent | 7d42b73a02d0b2b8964d6a5a633b9102f52c717b (diff) | |
download | modelthing-57c8bea738990b9cd5efcfbc081249025fa5d608.tar.gz modelthing-57c8bea738990b9cd5efcfbc081249025fa5d608.zip |
push more variable metadata into the model file
Diffstat (limited to 'src/modelica_parser.lalrpop')
-rw-r--r-- | src/modelica_parser.lalrpop | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/modelica_parser.lalrpop b/src/modelica_parser.lalrpop index 1b7861b..6a1ceaf 100644 --- a/src/modelica_parser.lalrpop +++ b/src/modelica_parser.lalrpop @@ -33,11 +33,17 @@ pub model: ModelicaModel = { ModelicaModel { name:n, components: cd, connections: cc, equations: se, extends: vec![] }, }; +value_declaration: Expr = { + "=" <value:expr> => value +}; + +units_declaration: String = { + "(" "unit" "=" <units:string_literal> ")" => units +}; + component_declaration: Component = { - <prefix:component_prefix?> <specifier:identifier> <name:identifier> string_literal? ";" => - Component { prefix:prefix, specifier:specifier, name:name}, - <prefix:component_prefix?> <specifier:identifier> <name:identifier> "=" <value:expr> string_literal? ";" => - Component { prefix:prefix, specifier:specifier, name:name}, + <prefix:component_prefix?> <specifier:identifier> <name:identifier> <units:units_declaration?> <value:value_declaration?> <desc:string_literal?> ";" => + Component { prefix:prefix, specifier:specifier, name:name, description:desc, value:value, units:units }, }; component_prefix: ComponentPrefix = { |