H
Harald
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.
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.