[antlr-interest] Re: java15.g: Can't parse only conditionalExpression

Terence Parr parrt at cs.usfca.edu
Tue Nov 23 11:02:26 PST 2004



On Nov 23, 2004, at 9:54 AM, Jens Theeß wrote:
> Next thing is how to best switch lexers. Fortunately, I have control
> over the syntax of the language (I'm extending the sequence diagram
> syntax to allow for embedded java actions). Following example is what I
> would like to do:
>
> a -> b.foo(5, String d:d.startsWith("ha"), 10);
>
> This is a sequence diagram event meaning that obj. a calls b.foo with
> the parameters 5, a String that starts with "ha", and 10. To support
> this, I think I would have to switch lexers from the parser, which is a
> no-no. So I could modify the syntax to look like this:
>
> a -> b.foo(5, String d:j{d.startsWith("ha")}, 10);
>
> or something similar, where I would switch to Java lexer upon seeing
> "j{" and switch back upon "}". Or is there any easy way to support the
> first version?

Not sure why you need it.  Why doesn't the following work:

a -> b.foo(5, d.startsWith("ha"), 10);

?

Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list