net.esper.eql.parse
Class EQLTreeWalker

java.lang.Object
  extended by antlr.TreeParser
      extended by net.esper.eql.generated.EQLBaseWalker
          extended by net.esper.eql.parse.EQLTreeWalker
All Implemented Interfaces:
EqlEvalTokenTypes

public class EQLTreeWalker
extends EQLBaseWalker

Called during the walks of a EQL expression AST tree as specified in the grammar file. Constructs filter and view specifications etc.


Field Summary
 
Fields inherited from class net.esper.eql.generated.EQLBaseWalker
_tokenNames, _tokenSet_0, _tokenSet_1, _tokenSet_2
 
Fields inherited from class antlr.TreeParser
_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth
 
Fields inherited from interface net.esper.eql.generated.EqlEvalTokenTypes
ALL, AND_EXPR, ARRAY_EXPR, ARRAY_PARAM_LIST, AS, ASC, AVEDEV, AVG, BAND, BAND_ASSIGN, BETWEEN, BNOT, BOGUS, BOOL_TYPE, BOR, BOR_ASSIGN, BSR, BSR_ASSIGN, BXOR, BXOR_ASSIGN, BY, CASE, CASE2, CLASS_IDENT, COALESCE, COLON, COMMA, CONCAT, COUNT, DATABASE_JOIN_EXPR, DAY_PART, DBFROM_CLAUSE, DBSELECT_EXPR, DBWHERE_CLAUSE, DEC, DESC, DISTINCT, DIV, DIV_ASSIGN, DOT, DOUBLE_TYPE, ELSE, END, EOF, EQUAL, EQUALS, ESC, ESCAPE, EVAL_AND_EXPR, EVAL_BITWISE_EXPR, EVAL_EQUALS_EXPR, EVAL_IDENT, EVAL_NOTEQUALS_EXPR, EVAL_OR_EXPR, EVENT_FILTER_BETWEEN, EVENT_FILTER_EXPR, EVENT_FILTER_IDENT, EVENT_FILTER_IN, EVENT_FILTER_NAME_TAG, EVENT_FILTER_NOT_BETWEEN, EVENT_FILTER_NOT_IN, EVENT_FILTER_NOT_RANGE, EVENT_FILTER_PARAM, EVENT_FILTER_RANGE, EVENT_LIMIT_EXPR, EVENT_PROP_EXPR, EVENT_PROP_INDEXED, EVENT_PROP_MAPPED, EVENT_PROP_SIMPLE, EVENTS, EVERY_EXPR, EXISTS, EXISTS_SUBSELECT_EXPR, EXPONENT, FIRST, FLOAT_SUFFIX, FLOAT_TYPE, FOLLOWED_BY, FOLLOWED_BY_EXPR, FROM, FULL, FULL_OUTERJOIN_EXPR, GE, GROUP, GROUP_BY_EXPR, GT, GUARD_EXPR, HAVING, HAVING_EXPR, HEX_DIGIT, HOUR_PART, IDENT, IN_RANGE, IN_SET, IN_SUBSELECT_EXPR, IN_SUBSELECT_QUERY_EXPR, INC, INSERT, INSERTINTO_EXPR, INSERTINTO_EXPRCOL, INSERTINTO_STREAM_NAME, INT_TYPE, INTO, IS, ISTREAM, JOIN, LAND, LAST, LBRACK, LCURLY, LE, LEFT, LEFT_OUTERJOIN_EXPR, LIB_FUNCTION, LIKE, LITERAL_day, LITERAL_days, LITERAL_false, LITERAL_hour, LITERAL_hours, LITERAL_millisecond, LITERAL_milliseconds, LITERAL_minute, LITERAL_msec, LITERAL_null, LITERAL_sec, LITERAL_second, LITERAL_true, LNOT, LONG_TYPE, LOR, LPAREN, LT, MAX, MEDIAN, MILLISECOND_PART, MIN, MIN_LIMIT_EXPR, MINUS, MINUS_ASSIGN, MINUTE_PART, MINUTES, ML_COMMENT, MOD, MOD_ASSIGN, NOT_BETWEEN, NOT_EQUAL, NOT_EXPR, NOT_IN_RANGE, NOT_IN_SET, NOT_IN_SUBSELECT_EXPR, NOT_LIKE, NOT_REGEXP, NULL_TREE_LOOKAHEAD, NULL_TYPE, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, NUMERIC_PARAM_FREQUENCE, NUMERIC_PARAM_FREQUENCY, NUMERIC_PARAM_LIST, NUMERIC_PARAM_RANGE, OBSERVER_EXPR, ON, OR_EXPR, ORDER, ORDER_BY_EXPR, ORDER_ELEMENT_EXPR, OUTER, OUTERJOIN_EXPR, OUTPUT, PATTERN, PATTERN_INCL_EXPR, PLUS, PLUS_ASSIGN, PREVIOUS, PRIOR, QUESTION, QUOTED_STRING_LITERAL, RBRACK, RCURLY, REGEXP, RIGHT, RIGHT_OUTERJOIN_EXPR, RPAREN, RSTREAM, SEC_LIMIT_EXPR, SECOND_PART, SECONDS, SELECT, SELECTION_ELEMENT_EXPR, SELECTION_EXPR, SEMI, SL, SL_ASSIGN, SL_COMMENT, SQL, SQL_NE, SR, SR_ASSIGN, STAR, STAR_ASSIGN, STDDEV, STREAM_EXPR, STRING_LITERAL, STRING_TYPE, SUBSELECT_EXPR, SUM, THEN, TIME_PERIOD, UNARY_MINUS, VIEW_EXPR, WHEN, WHERE, WHERE_EXPR, WILDCARD_SELECT, WS
 
Constructor Summary
EQLTreeWalker(EngineImportService engineImportService, PatternObjectResolutionService patternObjectResolutionService)
          Ctor.
 
Method Summary
protected  void end()
          End processing of the AST tree, check that expression nodes found their homes.
protected  void endPattern()
          End processing of the AST tree for stand-alone pattern expressions.
 StatementSpecRaw getStatementSpec()
          Returns statement specification.
protected  void leaveNode(antlr.collections.AST node)
          Leave AST node and process it's type and child nodes.
protected  void pushStmtContext()
          Pushes a statement into the stack, creating a new empty statement to fill in.
protected  void setIsPatternWalk(boolean isPatternWalk)
          Set to indicate that we are walking a pattern.
 
Methods inherited from class net.esper.eql.generated.EQLBaseWalker
arithmeticExpr, arrayExpr, atomicExpr, betweenExpr, builtinFunc, caseExpr, constant, databaseJoinExpression, dayPart, evalExprChoice, eventFilterExpr, eventPropertyAtomic, eventPropertyExpr, exprChoice, filterAtom, filterIdentifier, filterParam, filterParamComparator, fromClause, groupByClause, havingClause, hourPart, inExpr, insertIntoExpr, insertIntoExprCol, libFunc, likeExpr, millisecondPart, minutePart, number, numericParameterList, orderByClause, orderByElement, outerJoin, outerJoinIdent, outputLimitExpr, parameter, patternInclusionExpression, patternOp, regExpExpr, relationalExpr, secondPart, selectClause, selectionList, selectionListElement, singleParameter, startEQLExpressionRule, startPatternExpressionRule, streamExpression, subQueryExpr, subSelectExistsExpr, subSelectFilterExpr, subSelectInExpr, subSelectInQueryExpr, subSelectRowExpr, time_period, timePeriodDef, valueExpr, viewExpr, viewListExpr, whereClause
 
Methods inherited from class antlr.TreeParser
getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, panic, reportError, reportError, reportWarning, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EQLTreeWalker

public EQLTreeWalker(EngineImportService engineImportService,
                     PatternObjectResolutionService patternObjectResolutionService)
Ctor.

Parameters:
engineImportService - is required to resolve lib-calls into static methods or configured aggregation functions
patternObjectResolutionService - resolves plug-in pattern object names (guards and observers)
Method Detail

pushStmtContext

protected void pushStmtContext()
                        throws antlr.SemanticException
Pushes a statement into the stack, creating a new empty statement to fill in. The leave node method for subquery statements pops from the stack.

Overrides:
pushStmtContext in class EQLBaseWalker
Throws:
antlr.SemanticException - is a standard parser exception

getStatementSpec

public StatementSpecRaw getStatementSpec()
Returns statement specification.

Returns:
statement spec.

setIsPatternWalk

protected void setIsPatternWalk(boolean isPatternWalk)
Set to indicate that we are walking a pattern.

Overrides:
setIsPatternWalk in class EQLBaseWalker
Parameters:
isPatternWalk - is true if walking a pattern

leaveNode

protected void leaveNode(antlr.collections.AST node)
                  throws ASTWalkException
Leave AST node and process it's type and child nodes.

Overrides:
leaveNode in class EQLBaseWalker
Parameters:
node - is the node to complete
Throws:
ASTWalkException - if the node tree walk operation failed

endPattern

protected void endPattern()
                   throws ASTWalkException
End processing of the AST tree for stand-alone pattern expressions.

Overrides:
endPattern in class EQLBaseWalker
Throws:
ASTWalkException - is the walk failed

end

protected void end()
            throws ASTWalkException
End processing of the AST tree, check that expression nodes found their homes.

Overrides:
end in class EQLBaseWalker
Throws:
ASTWalkException - is the walk failed