[antlr-interest] How to look only for one rule?
Loring Craymer
lgcraymer at yahoo.com
Sat Oct 21 14:32:19 PDT 2006
Hmm. In cases where you have a complete grammar (and
for C, the ANTLR 2 C grammar stuff done by Monty and
others is definitely complete), I usually find it
better to take that and recognize everything but only
process what you need. I would suggest modifying the
C grammar to build trees that only contain the methods
of interest and none of the stuff that you want to
ignore. That gets you to a solution fast, and also
leaves room for extending the range of what you are
interested in later.
--Loring
--- Terence Parr <parrt at cs.usfca.edu> wrote:
> Hi. See the filter example, which does it all in
> the lexer. Have a
>
> EVERYTHINGELSE : . ;
>
> rule at bottom to skip everything but your rules of
> interest.
> Ter
> On Oct 21, 2006, at 4:54 AM, Matthias Gutheil wrote:
>
> > Hello,
> >
> > I am writing a fuzzy C grammar and I am only
> interesting in methods
> > with parameters and return values.
> >
> > The method definition is not the problem, but I
> want to skip
> > anything else.
> > For example something like (method | ~method)
> doesn't work, cause
> > so the first token af a real method (return type
> or name) goes in
> > ~method.
> >
> > Some tips?
> >
> > Matthias
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the antlr-interest
mailing list