[antlr-interest] Error in predicate logic
Gerald B. Rosenberg
gbr at newtechlaw.com
Mon Feb 19 12:01:21 PST 2007
Thanks much for the help, Gavin.
You were right about the unanticipated consuming of the
non-SEMIs. Missed it in my test case. Seems the ~(GRIDLET |
LETTERS) is not needed because of how Antlr resolves equal length
matches. This should be the final version:
SPCHAR : { !tagMode && !attrMode }?=>
( AMP GRIDLET INT SEMI { printState("SpDigit "); }
| AMP LETTERS SEMI { printState("SpLettr "); }
| (AMP GRIDLET INT ~';')=> AMP GRIDLET INT { $type=PCDATA;
printState("P2Data "); }
| (AMP GRIDLET ~INT)=> AMP GRIDLET { $type=PCDATA;
printState("P3Data "); }
| (AMP LETTERS ~';')=> AMP LETTERS { $type=PCDATA;
printState("P1Data "); }
| AMP { $type=PCDATA;
printState("PcData "); }
) ;
At 12:30 PM 2/16/2007, Gavin Lambert wrote:
>At 04:17 17/02/2007, Gerald B. Rosenberg wrote:
>>SPCHAR :
>> ( AMP GRIDLET INT SEMI { printState("SpDigit "); }
>> | AMP LETTERS SEMI { printState("SpLettr "); }
>> | AMP LETTERS ~';' { $type=PCDATA; printState("P1Data "); }
>> | AMP GRIDLET INT ~';' { $type=PCDATA; printState("P2Data "); }
>> | AMP GRIDLET ~INT { $type=PCDATA; printState("P3Data "); }
>> | AMP { $type=PCDATA; printState("PcData "); }
>> ) ;
>
>That one's going to consume the non-semicolon character following
>the letters as part of the PCDATA.
----
Gerald B. Rosenberg
Certiv Analytics
www.certiv.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070219/bc91107f/attachment.html
More information about the antlr-interest
mailing list