@Override
    public StateElement visitSequence_source_chain(@NotNull SiddhiQLParser.Sequence_source_chainContext ctx) {
//        sequence_source_chain
//        :'('sequence_source_chain ')' 
//        | sequence_source_chain ',' sequence_source_chain
//        | sequence_source  
//        ;

        if (ctx.sequence_source_chain().size() == 1) {
            StateElement stateElement = ((StateElement) visit(ctx.sequence_source_chain(0)));
            populateQueryContext(stateElement, ctx);
            return stateElement;
        } else if (ctx.sequence_source_chain().size() == 2) {
            NextStateElement nextStateElement = new NextStateElement(((StateElement)
                    visit(ctx.sequence_source_chain(0))), ((StateElement) visit(ctx.sequence_source_chain(1))));
            populateQueryContext(nextStateElement, ctx);
            return nextStateElement;
        } else if (ctx.sequence_source() != null) {
            StateElement stateElement = ((StateElement) visit(ctx.sequence_source()));
            populateQueryContext(stateElement, ctx);
            return stateElement;
        } else {
            throw newSiddhiParserException(ctx);
        }
    }
{@inheritDoc}
<p>The default implementation returns the result of calling
{@link #visitChildren} on {@code ctx}.</p>

@param ctx
modules/siddhi-query-compiler/src/main/java/io/siddhi/query/compiler/internal/SiddhiQLBaseVisitorImpl.java