colin.flem... at coreproc.com
Thu Sep 14 22:20:30 UTC 2006
Sure, I've factored out the common rules, so I've attached a tar with
the ASCII only and Unicode versions.
BTW I'd also be interested in any suggestions you can give me for
replacing part of the grammar. Obviously XML is context free, mostly
this is OK (I'm going to use the tag stack we discussed) but there's
one section which is still giving me a headache.
It was like this (line 73 in xmlcommon.rl) :
cp = (Name | choice | seq) ('?' | '*' | '+')?;
seq = '(' S? cp ( S? ',' S? cp )* S? ')';
choice = '(' S? cp ( S? '|' S? cp )* S? ')';
children = (choice | seq) ('?' | '*' | '+')?;
I've just put in a dirty hack for now that will hopefully at least lex
the construct more or less, but won't enforce any of the original
grammar constraints. Any suggestions about how to do this gracefully
would be great. I thought about using fcall but seq and choice are
ambiguous after the opening parenthesis. I also thought about using
the conditional trick in test/cond6.rl, but then it gets tricky making
sure that it enforces sequences of only alternations or only
concatenations (i.e. preventing ( a | b , c ). I really do need a
stack of which symbol is used at what indentation level I think, but
it's going to get a bit hairy.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 20480 bytes
Desc: not available
More information about the ragel-users