Hi Bill,

Just throwing up a suggestion here (haven't thought it through).  Lex
the input, ignore comments and parse the rest into statements (ending
with ';') and blocks (ending with  {} block) containing statements, and
then try to parse each statement as variable declarations.  Would you
need to determine the context of the variable (local, class, etc.)?

If you expect to target other Java phrases and/or their context, you
might be better off writing the full grammar first.

Hope others will chime in with better suggestions.

J

Bill Andersen wrote:
> Hi folks
> 
> I'm working on a DSL that allows insertion of Java code blocks.  The only 
> information I really need to get from the Java are variable declarations - 
> what vars declared to be what type.  The rest I don't care about.
> 
> 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.
> 
> Thanks
> 
>       .bill
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 


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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to