[antlr-interest] Require Help...

saurav sauravkg at huawei.com
Thu Feb 23 03:59:34 PST 2006


Hi,

 

I have a doubt. Can any one clarify the same?

 

Problem Statement:

 

Below is the code generated by the ANTLR Tool

 

for (;;) {  

                  if (((_tokenSet_2.member(LA(1))))&&( myErrorRecovery() ))
{

                        moduleDefinition();

                        if (inputState->guessing==0) {

                              

                        }

                        {

                        if ((LA(1) == SemiColon)) {

                              match(SemiColon);

                        }

                        else if (((_tokenSet_16.member(LA(1))))&&(
optionalSemicolon() )) {

                        }

                        else {

                              throw antlr::NoViableAltException(LT(1),
getFilename());

                        }

                        

                        }

                  }

      /* [1] */    else {

                              // I need to add statement here

                        if ( _cnt34>=1 ) { goto _loop34; } else {throw
antlr::NoViableAltException(LT(1), getFilename());}

                  }

                  

                  _cnt34++;

            }

 

The above code is generated by using the following .g code

 

moduleDefinitionsList  :  

  

  (   ({ myErrorRecovery() }? | moduleDefinition)+   ( SemiColon! | {
optionalSemicolon() }?   ) )+

;

 

 

I want to do some modifications on .g code so that either of the below
mentioned modifications will happen

1. Add some statement inside the "ELSE" block marked [1]

2. Alter the "IF" condition like 

    if (( myErrorRecovery() ) && ((_tokenSet_2.member(LA(1))))) {.}

                        

                          OR

 

  if (((_tokenSet_2.member(LA(1))))||( myErrorRecovery() )) {.}

 

Please help me for the same. We are using this code for Error Recovery.

 

Thanks.

Saurav

 

 

****************************************************************************
***********

            This e-mail and attachments contain confidential information
from HUAWEI, which is intended only for the person or entity whose address
is listed above. Any use of the information contained herein in any way
(including, but not limited to, total or partial disclosure, reproduction,
or dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060223/8cef2324/attachment.html


More information about the antlr-interest mailing list