Interface Node

All Known Subinterfaces:
ChunkerInvokable, HasScope, IsScope
All Known Implementing Classes:
AbstractChunkerInvokable, ChunkerAnnotation, ChunkerArray, ChunkerAssign, ChunkerBinaryExpression, ChunkerClosure, ChunkerDocument, ChunkerEof, ChunkerIdent, ChunkerInvoke, ChunkerJavaClassDecl, ChunkerMethodName, ChunkerNew, ChunkerNewline, ChunkerNum, ChunkerParam, ChunkerStatement, ChunkerString, ChunkerTypedAssign, ChunkerTypeDecl, ChunkerTypeParam, ChunkerTypeParams, ChunkerWhitespace, ScopedNode, SimpleNode

public interface Node
  • Method Details

    • jjtOpen

      void jjtOpen()
      This method is called after the node has been made the current node. It indicates that child nodes can now be added to it.
    • jjtClose

      void jjtClose()
      This method is called after all the child nodes have been added.
    • jjtSetParent

      void jjtSetParent​(Node n)
      This pair of methods are used to inform the node of its parent.
    • jjtGetParent

      Node jjtGetParent()
    • jjtAddChild

      void jjtAddChild​(Node n, int i)
      This method tells the node to add its argument to the node's list of children.
    • jjtInsertChild

      void jjtInsertChild​(Node n, int i)
      This method inserts the specified node at the given index, shifting any existing items to the right.
    • jjtGetChild

      Node jjtGetChild​(int i)
      This method returns a child node. The children are numbered from zero, left to right.
    • jjtGetNumChildren

      int jjtGetNumChildren()
      Return the number of children the node has.
    • getId

      int getId()
    • jjtGetFirstToken

      Token jjtGetFirstToken()
    • jjtSetFirstToken

      void jjtSetFirstToken​(Token token)
    • jjtGetLastToken

      Token jjtGetLastToken()
    • jjtSetLastToken

      void jjtSetLastToken​(Token token)
    • tokens

      default LinkedIterable<Token> tokens​(boolean strict)
    • tokensReversed

      default LinkedIterable<Token> tokensReversed​(boolean strict)
    • addToken

      default void addToken​(Token token)
    • addToken

      void addToken​(Token token, Node anchor)
    • rescope

      default Node rescope​(List<IsScope> scope)
    • setScope

      default void setScope​(List<IsScope> scope)
    • jjtAccept

      Object jjtAccept​(ChunkerVisitor visitor, Object data)
      Accept the visitor.
    • adopt

      void adopt​(Node node)
    • containsIndex

      default boolean containsIndex​(int i)
    • isChildOf

      default boolean isChildOf​(Node best)
    • addJunk

      Token addJunk​(Token junk)
    • toSource

      default String toSource()
    • append

      default void append​(StringBuilder b, Token tok)
    • getEndIndex

      default int getEndIndex()
    • getStartIndex

      default int getStartIndex()
    • getChildren

      List<Node> getChildren()
    • isAutocompleteTerminal

      default boolean isAutocompleteTerminal()
      Overridden manually for nodes who can "have a cursor on them" with respect to autocomplete. If any part of an ast node collects tokens that are "leaf nodes" (i.e. there are cursor positions where your ast node will be the most derived child found), then it is a candidate to be a terminal autocomplete source. When encountering whitespace or . or , we might search left or right for interesting nodes, and those ast nodes who are autocomplete terminal will be preferred over their children. The normal search algorithm is a standard binary tree search, where the next-leftmost|rightmost leaf node is transversed. When an `isAutocompleteTerminal() == true` node is found, however, we stop there to continue searches.
      true for nodes that the visitor in ChunkerCompleter will visit and generate results. This is not needed for always-terminal nodes, like ChunkerNum or ChunkerIdent, but is needed by terminal-nodes-with-children, like ChunkerInvoke or ChunkerNew.
    • isWellFormed

      boolean isWellFormed()
    • addChild

      default void addChild​(Node child)
    • addChild

      default void addChild​(Node child, int index)
    • insertChild

      default void insertChild​(Node child, int index)
    • addScope

      default void addScope​(IsScope scope)
    • addScope

      default void addScope​(List<IsScope> scope)
    • maybeDetach

      default void maybeDetach()
    • removeChild

      void removeChild​(Node node)
    • indexOf

      int indexOf​(Node node)
    • asRange

      default DocumentRange.Builder asRange()
    • containsLines

      default boolean containsLines​(int winStartLine, int winEndLine)
    • contains

      default boolean contains​(Position pos)
    • findToken

      default Token findToken​(PositionOrBuilder requested)
    • distanceTo

      default int distanceTo​(int offset)