[antlr-interest] detecting transitions in stanza-based files
Bryan Ewbank
ewbank at gmail.com
Wed May 11 15:34:37 PDT 2005
Richard,
That's really rather elegant. I have to remember that idiom.
On 5/10/05, Richard Clark <rdclark at nextquestion.net> wrote:
> stanza
> : STANZA
> { // Classify this according to length
> AST probe = #stanza;
> int length = 0;
> while (probe != null) {
> probe = probe.getNextSibling();
> length++;
> }
> if (length > 3)
> #stanza = (#[LONG_LINE, "long"], #stanza);
> else
> #stanza = (#[SHORT_LINE, "short"], #stanza);
> }
> ;
More information about the antlr-interest
mailing list