nikhilgupta10 / GridLAB-D

Other
1 stars 0 forks source link

#751 Expressions in property values with units gives error, #2489

Open nikhilgupta10 opened 7 years ago

nikhilgupta10 commented 7 years ago

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

\length (2*100)ft;\n

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);\n

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,

,

nikhilgupta10 commented 7 years ago

nikhilgupta10 imported these comments from Sourceforge: The user dchassin does not exist anymore. Therefore assigning this to afisher1. "jcfuller": * owner changed from jcfuller to mhauer