[antlr-interest] The following token definitions can never be matched because prior tokens ...

Asif Iqbal sasifiqbal at gmail.com
Thu Jun 4 11:12:22 PDT 2009


Hi,

I am new to ANTLR. I am trying to write following grammer in ANTLR.

//Grammer
grammar GLGrammer;
options
{
 output=AST;
 ASTLabelType=CommonTree;
 language=CSharp;
}
GLLanguage
 : GLQueries ';'
// :  (GLQueries ';') (';')*
 ;

GLQueries
 : ConfigurationStatement
// | InsertStatement
// | CreateStatement
// | DropStatement
// | ModifyStatement
// | PostStatement
 ;
ConfigurationStatement
 : 'SET' SetKeywords
 ;
InsertStatement
 : 'INSERT' INTEGER
 ;
SetKeywords
 :  'DEBUG' 'ON'
  | 'CURRENCY' CURRENCYCODE
  | 'FISCAL' FiscalParameter
  | 'COA' 'LEVEL' INTEGER
  ;
FiscalParameter
 : ('YEAR' | 'MONTH') INTEGER
 ;
INTEGER
 : ('0'..'9')+
 ;
FLOAT
 : ('0'..'9')* '.' ('0'..'9')+
 ;
DATETIME
  : '#' (~'#')* '#'
        ;
BOOLEAN
 : 'true'
 | 'false'
 ;

CURRENCYCODE
 : ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z') ('a'..'z' | 'A'..'Z')
 ;

IDENT
 : ('a'..'z' | 'A'..'Z' | '_') ('a'..'z' | 'A'..'Z' | '_' | '0'..'9')*
 ;

/* Ignore white spaces */
WS
 :  (' '|'\r'|'\t'|'\u000C'|'\n') {$channel=HIDDEN;}
 ;
//End Grammer

The issue is ANTLRWorks generating following error
[11:50:05] error(208): GLGrammer.g:23:1: The following token definitions can
never be matched because prior tokens match the same input:
ConfigurationStatement
Could not understand the issue. Please help.

Regards,
Asif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090604/66a1c47a/attachment.html 


More information about the antlr-interest mailing list