/**
* enumerative := ID ( LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN )?
*/
private void enumerative( EnumDeclarationDescrBuilder declare ) {
EnumLiteralDescrBuilder literal = null;
String lit = null;
try {
Token enumLit = match( input,
DRL5Lexer.ID,
null,
null,
DroolsEditorType.IDENTIFIER );
lit = enumLit.getText();
if ( state.failed ) return;
} catch ( RecognitionException re ) {
reportError( re );
}
try {
literal = helper.start( declare,
EnumLiteralDescrBuilder.class,
lit );
if ( input.LA( 1 ) == DRL5Lexer.LEFT_PAREN ) {
match( input,
DRL5Lexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return;
boolean more;
do {
int first = input.index();
exprParser.conditionalExpression();
if ( state.failed ) return;
if ( state.backtracking == 0 && input.index() > first ) {
// expression consumed something
String arg = input.toString( first,
input.LT( -1 ).getTokenIndex() );
literal.constructorArg( arg );
}
more = input.LA( 1 ) == DRL5Lexer.COMMA;
if ( more ) {
match( input,
DRL5Lexer.COMMA,