Package sc.parser

Class ParseNode

    • Field Detail

      • value

        public java.lang.Object value
      • semanticValue

        public java.lang.Object semanticValue
    • Constructor Detail

      • ParseNode

        public ParseNode()
      • ParseNode

        public ParseNode​(Parselet p)
    • Method Detail

      • getSemanticValue

        public java.lang.Object getSemanticValue()
      • setSemanticValue

        public void setSemanticValue​(java.lang.Object val,
                                     boolean clearOld,
                                     boolean restore)
      • toString

        public java.lang.String toString()
        Specified by:
        toString in interface java.lang.CharSequence
        Overrides:
        toString in class java.lang.Object
      • toDebugString

        public java.lang.String toDebugString()
      • refersToSemanticValue

        public boolean refersToSemanticValue​(java.lang.Object v)
      • reformat

        public IParseNode reformat()
        Description copied from interface: IParseNode
        Reformats the parse node - replacing any explicit spacing nodes with the generateParseNode in the tree. The next toString will then reformat the parse nodes
        Specified by:
        reformat in interface IParseNode
        Overrides:
        reformat in class AbstractParseNode
      • firstChar

        public int firstChar()
        Description copied from interface: IParseNode
        Returns the first character value produced or -1 if there is none
      • length

        public int length()
        Description copied from interface: IParseNode
        Returns the number of characters in the parse node
        Specified by:
        length in interface java.lang.CharSequence
        Specified by:
        length in interface IParseNode
        Overrides:
        length in class AbstractParseNode
      • subSequence

        public java.lang.CharSequence subSequence​(int start,
                                                  int end)
        Specified by:
        subSequence in interface java.lang.CharSequence
        Overrides:
        subSequence in class AbstractParseNode
      • charAt

        public char charAt​(int ix)
        Specified by:
        charAt in interface java.lang.CharSequence
        Overrides:
        charAt in class AbstractParseNode
      • styleNode

        public void styleNode​(IStyleAdapter adapter,
                              java.lang.Object parSemVal,
                              ParentParseNode parentParseNode,
                              int childIx)
        Description copied from interface: IParseNode
        Just like formatString, we need to take an optional parent semantic value, parseNode, and childIndex so we know where this element falls in the context so we can do spacing properly
        Specified by:
        styleNode in interface IParseNode
        Overrides:
        styleNode in class AbstractParseNode
      • updateSemanticValue

        public void updateSemanticValue​(java.util.IdentityHashMap<java.lang.Object,​java.lang.Object> oldNewMap)
      • computeLineNumberForNode

        public void computeLineNumberForNode​(LineFormatContext ctx,
                                             IParseNode toFindPN)
        Description copied from interface: IParseNode
        Internal method used to walk the parse tree to find the line number for a given parse node (which must be in the tree).
      • findParseNode

        public IParseNode findParseNode​(int startIndex,
                                        Parselet matchParselet,
                                        boolean overlap)
        Description copied from interface: IParseNode
        Find the parse node at the specified start index. If matchParselet is not null the match is only returned if it is the same as the parselet specified
        Specified by:
        findParseNode in interface IParseNode
        Overrides:
        findParseNode in class AbstractParseNode
      • resetStartIndex

        public int resetStartIndex​(int ix,
                                   boolean validate,
                                   boolean updateNewIndex)
        Description copied from interface: IParseNode
        After updating some parse nodes, you may need to reset the start indexes. This sets the start index to the one given and returns the start index to continue after this parse node.
        Specified by:
        resetStartIndex in interface IParseNode
        Overrides:
        resetStartIndex in class AbstractParseNode
      • findStartDiff

        public void findStartDiff​(DiffContext ctx,
                                  boolean atEnd,
                                  java.lang.Object parSemVal,
                                  ParentParseNode parParseNode,
                                  int childIx)
        Description copied from interface: IParseNode
        Finds the first parse node whose text does not match the DiffContext
      • findEndDiff

        public void findEndDiff​(DiffContext ctx,
                                java.lang.Object parSemVal,
                                ParentParseNode parParseNode,
                                int childIx)
      • isGeneratedTree

        public boolean isGeneratedTree()
        Description copied from interface: IParseNode
        Returns true if any nodes in this tree have been through the 'generate' process. These nodes might have formatting parse nodes that need to be replaced for some operations
      • addParseErrors

        public void addParseErrors​(java.util.List<ParseError> errors,
                                   int max)
        Description copied from interface: IParseNode
        For incremental parses, return the list of errors detected and continued in the parse-stream (useful for syntax highlighting)