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

Sergei Smolov ssedai at gmail.com
Thu Apr 22 05:04:59 PDT 2010


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


More information about the antlr-interest mailing list