类 CommonTreeNodeStream

    • 构造器详细资料

      • CommonTreeNodeStream

        public CommonTreeNodeStream​(java.lang.Object tree)
      • CommonTreeNodeStream

        public CommonTreeNodeStream​(TreeAdaptor adaptor,
                                    java.lang.Object tree)
    • 方法详细资料

      • reset

        public void reset()
        从接口复制的说明: TreeNodeStream
        Reset the tree node stream in such a way that it acts like a freshly constructed stream.
        指定者:
        reset 在接口中 TreeNodeStream
        覆盖:
        reset 在类中 LookaheadStream<java.lang.Object>
      • nextElement

        public java.lang.Object nextElement()
        Pull elements from tree iterator. Track tree level 0..max_level. If nil rooted tree, don't give initial nil and DOWN nor final UP.
        指定者:
        nextElement 在类中 LookaheadStream<java.lang.Object>
        另请参阅:
        LookaheadStream.isEOF(T)
      • isEOF

        public boolean isEOF​(java.lang.Object o)
        指定者:
        isEOF 在类中 LookaheadStream<java.lang.Object>
      • setUniqueNavigationNodes

        public void setUniqueNavigationNodes​(boolean uniqueNavigationNodes)
        从接口复制的说明: TreeNodeStream
        As we flatten the tree, we use Token.UP, Token.DOWN nodes to represent the tree structure. When debugging we need unique nodes so we have to instantiate new ones. When doing normal tree parsing, it's slow and a waste of memory to create unique navigation nodes. Default should be false.
        指定者:
        setUniqueNavigationNodes 在接口中 TreeNodeStream
      • getTreeSource

        public java.lang.Object getTreeSource()
        从接口复制的说明: TreeNodeStream
        Where is this stream pulling nodes from? This is not the name, but the object that provides node objects.
        指定者:
        getTreeSource 在接口中 TreeNodeStream
      • getSourceName

        public java.lang.String getSourceName()
        从接口复制的说明: IntStream
        Where are you getting symbols from? Normally, implementations will pass the buck all the way to the lexer who can ask its input stream for the file name or whatever.
        指定者:
        getSourceName 在接口中 IntStream
      • getTokenStream

        public TokenStream getTokenStream()
        从接口复制的说明: TreeNodeStream
        If the tree associated with this stream was created from a TokenStream, you can specify it here. Used to do rule $text attribute in tree parser. Optional unless you use tree parser rule $text attribute or output=template and rewrite=true options.
        指定者:
        getTokenStream 在接口中 TreeNodeStream
      • setTokenStream

        public void setTokenStream​(TokenStream tokens)
      • setTreeAdaptor

        public void setTreeAdaptor​(TreeAdaptor adaptor)
      • get

        public java.lang.Object get​(int i)
        从接口复制的说明: TreeNodeStream
        Get a tree node at an absolute index i; 0..n-1. If you don't want to buffer up nodes, then this method makes no sense for you.
        指定者:
        get 在接口中 TreeNodeStream
      • LA

        public int LA​(int i)
        从接口复制的说明: IntStream
        Get int at current input pointer + i ahead where i=1 is next int. Negative indexes are allowed. LA(-1) is previous token (token just matched). LA(-i) where i is before first token should yield -1, invalid char / EOF.
        指定者:
        LA 在接口中 IntStream
      • push

        public void push​(int index)
        Make stream jump to a new location, saving old location. Switch back with pop().
      • pop

        public int pop()
        Seek back to previous index saved during last push(int) call. Return top of stack (return index).
      • getKnownPositionElement

        public java.lang.Object getKnownPositionElement​(boolean allowApproximateLocation)
        Returns an element containing position information. If allowApproximateLocation is false, then this method will return the LT(1) element if it contains position information, and otherwise return null. If allowApproximateLocation is true, then this method will return the last known element containing position information.
        指定者:
        getKnownPositionElement 在接口中 PositionTrackingStream<java.lang.Object>
        参数:
        allowApproximateLocation - if false, this method returns null if an element containing exact information about the current position is not available
        另请参阅:
        hasPositionInformation(java.lang.Object)
      • hasPositionInformation

        public boolean hasPositionInformation​(java.lang.Object node)
        从接口复制的说明: PositionTrackingStream
        Determines if the specified element contains concrete position information.
        指定者:
        hasPositionInformation 在接口中 PositionTrackingStream<java.lang.Object>
        参数:
        node - the element to check
        返回:
        true if element contains concrete position information, otherwise false
      • replaceChildren

        public void replaceChildren​(java.lang.Object parent,
                                    int startChildIndex,
                                    int stopChildIndex,
                                    java.lang.Object t)
        从接口复制的说明: TreeNodeStream
        Replace children of parent from index startChildIndex to stopChildIndex with t, which might be a list. Number of children may be different after this call. The stream is notified because it is walking the tree and might need to know you are monkeying with the underlying tree. Also, it might be able to modify the node stream to avoid restreaming for future phases.

        If parent is null, don't do anything; must be at root of overall tree. Can't replace whatever points to the parent externally. Do nothing.

        指定者:
        replaceChildren 在接口中 TreeNodeStream
      • toString

        public java.lang.String toString​(java.lang.Object start,
                                         java.lang.Object stop)
        从接口复制的说明: TreeNodeStream
        Return the text of all nodes from start to stop, inclusive. If the stream does not buffer all the nodes then it can still walk recursively from start until stop. You can always return null or "" too, but users should not access $ruleLabel.text in an action of course in that case.
        指定者:
        toString 在接口中 TreeNodeStream
      • toTokenTypeString

        public java.lang.String toTokenTypeString()
        For debugging; destructive: moves tree iterator to end.