Hi list
I need to parse and evaluate algebraic expressions with variables.
Some of variables is simply variable name which replaced with it
value when evaluating, but some variables is complex variable with
index part (like array indexing). For example
variable{1}
For this kind of variables I need to do additional actions (based on
variable name and index) before evaluating. For example, I have variable
"layer", when this variable found without index part I need to return
one value, when index is 2 (in expression this looks as layer{2}) I need
to return second value, index is 1 (in expression this looks as layer{1})
I need to return third value.
Is it possible with pyparsing? I look at manuals and example SimpleCalc.py
and this looks very similar for what I want. I think, that index part must
be described with Optional class. But I can't understand what I must add to
the SimpleCalc.py for parsing and evaluating variables with indexes.
Can anyone help me with this?
Thanks
and sorry for my bad English, I'm Ukrainian
--
Alexander Bruy
mailto: ale...@gm...
|