macro processor, string juggler, script language ?




Doing a lot with regular expressions --- big ones, huge ones, terrifying
monster ones --- I end up piecing together things with static final
Strings. To give you an idea of how this may look:

...
// Now piece it all together
public static final String REALLY_CUTE_STUFF =
"(" + WOOW + "[aeiou]*"
+ "|" JUNK
+ "|" BONGO
")*" + OPTSPACE

Obviously this is not easy to read, in particular on the third page of
code and with nested stuff all along.

o) I thought about using a script language (jython, jacl come to mind) and
its string manipulation facilities in external scripts to generate the
regexps. But this separates the regexps from the code and the two get
out of sync all to easy.

o) I thought about using jython or jacl interpreter objects to
interpret scripts in static final Strings, but this would entail,
say, python code within the Java source code, which isn't nice either.

o) I thought about piecing together a macro expansion facility
myself. Easy enough, but there are so many wheels around, I should not
have to invent another one.

Suggestions?

Harald.

--
---------------------+---------------------------------------------
Harald Kirsch (@home)|
Java Text Crunching: http://www.ebi.ac.uk/Rebholz-srv/whatizit/software
.



Relevant Pages

  • Re: Scriptable dynamic forms applications
    ... I've got a simulation software where you have literally hundredths of little DWS scripts running per second, memory usage for all these is comparable to that of a single 'hello world' WinForms application;) ... Now I am adding 3D music visualization engine to the application. ... formula calculations as an external DLL. ... Delphi strings, but actually uses variant strings. ...
    (borland.public.delphi.non-technical)
  • Re: Problems embedding Python
    ... Psymaster wrote: ... If I try the same scripts as strings to interpret it works. ...
    (comp.lang.python)
  • MFC app to Python IDLE communication
    ... In my MFC application I need to call Python IDLE, ... scripts or values - they are simple strings or memo fields) there so ...
    (comp.lang.python)
  • Re: Problems embedding Python
    ... Psymaster wrote: ... If I try the same scripts as strings to interpret it works. ...
    (comp.lang.python)