Hi,
Currently ParserFunctions have no notion about variables, which
resulting in lots of typing and lots of braces, for example:
{{ #ifexpr: {{ #var: a }} + {{ #var: a }} > 4 | ... }}
I always wanted #expr and #ifexpr functions recognize variables so I can
write
{{ #ifexpr: a + a > 4 | ... }}
Attached patch implements this integration between ParserFunctions and
Variables.
Changes summary:
1. When if a word is a not predefined expression word (like `pi' or
`trunc'), it is checked whether Varaibles extension enabled and whether
such a variable exists. If variable exists, its value used.
2. New error message introduced: "Unexpected variable".
3. Second parameter added to ExprParser::doExpression, parser — it is
required by Variables (though it is not actually used). For
compatibility with older code, parameter is optional.
4. Variables extension is not required, if Variables extension is not
enabled, ParserFunctions does not recognize variables but does not issue
errors.
I have access to SVN. If the patch is generally ok, I can commit it.
Thanks,
Van.