[antlr-interest] problem with syntactic predicates

whaefelinger ora.et.labora at web.de
Thu Oct 28 01:19:59 PDT 2004



Hello,

antlr's 2.7.4 documentation states: 

"Syntactic  predicates  are a form of selective back-
tracking and, therefore, actions are turned off while
evaluating a  syntactic  predicate so that actions do 
not have to be undone." 

1st issue:

Having a look into generated code I can see that actions
to create tree nodes are still done while "guessing". Is
there a specific reason for creating them?

2nd (more important) issue:

Assume  one   of  my actions is to switch to a different
lexer  (as in the javadoc example).  This  lexer  switch 
would then  not  be  executed and consequently "guessing"
would fail, right?

Perhaps I miss the point but shouldn't there be something
that let me tell antlr to executed this action regardless
of guessing or not?

Here's a proposal:

JAVADOC_OPEN
    :    "/**" {! selector.push("doclexer"); }  ;
================^

The operator  "{!" shall indicate execution of action in
any case (the action is assumed to be "idempotent").


But perhaps I missed the point. Is there another way of
doing this?

Wolfgang.







 
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