Opened 13 years ago
Last modified 13 years ago
#1558 closed defect (wontfix)
Parse error: Modelica assignment statements
Reported by: | wbraun | Owned by: | wbraun |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Parser | Version: | trunk |
Keywords: | Cc: | wbraun, |
Description
Following model:
class test Real a(start = 1.0); algorithm der(a) := a; end A;
produce
Error: Parse error: Modelica assignment statements are either on the form 'component_reference := expression' or '( output_expression_list ) := function_call'
But it's legal Modelica.
Change History (4)
comment:1 Changed 13 years ago by adrpo
comment:2 Changed 13 years ago by wbraun
ah. ok thanks.
comment:3 Changed 13 years ago by adrpo
We can fix it fine, that's no issue, but i don't think we should.
I mean you could rewrite it to a := der(a); which is correct and
should work fine (i hope :) ).
comment:4 Changed 13 years ago by wbraun
No, I don't think we should fix it. I just misinterpret der(a) as a variable name for $DERa, but it is more. At least it will make no sense when you consider something like this: der(a*b) := c this will expand to der(a)*b + der(b)*a and then it's an issue.
This is not valid Modelica. Dymola supports it but the grammar does not allow it.
You can have function calls on the left hand side only in equation sections.
In the algorithm sections you can only have function calls on the right hand side.