[antlr-interest] Debugging: how? (Why do I get MismatchedTokenException or UnwantedTokenException?) Unhelpful error messages.

Hendrik Maryns qwizv9b02 at sneakemail.com
Thu Oct 30 07:28:47 PDT 2008


John B. Brodie schreef:
> Greetings!
> 
> Hendrik Maryns asked:
> 
>> I showed you my grammar yesterday.  Now trying it out on some simple
>> inputs blows me away right away: it doesn’t even parse anything.

> Your problem seems to be with your Lexer rule for LABEL which is :
> 
> LABEL : ~(')')+ ;
> 
> this means that any sequence of characters that is not a ')' must be a
> LABEL.

I am starting to understand the difference between lexer and parser now.
 I was thinking of it as some sort of regular expression parser, but
since the lexer does not know anything about the parser, it doesn’t care
about it.

> another problem is that ')' is not matched by any Lexer rule. did you
> want OPEN and CLOSE to be parens?

Yes, sorry, a relict of debugging.

>> Grateful for any suggestions,
> 
>>.....remainder of message snipped....
> 
> Hope this helps

It did, in that I know what is wrong, but I still have no solution to my
problem: how can I make the variable in my label rule be anything?  That
is, I would think anything except whitespace and braces and control
characters would be fine.  In particular, it definitely has to accept
any word in any script, along with some punctuation characters such as .
- _ $ and probably more.

H.
-- 
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20081030/a644aab8/attachment.bin 


More information about the antlr-interest mailing list