[antlr-interest] (no subject)

Jens Boeykens jens.boeykens at gmail.com
Mon Jul 7 23:51:23 PDT 2008


Actually I still get an error whit this lexer rule, both in my project and
in antlrworks. It parses the quotes now, but at the end it throws an
exception as output:

Exception in thread "main"
org.antlr.runtime.tree.RewriteEmptyStreamException: token st
    at
org.antlr.runtime.tree.RewriteRuleElementStream._next(RewriteRuleElementStream.java:158)
    at
org.antlr.runtime.tree.RewriteRuleTokenStream.next(RewriteRuleTokenStream.java:57)
    at
stage.antlr.regeneration.grammar.ANTLRv3Parser.rewrite_template(ANTLRv3Parser.java:10135)
    at
stage.antlr.regeneration.grammar.ANTLRv3Parser.rewrite_alternative(ANTLRv3Parser.java:8446)
    at
stage.antlr.regeneration.grammar.ANTLRv3Parser.rewrite(ANTLRv3Parser.java:8069)
    at
stage.antlr.regeneration.grammar.ANTLRv3Parser.altList(ANTLRv3Parser.java:3855)
    at
stage.antlr.regeneration.grammar.ANTLRv3Parser.rule(ANTLRv3Parser.java:2460)
    at __Test__.main(__Test__.java:16)

It doesn't specifically occurs with the quotes '"'. The angles '<<' '>>'
throw the same exception...

Is there something wrong with my input?

r : a -> template() "this is a temp";
r : a -> template() <<this is a temp>>;


Jens


2008/7/7 Terence Parr <parrt at cs.usfca.edu>:

> Wow...  that freaked me out for a second... it turns out that there is a
> lexer error, which both of us fail to see; I clicked on the output tab and
> saw it. fix with this
>
> DOUBLE_QUOTE_STRING_LITERAL
>        :       '"' (ESC | ~('\\'|'"'))* '"'
>        ;
>
>
> Ter
>
>
> On Jul 7, 2008, at 12:02 PM, Jens Boeykens wrote:
>
>  Hello all,
>>
>> I'm have an issue with parsing a particular input with ANTLRv3.g (
>> http://www.antlr.org/grammar/ANTLR).
>> I'm trying to parse the following rule:
>>
>> r : a -> template() "Some test";
>>
>> This however doesn't parse, but I can't find a bug in ANTLRv3.g or a
>> mistake in my input rule. Using ANTLRworks it seems to parse well until
>> template() and than the match fails. Don't know what could be wrong with
>> "..." though.
>>
>> Greetings
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080708/d324491b/attachment.html 


More information about the antlr-interest mailing list