Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

I have a grammar that requires a white space ' ' in one of my lexer rules. However, I wish to ignore whitespace ' ' everywhere else because I don't want the parser to be whitespace sensitive. I understand that using $channel=HIDDEN is sending the WS characters to the hidden channel so that the parser doesn't see them. This worked just fine until I realized that I needed to support having 1 or more spaces in the middle of my NAME lexer rule. I have yet to find the proper way for handling this in ANTLR 3.1.3. Perhaps some type of predicate? having the parser look at the hidden channel? Maybe not hiding ' ' and mucking up my parser syntax to look for ' ' when possible? Hopefully not the last as it doesn't seem very pretty. Any detailed help would be greatly appreciated. I am using the C target.

I've provided this example as a very stripped down version of my grammar and the basic issue.

...