@Override public StringBuilder visitDefinition_stream(@NotNull SiddhiQLParser.Definition_streamContext ctx) { StringBuilder streamText = new StringBuilder(" {\"Stream\": "); streamText.append(" [{ \"streamId\":\"").append(ctx.source().stream_id().getText()).append("\" ,"); String stream_Text = excapeCode(tokenStreamRewriter.getTokenStream().getText(ctx.getStart(), ctx.getStop())); streamText.append(" \"stream_Text\":\"").append(stream_Text).append("\" ,"); if (ctx.annotation().isEmpty()) { streamText.append(" \"annoName\": ").append("null").append(" ,"); streamText.append(" \"annoElement\": ").append("null").append(" ,"); } else { for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) { streamText.append(" \"annoName\":\"").append(annotationContext.name().getText()).append("\" ,"); if (annotationContext.annotation_element().isEmpty()) { streamText.append(" \"annoElement\": ").append("null").append(" ,"); } else { for (SiddhiQLParser.Annotation_elementContext elementContext : annotationContext.annotation_element()) { streamText.append(" \"annoElement\":\"").append(elementContext.property_value().getText()).append("\" ,"); } } } } streamText = new StringBuilder(streamText.substring(0, streamText.length() - 1)); streamText.append(" }]}"); return streamText; }
public final Annotation_elementContext annotation_element() throws RecognitionException { Annotation_elementContext _localctx = new Annotation_elementContext(_ctx, getState()); enterRule(_localctx, 60, RULE_annotation_element); try { enterOuterAlt(_localctx, 1); { setState(590); switch ( getInterpreter().adaptivePredict(_input,41,_ctx) ) { case 1: { setState(587); property_name(); setState(588); match(ASSIGN); } break; } setState(592); property_value(); } } catch (RecognitionException re) { _localctx.exception = re; _errHandler.reportError(this, re); _errHandler.recover(this, re); } finally { exitRule(); } return _localctx; }
@Override public StringBuilder visitQuery(@NotNull SiddhiQLParser.QueryContext ctx) { StringBuilder queryText = new StringBuilder(" { \"Query\": [{ "); if (ctx.annotation().isEmpty()) { queryText.append(" \"annotationElement\":\"").append("query").append("\","); } else { queryText.append("\"annotationElement\":\"").append(ctx.annotation().get(0).annotation_element().get(0).property_value().getText()).append("\","); } queryText.append("\"inputStream\":").append(visit(ctx.query_input())).append(","); if (ctx.query_section() != null) { queryText.append("\"selection\":\"").append(ctx.query_section().getText()).append("\","); } queryText.append("\"outputStream\":").append(visit(ctx.query_output())).append(","); String q_Text = excapeCode(tokenStreamRewriter.getTokenStream().getText(ctx.getStart(), ctx.getStop())); queryText.append("\"query_Text\":\"").append(q_Text).append("\","); queryText = new StringBuilder(queryText.substring(0, queryText.length() - 1)); queryText.append(" }]}"); return queryText; }
/** * {@inheritDoc} * <p>The default implementation returns the result of calling * {@link #visitChildren} on {@code ctx}.</p> * * @param ctx */ @Override public Element visitAnnotation_element(@NotNull SiddhiQLParser.Annotation_elementContext ctx) { Element element; if (ctx.property_name() != null) { element = new Element((String) visit(ctx.property_name()), ((StringConstant) visit(ctx.property_value())) .getValue()); } else { element = new Element(null, ((StringConstant) visit(ctx.property_value())).getValue()); } populateQueryContext(element, ctx); return element; }
public Property_valueContext property_value() { return getRuleContext(Property_valueContext.class,0); } public Property_nameContext property_name() {
@Override public StringBuilder visitPlan_annotation(@NotNull SiddhiQLParser.Plan_annotationContext ctx) { StringBuilder annotation = new StringBuilder(" { "); for (SiddhiQLParser.Annotation_elementContext elementContext : ctx.annotation_element()) { annotation.append(" \"plan_annoElement\":\"").append(elementContext.property_value().string_value().getText()).append("\" ,"); } annotation = new StringBuilder(annotation.substring(0, annotation.length() - 1)); annotation.append("}"); return annotation; }
public Property_nameContext property_name() { return getRuleContext(Property_nameContext.class,0); } public Annotation_elementContext(ParserRuleContext parent, int invokingState) {