[antlr-interest] Why waiting timeout? why cannot find symbol?
Gavin Lambert
antlr at mirality.co.nz
Sat Nov 22 16:05:05 PST 2008
At 06:36 23/11/2008, Su Zhang wrote:
>I meet two very strange problems when debugging my program,the
>first one is "timeout waiting connect remote parser",
Are you compiling the grammar with -debug so it includes the debug
code, and running it before you select Debug Remote?
(If your target language is Java, as it seems to be, then you
shouldn't need to use Debug Remote anyway. Just use the normal
Debug. But of course before that'll work you'll need to fix your
compilation errors.)
>the other is cannot find symbol
>[11:17:54] symbol : variable b64
>[11:17:54] location: class assignment6Parser
>[11:17:54] b64=i.getText();
[...]
>base returns [String b64 ]
> : i= ID {!(i.getText().contains("-"))
>}?{!(i.getText().contains("_"))}? {b64=i.getText();}
> ;
This is where that's coming from. This is because you're not
using the correct syntax to refer to ANTLR-defined symbols,
neither here nor in any of your other rules. While you might get
away with it sometimes, it's bad style and reduces portability.
Instead of writing "b64=i.getText()", you should be using "$b64 =
$i.text".
You should never refer to a parameter, return value, or label
defined in the ANTLR grammar without using the $ syntax.
More information about the antlr-interest
mailing list