I have a following problem with the grammar:
The input string i'm going to parse is as follows:
ruledef COMPLEX1
ftp command args = abc
ftp command args = ftp
ftp command args = cde
exit
The grammar i use:
grammar main;
/*Lexical*/
NUM : [0-9]+;
STRING : [0-9a-zA-Z]+;
WS : [ \t\r\n]+ -> skip; // Whitespace definition: skip spaces, tabs and newlines
ruledefrule: 'ruledef' STRING (ruledef_ftpcommandargsrule )* 'exit';
ruledef_ftpcommandargsrule: 'ftp' 'command' 'args' '=' STRING ;
When i run it through antlr i receive an error:
line 3:23 missing STRING at 'ftp'
What is more any of the words used in the input for example 'command' or 'args' causes the same problem.
ftp command args = ftp
ftp command args = args
ftp command args = command
Does anybody know how to deal with that kind of problems?