[antlr-interest] Skip Lexer Role

khamisdiab khamisdiab at yahoo.de
Thu Sep 16 06:48:29 PDT 2004


Hi

I'm new to ANTLR and I write a parser (in CPP) for my application and
want to be able to skip a lexer or a parser role by certain
conditions, as example for a preprocessor definition, I don't want to
skip the white spaces and even though I want to disable the string role:


... Parser

aDefine
  : "#define" {
         how to disable QUOTED_STRING???????
         bDisabled = true;
         bSkipWS = false;
      }
      ....
   ;

... Lexer

QUOTED_STRING
    {
       if (bDisabled)
           SKIP      ?????????
    }
   : '"' .... '"'
   ;

WS
 : (' ' .....)
  {
     if (! bSkipWS)
        SKIP         ???????????
  }
 ;

How to do that?

Thanks
Khamis




 
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