[antlr-interest] Rule automation
Martin Potier
martin.potier at gmail.com
Wed Sep 9 01:45:17 PDT 2009
Hi all,
I've got something on my mind that the Definitive ANTLR Reference
couldn't solve (yet, I'm not tottally through it).
Is there a way with ANTLR v3 to automate some rule ?
Id est, while building a small wiki language I wrote this kind of rule :
text
: (PURETEXT ( inlinenv | PURETEXT )*)
| (inlinenv (PURETEXT | inlinenv)*)
;
In fact, I use the same sort of rule every time I introduce text in a
inlinenv.
I'd like to know if there's a way to create a generic rule like the
following :
generic altern ((ARG1, ARG2))
: (ARG1 (ARG2 | ARG1)*)
| (ARG2 (ARG1 | ARG2)*)
;
And then reuse it, like an operator ?
Cheers,
Martin
More information about the antlr-interest
mailing list