*
* @return
* @throws RecognitionException
*/
public ImportDescr importStatement() throws RecognitionException {
ImportDescrBuilder imp = null;
try {
imp = helper.start( ImportDescrBuilder.class,
null,
null );
// import
match( input,
DRLLexer.ID,
DroolsSoftKeywords.IMPORT,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
String kwd;
if ( helper.validateIdentifierKey( kwd = DroolsSoftKeywords.FUNCTION ) ||
helper.validateIdentifierKey( kwd = DroolsSoftKeywords.STATIC ) ){
// function
match( input,
DRLLexer.ID,
kwd,
null,
DroolsEditorType.KEYWORD );
if ( state.failed ) return null;
}
// qualifiedIdentifier
String target = qualifiedIdentifier();
if ( state.failed ) return null;
if ( input.LA( 1 ) == DRLLexer.DOT && input.LA( 2 ) == DRLLexer.STAR ) {
// .*
match( input,
DRLLexer.DOT,
null,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return null;
match( input,
DRLLexer.STAR,
null,
null,
DroolsEditorType.IDENTIFIER );
if ( state.failed ) return null;
target += ".*";
}
if ( state.backtracking == 0 ) imp.target( target );
if ( input.LA( 1 ) == DRLLexer.SEMICOLON ) {
match( input,
DRLLexer.SEMICOLON,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return imp.getDescr();
}
} catch ( RecognitionException re ) {
reportError( re );
} finally {
helper.end( ImportDescrBuilder.class,
null );
}
return (imp != null) ? imp.getDescr() : null;
}