Zenzike
2008-12-18 18:04:55 UTC
I'm trying to make it so that input only occasionally matches tokens
that are sent to the hidden channel.
My grammar has something along the following:
SLASHSLASH : '\\\\' {$channel=HIDDEN}; // For the symbols "\\"
This is regarded as whitespace in the language I'm trying to define,
and should be able to
appear between any two tokens. However, occasionally, I want to make
sure that there is definitely
a SLASHSLASH token between two other tokens.
As far as I can tell, the way to do this is to hide the SLASHSLASH
(which I have done),
and in places where it is needed, I should query the hidden channel --
but I can't find
any documentation about how this done (although there seems to be
plenty saying that it is possible!)
Something like this would be ideal:
rule : TOKEN1 {channel.hidden.match(SLASHSLASH)} TOKEN2 ;
What is the right syntax?
Many thanks!
zenzike
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
that are sent to the hidden channel.
My grammar has something along the following:
SLASHSLASH : '\\\\' {$channel=HIDDEN}; // For the symbols "\\"
This is regarded as whitespace in the language I'm trying to define,
and should be able to
appear between any two tokens. However, occasionally, I want to make
sure that there is definitely
a SLASHSLASH token between two other tokens.
As far as I can tell, the way to do this is to hide the SLASHSLASH
(which I have done),
and in places where it is needed, I should query the hidden channel --
but I can't find
any documentation about how this done (although there seems to be
plenty saying that it is possible!)
Something like this would be ideal:
rule : TOKEN1 {channel.hidden.match(SLASHSLASH)} TOKEN2 ;
What is the right syntax?
Many thanks!
zenzike
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address