Forgot to reply to the entire group...

On Fri, Aug 6, 2010 at 8:03 PM, Bill Andersen <bill.ander...@mac.com> wrote:

>
> Is there a good way to do a partial parse of Java code to pick out
> declarations (or any other structure).  If it helps, I'm limiting this to
> pretty vanilla Java assignment and declaration expressions - no class defs.
>
>

You could create a lexer that parses only those tokens you define by adding:

@options { filter = true; }


at the top of your lexer.

For example, the following lexer:

lexer grammar Foo;

@options { filter = true; }

Int : '0'..'9'+ ;


will only create tokens consisting of one or more digits and will ignore the
rest of the input.

Note that you cannot (!) create a combined grammar (parser & lexer), only a
lexer-grammar.

Good luck!

Regards,
Bart.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to