Opened 14 years ago
Last modified 14 years ago
#1306 closed defect (fixed)
Connect clause in our ANTLR3/ANTLR3 parsers is not conform to the Modelica specification
Reported by: | Adrian Pop | Owned by: | Adrian Pop |
---|---|---|---|
Priority: | critical | Milestone: | Red October |
Component: | Parser | Version: | 1.6.0 |
Keywords: | Cc: | Adrian Pop, Adrian Pop, Martin Sjölund |
Description
I think this is a bug inherited from the old grammar.
In the Modelica specification we have:
connect_clause : connect "(" component_reference "," component_reference ")"
But in our grammar we have instead of component_reference,
a connector_reference which can only contain 1 dot (.),
meaning that:
connect(a.b.c, x.y.z);
is not allowed. We get this error:
Error: Parser error: Unexpected token near: . (DOT)
Change History (3)
comment:1 by , 14 years ago
comment:2 by , 14 years ago
The grammar says to use a cref, but the specification (9.1) says a connect may only be either c or m.c (m is a non-connector element in the class). So I think it was correct before; but maybe a custom error message is appropriate (in SCode since the Modelica grammar says component_ref here).
comment:3 by , 14 years ago
Not really. If you look into 9.1, Modelica Spec. 3.2. you have:
c1.c2.c3...cN
where c1
is a connector of the class, {{N>=1}} and c|i+1|
is a connector element of c|i|
for i=1:(N-1)
.
Resolved using component_reference instead of connect_ref in connect_clause.
See SCM Commits.