Class BaseToken

  • All Implemented Interfaces:
    java.lang.Comparable<BaseToken>
    Direct Known Subclasses:
    Token

    public class BaseToken
    extends java.lang.Object
    implements java.lang.Comparable<BaseToken>
    A supertype for our generated token class. This is cleaner than us maintaining a complete copy of Token
    • Field Detail

      • startIndex

        public int startIndex
      • endIndex

        public int endIndex
      • tokenBegin

        public int tokenBegin
      • detached

        public boolean detached
    • Constructor Detail

      • BaseToken

        public BaseToken()
    • Method Detail

      • addBackLinks

        public Token addBackLinks()
      • addBackLinks

        public Token addBackLinks​(Token until)
      • prev

        public Token prev()
      • compareTo

        public int compareTo​(BaseToken o)
        Specified by:
        compareTo in interface java.lang.Comparable<BaseToken>
      • containsIndex

        public boolean containsIndex​(int desired)
      • getEndIndex

        public int getEndIndex()
      • getStartIndex

        public int getStartIndex()
      • specialTokenLength

        public int specialTokenLength()
      • copyToken

        public void copyToken​(Token token)
      • next

        public Token next()
      • special

        public Token special()
      • getNextNonWhitespace

        public Token getNextNonWhitespace()
      • dump

        public java.lang.String dump()
      • positionStart

        public io.deephaven.proto.backplane.script.grpc.Position.Builder positionStart()
        Converts our 1-indexed javacc start token to a 0-indexed LSP Position
      • positionEnd

        public io.deephaven.proto.backplane.script.grpc.Position.Builder positionEnd()
        Converts our 1-indexed javacc end token to a 0-indexed LSP Position. Does not consider javacc's weird EOF handling specially; the final end position will land outside the document's actual range, which is perfectly acceptable to Monaco when telling it what chars to replace (it's actually required when the cursor is at the end of the document; a common occurrence).
      • positionEnd

        public io.deephaven.proto.backplane.script.grpc.Position.Builder positionEnd​(boolean considerEof)
        Converts our 1-indexed javacc end token to a 0-indexed LSP Position.
        Parameters:
        considerEof - Whether or not to normalize javacc's weird EOF token handling. Normally false, which allows the position to exceed the document's size. This is acceptable to Monaco. EOF is only considered during internal operations when we are looking up tokens from cursor positions (and can likely be refactored / deleted when we stop using absolute cursor positions).
        Returns:
        A 0-indexed Position describing the end of this token.
      • toReverse

        public io.deephaven.web.shared.fu.MappedIterable<Token> toReverse​(Token end)
        Returns an iterable which runs backwards from this token. If you specify an end token, the iterator will include that token and stop. If an end token is not specified, the iterable will run backwards until the start token.
        Parameters:
        end - optional end token, if specified, will be the last token returned by iterator.
      • to

        public io.deephaven.web.shared.fu.MappedIterable<Token> to​(Token end)
      • containsPosition

        public boolean containsPosition​(io.deephaven.proto.backplane.script.grpc.PositionOrBuilder pos)
      • contains

        public boolean contains​(io.deephaven.proto.backplane.script.grpc.DocumentRangeOrBuilder replaceRange)