[antlr-interest] condition not tested in the lexer : bug in c ode generation ?

mzukowski at yci.com mzukowski at yci.com
Mon Jun 23 11:52:57 PDT 2003


I don't have time to test this right now, but it could be related to Ter's
"hoisting" for lexers.  To test my hypothesis try this code instead:

DELIMITER : RDELIMITER;

protected DELIMITER   :
      { !bInCIAOContext }? ('\244' (WS_CC)? STAT_ID (WS_CC)? '/')=> '\244'
            {
                  this->bInCIAOContext = false;
                  this->bInInfoContext = false;
                  $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);
            }
      | { bInCIAOContext }? '\244'
            {
                  this->bInCIAOContext = true;
                  this->bInInfoContext = false;
                  $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);
            }
;

Was the bug in code generation for that rule or for nextToken()?

Monty
-----Original Message-----
From: Anthony Brenelière [mailto:abreneliere at telys.com] 
Sent: Monday, June 23, 2003 11:17 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] condition not tested in the lexer : bug in code
generation ?


I have the following rule in the lexer :

DELIMITER   :
      { !bInCIAOContext }? ('\244' (WS_CC)? STAT_ID (WS_CC)? '/')=> '\244'
            {
                  this->bInCIAOContext = false;
                  this->bInInfoContext = false;
                  $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);
            }
      | { bInCIAOContext }? '\244'
            {
                  this->bInCIAOContext = true;
                  this->bInInfoContext = false;
                  $setType(ANTLR_USE_NAMESPACE(antlr)Token::SKIP);
            }
;

The first condition is { !bInCIAOContext }? and works correctly.

The second condition is { bInCIAOContext }? And does not seem to appear in
the generated code.

Is it a bug ? Or is my rule syntax incorrect ?

Cordially,
Anthony Breneliere


Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 

 

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




More information about the antlr-interest mailing list