I'm sure someone has mentioned it already but what about the lexer support in 
ANTLR?

http://www.antlr.org/wiki/display/ANTLR3/FAQ+-+Lexical+analysis

ANTLR is available under the BSD license, which seems to be one with no strings 
attached:

http://www.antlr.org/license.html

Best Regards,
Jonathan S. Levinson

-----Original Message-----
From: Vincent Hennebert [mailto:vhenneb...@gmail.com] 
Sent: Wednesday, October 07, 2009 6:51 AM
To: fop-dev@xmlgraphics.apache.org
Subject: Re: Regular expression use

Hi Jonathan,

Jonathan Levinson wrote:
> I noticed that if one is not careful in one's regular expression use,
> the compilation for a regular expression can take minutes.  I'm not
> talking about applying the pattern just compiling it!
> 
>  
> 
> Should regular expressions be avoided altogether and should one use
> hand-crafted state machines for parsing, and tokenizing, or can regular
> expressions be used as long as one is careful?  

I’d say, use regular expressions as long as they are not too complex.
But I guess you’re mentioning that in the context of property parsing,
in which case I don’t think regular expressions are the ultimate answer.
A proper lexer is likely to be needed, either generated or written by
hand. As the latter solution quickly becomes a maintenance nightmare,
some lexer generator will probably be needed. Question remains, which
one, and I’m not even sure there’s one that exists whose license is
ASLv2-compatible. Plus there are some issues specific to property
parsing, like shorthands (which should ideally re-use the parsers of the
individual properties), sub-properties, etc.


Vincent

Reply via email to