huybuidac20593 / yakindu

Automatically exported from code.google.com/p/yakindu
0 stars 0 forks source link

Issue with multiple events and a single guard #69

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
posted by Uri Weiss on the forum: 
https://groups.google.com/forum/#!topic/yakindu-user/q0YXN7wPDPI

If I'm using the following syntax on an outgoing transition arrow:

   Event1, Event2 [guard]

which should accept either 'Event1' or 'Event2' on the condition that 'guard' 
is true, I get the following C++ code generated:

   if (Event1_raised || Event1_raised && guard) { 

which is wrong since the AND-operator has precedence over the OR-operator.

A possible fix would be to implement CharSequence code(LogicalAndExpression it) 
under ExpressionCode as follows:

   def dispatch CharSequence code(LogicalAndExpression it) '''(«leftOperand.code») && («rightOperand.code»)'''

Original issue reported on code.google.com by AxelTerfloth on 14 Nov 2014 at 2:10

GoogleCodeExporter commented 9 years ago

Original comment by AxelTerfloth on 17 Nov 2014 at 12:01

GoogleCodeExporter commented 9 years ago
Since the bug not only exists in the C++ code generator but also C and Java 
(but not interpreter) the bug will be fixed in the intermediate 
sexed-transformation (model sequencer). It will put the trigger part of the 
condition into parenthesis.

Original comment by AxelTerfloth on 17 Nov 2014 at 12:04

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r6345.

Original comment by AxelTerfloth on 17 Nov 2014 at 3:51