[antlr-interest] Token as token and variable name

sishen sishen_freecity at 126.com
Wed Sep 27 22:12:50 PDT 2006


try to set testLiterals=false; to the token.


Putrycz, Erik wrote:
>
> I’m having a problem writing a COBOL parser…
>
> The record names can be anything, even reserved words (isn’t that a 
> screwed up language?).
>
> And I’m not sure how to solve this issue properly; my rule for records 
> fails when a reserved word is found…
>
> This is a sample of the parser:
>
> record
>
> { String rName = "FILLER";
>
> }
>
> : rec:INT^ {#rec.setType(RECORD);}
>
> (nName:NAME { rName = #nName.getText();} |"FILLER")?
>
> (redefinesStatement)?
>
>>
> The record name (here NAME), can be any reserved token…
>
> **Erik Putrycz, Ph.D - Research Associate / 
> ****erik.putrycz at nrc-cnrc.gc.ca** 
> <mailto:erik.putrycz at nrc-cnrc.gc.ca>** / (613) 990 0681**
>
> Institute for Information Technology - Software Engineering Group
>
> National Research Council, Canada - Building M-50, 1200 Montreal Road
>
> Ottawa, Ontario, CANADA K1A 0R6
>




More information about the antlr-interest mailing list