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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to