[antlr-interest] IF Else Statment to call different Rule
Surender Seshadri
sseshadri at leapfrogsystems.com
Wed Jul 15 06:51:45 PDT 2009
Hi ,
Can some one please help me in correcting this grammar ASAP . I want to call different rule based on the Version I get from the input .The following code works but not sure if this is the right way to do this in ANTLR - Thanks
callVersionTemplate
//THERE IS A BETTER WAY TO DO
: { isValidVersion }? => (ALPHANUMERIC)*
{
if (myVersion..equalsIgnoreCase("1.0"))
{
ruleVersion1();
}
else if(myVersion.trim().equalsIgnoreCase("2.0"))
{
ruleVersion2();
}
}
;
ruleVersion1: { System.out.println("Inside ruleVersion1" );};
ruleVersion2: { System.out.println("Inside ruleVersion1");};
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090715/5819830c/attachment.html
More information about the antlr-interest
mailing list