Class ACLSLTokenMarker


  • public class ACLSLTokenMarker
    extends Object
    ACL/SL token marker. The original file is written by Slava Pestov (www.gjt.org) and altered to fit ACL/SL.
    Author:
    Chris van Aart - Acklin B.V., the Netherlands & Slava Pestov
    • Field Detail

      • firstToken

        protected ACLToken firstToken
        The first token in the list. This should be used as the return value from markTokens().
      • lastToken

        protected ACLToken lastToken
        The last token in the list. New tokens are added here. This should be set to null before a new line is to be tokenized.
      • lineInfo

        protected ACLSLTokenMarker.LineInfo[] lineInfo
        An array for storing information about lines. It is enlarged and shrunk automatically by the insertLines() and deleteLines() methods.
      • length

        protected int length
        The length of the lineInfo array.
      • lastLine

        protected int lastLine
        The last tokenized line.
      • nextLineRequested

        protected boolean nextLineRequested
        True if the next line should be painted.
    • Constructor Detail

      • ACLSLTokenMarker

        public ACLSLTokenMarker()
      • ACLSLTokenMarker

        public ACLSLTokenMarker​(jade.tools.gui.ACLSLTokenMarker.KeywordMap keywords)
    • Method Detail

      • isNextLineRequested

        public boolean isNextLineRequested()
        Returns true if the next line should be repainted. This will return true after a line has been tokenized that starts a multiline token that continues onto the next line.
        Returns:
        The NextLineRequested value
      • markTokens

        public ACLToken markTokens​(Segment line,
                                   int lineIndex)
      • supportsMultilineTokens

        public boolean supportsMultilineTokens()
        Returns if the token marker supports tokens that span multiple lines. If this is true, the object using this token marker is required to pass all lines in the document to the markTokens() method (in turn).

        The default implementation returns true; it should be overridden to return false on simpler token markers for increased speed.

        Returns:
        Description of the Returned Value
      • insertLines

        public void insertLines​(int index,
                                int lines)
        Informs the token marker that lines have been inserted into the document. This inserts a gap in the lineInfo array.
        Parameters:
        index - The first line number
        lines - The number of lines
      • deleteLines

        public void deleteLines​(int index,
                                int lines)
        Informs the token marker that line have been deleted from the document. This removes the lines in question from the lineInfo array.
        Parameters:
        index - The first line number
        lines - The number of lines
      • markTokensImpl

        public byte markTokensImpl​(byte _token,
                                   Segment line,
                                   int lineIndex)
      • ensureCapacity

        protected void ensureCapacity​(int index)
        Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Creates a new TokenMarker. This DOES NOT create a lineInfo array; an initial call to insertLines() does that. Ensures that the lineInfo array can contain the specified index. This enlarges it if necessary. No action is taken if the array is large enough already.

        It should be unnecessary to call this under normal circumstances; insertLine() should take care of enlarging the line info array automatically.

        Parameters:
        index - Description of Parameter
      • addToken

        protected void addToken​(int length,
                                byte id)
        Adds a token to the token list.
        Parameters:
        length - The length of the token
        id - The id of the token