/**
* field := label fieldType (EQUALS_ASSIGN conditionalExpression)? annotation* SEMICOLON?
*/
private void field( AbstractClassTypeDeclarationBuilder declare ) {
FieldDescrBuilder field = null;
String fname = null;
try {
fname = label( DroolsEditorType.IDENTIFIER );
if ( state.failed ) return;
} catch ( RecognitionException re ) {
reportError( re );
}
try {
field = helper.start( declare,
FieldDescrBuilder.class,
fname );
// type
String type = type();
if ( state.failed ) return;
if ( state.backtracking == 0 ) field.type( type );
if ( input.LA( 1 ) == DRL6Lexer.EQUALS_ASSIGN ) {
// EQUALS_ASSIGN
match( input,
DRL6Lexer.EQUALS_ASSIGN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return;
int first = input.index();
exprParser.conditionalExpression();
if ( state.failed ) return;
if ( state.backtracking == 0 && input.index() > first ) {
// expression consumed something
String value = input.toString( first,
input.LT( -1 ).getTokenIndex() );
field.initialValue( value );
}
}
while ( input.LA( 1 ) == DRL6Lexer.AT ) {
// annotation*
annotation( field );
if ( state.failed ) return;
}
field.processAnnotations();
if ( input.LA( 1 ) == DRL6Lexer.SEMICOLON ) {
match( input,
DRL6Lexer.SEMICOLON,
null,