[antlr-interest] Check the next token in Hidden Channel

Alexander Gängel alexander at gaengel.de
Mon Apr 14 07:49:43 PDT 2008


OK I think you are right, maybe I was still asleep when I tried it this 
morning.

Alexander

Johannes Luber schrieb:
> Alexander Gängel schrieb:
>> I hace to check in my Parser once if the next Token is a Whitspace.
>>
>> I tried the code from:
>> http://www.antlr.org/wiki/pages/viewpage.action?pageId=557063
>>
>> So is copied it to my Grammar:
>> @members{
>>    protected int skipOffTokenChannels(int i) {
>>        int n = tokens.size();
>>        while ( i<n && ((Token)tokens.get(i)).getChannel()!=channel ) {
>>            i++;
>>        }
>>        return i;
>> }
>> }
>>
>> But the Code compains that tokens cannot be resolved?
>>
>> I use 3.1 so I think there is something changed sice 3.0.
>>
>> Can anybody give me an hint how to do this ?
>
> Looking at the wiki text, I believe you have to modify 
> CommonTokenStream.java, not your grammar. Alternatively you could 
> derive a class from CommonTokenStream which is the cleaner solution.
>
> Johannes
>


More information about the antlr-interest mailing list