[antlr-interest] required (...)+ loop did not match anything at input '<EOF>'

Sergei Smolov ssedai at gmail.com
Thu Apr 22 05:47:29 PDT 2010


Thomas and Kirby Bohling

Thank you, it helps me so much

2010/4/22 <tcorbat at hsr.ch>

> Hello Sergey
>
> as LOWALPHA is declared as a "fragment" rule, it would only be included
> into other lexer rules and is not used to define and create a lexer token.
> Remove the "fragment' keyword and I guess it should work...
>
> Regards
> Thomas
>
> ________________________________________
> Von: antlr-interest-bounces at antlr.org [antlr-interest-bounces at antlr.org]
> im Auftrag von Sergei Smolov [ssedai at gmail.com]
> Gesendet: Donnerstag, 22. April 2010 14:04
> An: antlr-interest at antlr.org
> Betreff: [antlr-interest] required (...)+ loop did not match anything at
>      input '<EOF>'
>
> Hello, List!
> I try to develop a lexer\parser for SIP portocol grammar. But now I have
> the
> following error after an attempt to parse "INVITE sip:ssedai" string:
>
> line 1:12 mismatched character 's' expecting 'i'
> line 1:13 no viable alternative at character 'e'
> line 1:14 no viable alternative at character 'd'
> line 1:15 no viable alternative at character 'a'
> line 1:16 no viable alternative at character 'i'
> line 0:-1 required (...)+ loop did not match anything at input '<EOF>'
>
> Here is my grammar:
>
> ### grammar beginning ###
>
> grammar testGrammar;
>
> options {
> language = Java;
> backtrack = true;
>  output = AST;
> }
>
> request : request_line EOF;
>
> request_line : method SP request_uri;
>
> method : Invite;
>
> Invite : 'INVITE';
>
> SIP_BEGIN : 'sip:';
>
> SP : ' ';
>
> request_uri : sip_url;
>
> sip_url : SIP_BEGIN user;
>
> user : (LOWALPHA+) -> LOWALPHA+;
>
> fragment LOWALPHA : 'a'..'z';
>
> #### grammar end #####
>
> What I am doing wrong? Thanks in advance.
> --
> Sergey Smolov
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



-- 
Sergey Smolov


More information about the antlr-interest mailing list