Source source = (Source) visit(ctx.source()); if (source.isInnerStream) { throw newSiddhiParserException(ctx, " InnerStreams cannot be defined!"); StreamDefinition streamDefinition = StreamDefinition.id(source.streamId); populateQueryContext(streamDefinition, ctx); List<SiddhiQLParser.Attribute_nameContext> attribute_names = ctx.attribute_name(); List<SiddhiQLParser.Attribute_typeContext> attribute_types = ctx.attribute_type(); for (int i = 0; i < attribute_names.size(); i++) { SiddhiQLParser.Attribute_nameContext attributeNameContext = attribute_names.get(i); for (SiddhiQLParser.AnnotationContext annotationContext : ctx.annotation()) { streamDefinition.annotation((Annotation) visit(annotationContext));
public final Definition_streamContext definition_stream() throws RecognitionException { Definition_streamContext _localctx = new Definition_streamContext(_ctx, getState()); enterRule(_localctx, 10, RULE_definition_stream); int _la;
@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 TerminalNode DEFINE() { return getToken(SiddhiQLParser.DEFINE, 0); } public Attribute_typeContext attribute_type(int i) {
public List<Attribute_nameContext> attribute_name() { return getRuleContexts(Attribute_nameContext.class); } public Definition_streamContext(ParserRuleContext parent, int invokingState) {
public Attribute_typeContext attribute_type(int i) { return getRuleContext(Attribute_typeContext.class,i); } public List<Attribute_typeContext> attribute_type() {
public List<AnnotationContext> annotation() { return getRuleContexts(AnnotationContext.class); } public TerminalNode DEFINE() { return getToken(SiddhiQLParser.DEFINE, 0); }
public SourceContext source() { return getRuleContext(SourceContext.class,0); } public List<AnnotationContext> annotation() {
public TerminalNode STREAM() { return getToken(SiddhiQLParser.STREAM, 0); } public Attribute_nameContext attribute_name(int i) {
public Attribute_nameContext attribute_name(int i) { return getRuleContext(Attribute_nameContext.class,i); } public List<Attribute_nameContext> attribute_name() {
public AnnotationContext annotation(int i) { return getRuleContext(AnnotationContext.class,i); } public TerminalNode STREAM() { return getToken(SiddhiQLParser.STREAM, 0); }
public List<Attribute_typeContext> attribute_type() { return getRuleContexts(Attribute_typeContext.class); } public AnnotationContext annotation(int i) {