[antlr-interest] Rewind one token?

Ingo Maier i.maier at gmx.de
Thu Aug 19 06:55:05 PDT 2004


On Mon, 2004-08-16 at 11:40, Monty Zukowski wrote:
> Giving different rules a try is exactly what syntactic predicates are 
> for.  Perhaps if you could post a small example that shows the problem 
> we can help out.
> 
> Monty

I want to merge two parsers with each having its own lexer. Let's take
OCL and Java as an example. The following input:

context: Foo
inv: 42==42

class Foo {}

Give OCL a try, it parses til (including) "class" because a boolean
operator and additional expressions may follow 42==42. But at "class"
the OCL parser fails. Now, I want to start the Java parser. However, it
needs the "class" token. Not as a token, but as a character sequence
because the Java lexer may produce a different token out of it.

So I assume this has to be done on the character level. Does ANTLR
supports me with my problem in any way?

Thanks,
Ingo



 
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