[antlr-interest] next problem - kindof

Diehl, Matthew J matthew.j.diehl at intel.com
Thu Aug 2 17:15:41 PDT 2007


You're using the WS in your grammar...but the lexer is skipping them.
The parser only reads tokens on a certain channel (and doesn't read
skipped ones), so if you skip tokens or put them on a separate channel,
the parser does not have access to them.

Matt 

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org 
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Warner Onstine
> Sent: Thursday, August 02, 2007 5:09 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] next problem - kindof
> 
> Ok, so I have a unit test on my grammar to just call the grammar (for
> right now) so I can see where it is matching stuff.
> 
> The printlns are working properly, but I get alot of errors from antlr
> as well. This time I'm attaching the revised grammar and the test file
> I'm using, and here are the errors/printlns I'm getting.
> 
> found package org.chama.test.models
> found model Band
> line 1:0 mismatched input '\r\n' expecting 'package'
> line 2:6 mismatched input 'Band' expecting WS
> line 2:12 mismatched input '\r\n' expecting '}'
> line 1:8 mismatched input 'org.chama.test.models' expecting WS
> line 3:0 mismatched input 'model' expecting NEWLINE
> line 3:6 mismatched input 'Band' expecting WS
> 
> When I was walking through the antlr 3 book I was not getting any
> errors like this so I know it's not normal just trying to figure out
> what I'm doing wrong in the grammar.
> 
> Thanks again for the help, really appreciate it!
> 
> -warner
> 
> -- 
> Warner Onstine - Programmer/Author
> New book on Tapestry 4!
> Tapestry 101 available at
> http://sourcebeat.com/books/tapestrylive.html
> warner at warneronstine.com
> http://warneronstine.com/blog
> 


More information about the antlr-interest mailing list