[antlr-interest] bug in java.g?

SainTiss saintiss at arklinux.org
Tue Feb 3 16:19:23 PST 2004


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

On Tuesday 03 February 2004 21:00, mzukowski at yci.com wrote:
> You can't call arbitrary methods like statement or expr, you have to be
> sure you have a rule with EOF that you call.  Like
>
> statementComplete: statement EOF;

I see what you mean, but that doesn't seem to solve the problem.. Still 
getting the exact same exception... 
To me, it would seem that matching the statement should work *before* getting 
to EOF (after all the statement is complete when the ';' is read), which 
would explain why adding EOF doesn't work here: there is a problem while 
parsing the statement itself (also, the exception mentions that "m" is 
unexpected).
Or could the problem lie with the lookahead? The parser trying to read the 
next 2 tokens but stumbling upon EOF?

I'm a bit lost here...

Thanks,

Hans

>
> Monty
>
> -----Original Message-----
> From: SainTiss [mailto:saintiss at arklinux.org]
> Sent: Tuesday, February 03, 2004 11:55 AM
> To: antlr-interest at yahoogroups.com
> Subject: [antlr-interest] bug in java.g?
>
> Hi,
>
> when parsing a file containing nothing but the following line:
>
> m = (TEST) d;
>
> I get the following exception:
>
> parser exception: emp.java:1:1: unexpected token: m
> emp.java:1:1: unexpected token: m
>         at JavaRecognizer.statement(JavaRecognizer.java:2058)
>         at Main.parseFile(Main.java:81)
>         at Main.doFile(Main.java:54)
>         at Main.main(Main.java:24)
>
> I'm calling the "statement()" method from the JavaRecognizer, so the file
> should be valid.
> What's more, if I add a word (e.g. "smdfjmkj") on a line after the
> statement
>
> in the file, the parser does *not* throw the exception...
>
> Is there an explanation for this?
>
> Thanks,
>
> Hans

- -- 
Ark Linux - Linux for the Masses (http://arklinux.org)

Capitalism: 
You don't have any cows. The bank will not lend you money to buy cows, 
because you don't have any cows to put up as collateral.

Representative Democracy:
You have two cows. Your neighbors pick someone to tell you who gets the milk. 

In a world without walls and fences, who needs windows and gates?

Hans Schippers
2LIC INF
UA 2003-2004
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQFAIDqOXlnUYIbmLOQRAqvwAJ9M9h2yGZqxwAVzrLetkvmmsUTUmwCgnUG/
Rj3W4ZkGHAPOeOj/082opMw=
=nZJ7
-----END PGP SIGNATURE-----


 

Yahoo! Groups Links

To visit your group on the web, go to:
 http://groups.yahoo.com/group/antlr-interest/

To unsubscribe from this group, send an email to:
 antlr-interest-unsubscribe at yahoogroups.com

Your use of Yahoo! Groups is subject to:
 http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list