G
Guest
In my application the user can configure automation-scripts by inserting
different "actions" into a "procedure". These different procedure- and
action-objects are all translated into C# code before execution.
One "action" type is an expression-evaluator. At the moment the expression
the user writes into the action is just inserted into the generated C# code
unchanged.
The problem is the variables in my system and in the "procedures"; they are
not just the basic .NET types but my own types with more properties and
methods.
This means that the expression for incrementing the variable "myHeight"
looks like this: (myHeight.Value)++
I would like the user to be able to write: myHeight++
and my "pre-processor" would then convert it to: (myHeight.Value)++
I could just run through the expression and replace every occurrence of a
variable name with: (varname.Value)
but that would also take any occurrences of a variable name inside a string
constant or an object property or method with the same name as a variable.
Any suggestions how I could do this?
- I have no experience with parser- or compiler-construction.
Cheers,
Jan
different "actions" into a "procedure". These different procedure- and
action-objects are all translated into C# code before execution.
One "action" type is an expression-evaluator. At the moment the expression
the user writes into the action is just inserted into the generated C# code
unchanged.
The problem is the variables in my system and in the "procedures"; they are
not just the basic .NET types but my own types with more properties and
methods.
This means that the expression for incrementing the variable "myHeight"
looks like this: (myHeight.Value)++
I would like the user to be able to write: myHeight++
and my "pre-processor" would then convert it to: (myHeight.Value)++
I could just run through the expression and replace every occurrence of a
variable name with: (varname.Value)
but that would also take any occurrences of a variable name inside a string
constant or an object property or method with the same name as a variable.
Any suggestions how I could do this?
- I have no experience with parser- or compiler-construction.
Cheers,
Jan