private static ExpressionExecutor constructEventExpressionExecutor(Variable variable, int currentState, SiddhiQueryContext siddhiQueryContext, int[] eventPosition, MetaStateEvent metaStateEvent) {
        AbstractDefinition definition;
        MetaStreamEvent[] metaStreamEvents = metaStateEvent.getMetaStreamEvents();
        for (int i = 0, metaStreamEventsLength = metaStreamEvents.length; i < metaStreamEventsLength; i++) {
            MetaStreamEvent metaStreamEvent = metaStreamEvents[i];
            definition = metaStreamEvent.getLastInputDefinition();
            if (metaStreamEvent.getInputReferenceId() == null) {
                if (definition.getId().equals(variable.getAttributeName())) {
                    eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX] = i;
                    FunctionExecutor functionExecutor = new EventVariableFunctionExecutor(
                            eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX],
                            eventPosition[SiddhiConstants.STREAM_EVENT_INDEX_IN_CHAIN]);
                    functionExecutor.initExecutor(new ExpressionExecutor[0], ProcessingMode.BATCH,
                            null, false, siddhiQueryContext);
                    return functionExecutor;
                }
            } else {
                if (metaStreamEvent.getInputReferenceId().equals(variable.getAttributeName())) {
                    eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX] = i;
                    if (currentState > -1 && metaStreamEvents[currentState].getInputReferenceId() != null
                            && variable.getStreamIndex() != null
                            && variable.getStreamIndex() <= SiddhiConstants.LAST) {
                        if (variable.getAttributeName()
                                .equals(metaStreamEvents[currentState].getInputReferenceId())) {
                            eventPosition[SiddhiConstants.STREAM_EVENT_INDEX_IN_CHAIN] =
                                    variable.getStreamIndex();
                        }
                    }
                    FunctionExecutor functionExecutor = new EventVariableFunctionExecutor(
                            eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX],
                            eventPosition[SiddhiConstants.STREAM_EVENT_INDEX_IN_CHAIN]);
                    functionExecutor.initExecutor(new ExpressionExecutor[0], ProcessingMode.BATCH,
                            null, false, siddhiQueryContext);
                    return functionExecutor;
                }
            }
        }
        return null;
    }
Parse and validate the given Siddhi variable and return a VariableExpressionExecutor

@param variable           Variable to be parsed
@param metaEvent          Meta event used to collect execution info of stream associated with query
@param currentState       Current State Number
@param executorList       List to hold VariableExpressionExecutors to update after query parsing @return
@param siddhiQueryContext Siddhi Query Context
@return VariableExpressionExecutor representing given variable
modules/siddhi-core/src/main/java/io/siddhi/core/util/parser/ExpressionParser.java