@Override
    public Object visitPattern_stream(@NotNull SiddhiQLParser.Pattern_streamContext ctx) {
//    pattern_stream
//    : every_pattern_source_chain within_time?
//    | every_absent_pattern_source_chain within_time?
//    ;

        StateElement stateElement;
        if (ctx.every_pattern_source_chain() != null) {
            stateElement = ((StateElement) visit(ctx.every_pattern_source_chain()));
        } else {
            stateElement = ((StateElement) visit(ctx.absent_pattern_source_chain()));
        }
        TimeConstant within = null;
        if (ctx.within_time() != null) {
            within = (TimeConstant) visit(ctx.within_time());
        }
        StateInputStream stateInputStream = new StateInputStream(StateInputStream.Type.PATTERN, stateElement, within);
        populateQueryContext(stateInputStream, ctx);
        return stateInputStream;
    }
{@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