> I need to automatically edit a human generated beanshell script=20
> in a file on disk. To do this I need to know the location of=20
> specific statements in the file.
> Specifically, I want to know the staring and ending character=20
> position of a certain assignment statement. The statement would=20
> have the form.
I have a similar problem: I want to allow users to type in expressions,
and then wrap them as functions and load them into the interpreter (for
For simple expressions, I could always just prepend a "return " before
the expression, and a ";" afterwards, to give me a default body. But if
I want to allow the users to do certain complex or repetitive
expressions as separate statements (creating temporary variables) before
the expression, this gets tougher.
E.g. if I want to support a user doing something like:
(a !=3D null && b !=3D null && a.equals(b))
And I want to wrap just that last expression with a "return " and ";",
and then wrap the entire body as a boolean function.
(The real problem is that I can't express this as
return (a =3D something(), b =3D something(), a.equals(b));
This gives me a syntax error.)
This is another situation where I could use an explicitly controlled,