Menu

#751 Expressions in property values with units gives error

Version 4.0 RC1
assigned
None
Core
critical
3.1
enhancement
2016-05-15
2013-06-11
P. Douglass
No

I like to use expressions as property values, i.e.

"length (2*100)ft;"

because I can create different simulation scenarios with a text editor's search and replace function.

Unfortunately, doing this gives an error:
"expected ';' at end of property specification
expected object block closing }"

Using an expression without units is no problem, i.e.

"length (2*100);"

I found the problem in core/load.c in the expression() function: the function interface has a "unit" parameter, but the value of this parameter is never set. The following patch fixes the problem:

===================================================================

--- core/load.c (revision 3850)
+++ core/load.c (working copy)
@@ -1854,7 +1854,13 @@

}
--op_i;

}

  • + / Find units, if any /
    + if (TERM(unitspec(HERE,unit)))
    + ACCEPT;

/ if no semicolon, there's a bigger error, so we don't check that here /

/ postfix algorithm /
/* - while there are input tokens left,

Discussion

  • Jason Fuller

    Jason Fuller - 2013-06-12
    • owner changed from jcfuller to mhauer
    • priority changed from minor to major
    • version changed from 2.3 to 3.0
    • status changed from new to assigned
    • milestone set to Version 3.0 RC 1
     
  • Jason Fuller

    Jason Fuller - 2013-09-10
    • owner changed from mhauer to dchassin
    • priority changed from major to critical
    • version changed from 3.0 to 3.1
    • type changed from defect to enhancement
    • milestone changed from Version 3.0 RC 1 to Version 3.1 RC1
     
  • David P. Chassin

    I'll put this into trunk after 3.1 is released.

     
  • David P. Chassin

    • Milestone: Version 3.1 RC1 --> Unscheduled
     
  • David P. Chassin

    • Milestone: Unscheduled --> Version 4.0 RC1