This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: limit to length of an s-expression passed to eval?
- From: David Chase <dr2chase at mac dot com>
- To: kawa at sourceware dot org
- Date: Thu, 17 Nov 2011 21:36:43 -0500
- Subject: Re: limit to length of an s-expression passed to eval?
- References: <CAEBD5FA.25E71%lexaay@gmail.com>
An appalling hack, from years ago, is to find a way to encode your S-expression into a string or series of strings, and to "parse" those strings directly into data. This can help with startup time, too, since all that "code" may need to be verified (there's a lot of "it depends" here).
So for example:
static Map<String, String> aliases = StringEncodedAggregate.stringToMap(encodedAliases,';',
new BATree<String, String>(DefaultComparator.<String>normal()));
where encodedAliases looks like this:
final private static String encodedAliases =
"=/=;"+"NE;"+
"ACUTE_ANGLE;"+"\u299f;"+
"ALL_EQUAL_TO;"+"\u224c;"+
"ALMOST_EQUAL_OR_EQUAL_TO;"+"\u224a;"+
"ALMOST_EQUAL_TO;"+"APPROX;"+
...
"\u3014;"+"[/;"+
"\u3015;"+"/];"+
"\u3016;"+"{/;"+
"\u3017;"+"/};"+
"\u3018;"+"[//;"+
"\u3019;"+"//];";
(1220 lines, total).