Klasse PublicScanner

java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.util.PublicScanner
Alle implementierten Schnittstellen:
IScanner, ITerminalSymbols

public class PublicScanner extends Object implements IScanner, ITerminalSymbols
This class acts as a facade to the internal Scanner implementation and delegates all the work to the internal Scanner instance.

Note for maintainers No additional logic should be added here except adopting NON-API constants returned by getNextToken() from TerminalTokens to ITerminalSymbols.

  • Konstruktordetails

    • PublicScanner

      public PublicScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, boolean isPreviewEnabled, boolean recordLineSeparator)
  • Methodendetails

    • createScanner

      protected Scanner createScanner(boolean tokenizeComments, boolean tokenizeWhiteSpace, boolean checkNonExternalizedStringLiterals, long sourceLevel, long complianceLevel, char[][] taskTags, char[][] taskPriorities, boolean isTaskCaseSensitive, boolean isPreviewEnabled)
    • getCurrentTokenEndPosition

      public int getCurrentTokenEndPosition()
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers the ending position of the current token inside the original source. This position is zero-based and inclusive. It corresponds to the position of the last character which is part of this token. If this character was a unicode escape sequence, it points at the last character of this sequence.
      Angegeben von:
      getCurrentTokenEndPosition in Schnittstelle IScanner
      Gibt zurück:
      the ending position of the current token inside the original source
    • getCurrentTokenSource

      public char[] getCurrentTokenSource()
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers the current identifier source, after unicode escape sequences have been translated into unicode characters. For example, if original source was \\u0061bc then it will answer abc.
      Angegeben von:
      getCurrentTokenSource in Schnittstelle IScanner
      Gibt zurück:
      the current identifier source, after unicode escape sequences have been translated into unicode characters
    • getRawTokenSource

      public final char[] getRawTokenSource()
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers the current identifier source, before unicode escape sequences have been translated into unicode characters. For example, if original source was \\u0061bc then it will answer \\u0061bc.
      Angegeben von:
      getRawTokenSource in Schnittstelle IScanner
      Gibt zurück:
      the current identifier source, before unicode escape sequences have been translated into unicode characters
    • getCurrentTokenStartPosition

      public int getCurrentTokenStartPosition()
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers the starting position of the current token inside the original source. This position is zero-based and inclusive. It corresponds to the position of the first character which is part of this token. If this character was a unicode escape sequence, it points at the first character of this sequence.
      Angegeben von:
      getCurrentTokenStartPosition in Schnittstelle IScanner
      Gibt zurück:
      the starting position of the current token inside the original source
    • getLineEnd

      public final int getLineEnd(int lineNumber)
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers the ending position of a given line number. This line has to have been encountered already in the tokenization process (in other words, it cannot be used to compute positions of lines beyond current token). Once the entire source has been processed, it can be used without any limit. Line ending positions are zero-based, and correspond to the last character of the line separator (in case multi-character line separators).
      Angegeben von:
      getLineEnd in Schnittstelle IScanner
      Parameter:
      lineNumber - the given line number
      Gibt zurück:
      the ending position of a given line number
    • getLineEnds

      public final int[] getLineEnds()
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers an array of the ending positions of the lines encountered so far. Line ending positions are zero-based, and correspond to the last character of the line separator (in case multi-character line separators).
      Angegeben von:
      getLineEnds in Schnittstelle IScanner
      Gibt zurück:
      an array of the ending positions of the lines encountered so far
    • getLineStart

      public final int getLineStart(int lineNumber)
      Search the source position corresponding to the beginning of a given line number Line numbers are 1-based, and relative to the scanner initialPosition. Character positions are 0-based. e.g. getLineStart(1) --> 0 indicates that the first line starts at character 0. In case the given line number is inconsistent, answers -1.
      Angegeben von:
      getLineStart in Schnittstelle IScanner
      Parameter:
      lineNumber - int
      Gibt zurück:
      int
    • getNextToken

      public int getNextToken() throws InvalidInputException
      Beschreibung aus Schnittstelle kopiert: IScanner
      Read the next token in the source, and answers its ID as specified by ITerminalSymbols. Note that the actual token ID values are subject to change if new keywords were added to the language (for instance, 'assert' is a keyword in 1.4).
      Angegeben von:
      getNextToken in Schnittstelle IScanner
      Gibt zurück:
      the next token
      Löst aus:
      InvalidInputException - in case a lexical error was detected while reading the current token
    • getSource

      public char[] getSource()
      Beschreibung aus Schnittstelle kopiert: IScanner
      Answers the original source being processed (not a copy of it).
      Angegeben von:
      getSource in Schnittstelle IScanner
      Gibt zurück:
      the original source being processed
    • resetTo

      public void resetTo(int begin, int end)
      Reposition the scanner on some portion of the original source. The given endPosition is the last valid position. Beyond this position, the scanner will answer EOF tokens (ITerminalSymbols.TokenNameEOF).
      Angegeben von:
      resetTo in Schnittstelle IScanner
      Parameter:
      begin - the given start position
      end - the given end position
    • getLineNumber

      public final int getLineNumber(int position)
      Search the line number corresponding to a specific position
      Angegeben von:
      getLineNumber in Schnittstelle IScanner
      Parameter:
      position - int
      Gibt zurück:
      int
    • setSource

      public final void setSource(char[] sourceString)
      Beschreibung aus Schnittstelle kopiert: IScanner
      Set the scanner source to process. By default, the scanner will consider starting at the beginning of the source until it reaches its end. If the given source is null, this clears the source.
      Angegeben von:
      setSource in Schnittstelle IScanner
      Parameter:
      sourceString - the given source
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object