SimulationEverywhere / CDPP_ExtendedStates-codename-Santi

An extended and improved version of CD++ for Cell-DEVS
MIT License
4 stars 6 forks source link

Parsing error for function isUndefined( ...) #14

Open digarcia opened 4 years ago

digarcia commented 4 years ago

When using the isUndefined function as defined in the cd++ manual

Signature: isUndefined : Real → Bool Description: Returns True if the value is undefined, else returns False.

I get a parsing error for several cases. The only working one is for a concrete value (isUndefined(4))

I attached the ma file with the different cases (undefBugTest.ma). Each one can be tested individually by commenting the others.

The cases are:

  isUndefined(4)   and            % ok
  not isUndefined(4)   and            % ok
  isUndefined( $var1 )   and          % not ok: Parsing error syntax error, unexpected ')', expecting '!'
  isUndefined( $var2 )   and          % not ok: Parsing error syntax error, unexpected ')', expecting '!'
  isUndefined( $var2 ! 0) and         % ok: But dont know why. I Asume that takes $var2 as a tuple
  isUndefined( $var2 ! 4) and         % ok: But dont know why. I Asume that takes $var2 as a tuple
  isUndefined(?)    and           % not ok: Parsing error syntax error, unexpected UNDEF
  isUndefined( [?]!0 )    and         % ok: I asume that what happens is that isUndefined expects a tuple. But don't work with plain undef value
  isUndefined( (0,0)~port1 )          % not ok: Parsing error syntax error, unexpected ')', expecting '!'

For the execution: TIME=00:00:10:000 SIMU_ARGS="$SIMU_ARGS -t$TIME"

undefBugTest.ma.txt

lukius commented 4 years ago

Bug can be reproduced in latest release using this sample model.

Suggested workaround: until this is addressed, please use the alternative syntax as shown in the model (i.e., (0,0)~value = ? instead of isUndefined((0,0)~value))