[antlr-interest] distinguish "3 + 4" from "3 +4"
Andreas Liebig
liebigandreas at yahoo.com
Wed Oct 5 05:26:35 PDT 2011
I think I found the solution here:
http://www.antlr.org/wiki/pages/viewpage.action?pageId=557063 ("How do I access hidden tokens from parser?")
This will allow to check for whitespace before or after the + or -.
If you know an easier solution, please let me know.
Thanks
Andreas
________________________________
From: Andreas Liebig <liebigandreas at yahoo.com>
To: "antlr-interest at antlr.org" <antlr-interest at antlr.org>
Sent: Wednesday, October 5, 2011 1:14 PM
Subject: [antlr-interest] distinguish "3 + 4" from "3 +4"
Hello,
I am not very experienced with ANTLR, and I would like to ask for some ideas how to solve this task:
I have to distinguish input streams like
"3 + 4" (parsed as three tokens NUMBER PLUS NUMBER) from
"3 +4" (parsed as NUMBER NUMBER, because the + is part of the number +4).
I would like to ignore whitespace in general using the "$channel=HIDDEN;" syntax. But only in this situation whitespace does matter.
Can you guide me to a good explanation of a possible solution?
Thanks
Andreas
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list