Class Input

Direct Known Subclasses:
JavaInput

public abstract class Input extends InputOutput
An input to the formatter.
  • Constructor Details

    • Input

      public Input()
  • Method Details

    • getTokens

      public abstract com.google.common.collect.ImmutableList<? extends Input.Token> getTokens()
      Get the input tokens.
      Returns:
      the input tokens
    • getPositionTokenMap

      public abstract com.google.common.collect.ImmutableRangeMap<Integer,? extends Input.Token> getPositionTokenMap()
      A map from [start, end] position ranges to Input.Tokens.
    • getPositionToColumnMap

      public abstract com.google.common.collect.ImmutableMap<Integer,Integer> getPositionToColumnMap()
    • getText

      public abstract String getText()
    • getkN

      public abstract int getkN()
      Get the number of toks.
      Returns:
      the number of toks, excluding the EOF tok
    • getToken

      public abstract Input.Token getToken(int k)
      Get the Token by index.
      Parameters:
      k - the Tok index
    • toString

      public String toString()
      Overrides:
      toString in class InputOutput
    • getLineNumber

      public abstract int getLineNumber(int inputPosition)
      Converts a character offset in the input to a line number.
    • getColumnNumber

      public abstract int getColumnNumber(int inputPosition)
      Converts a character offset in the input to a 0-based column number.
    • createDiagnostic

      public FormatterDiagnostic createDiagnostic(int inputPosition, String message)
      Construct a diagnostic. Populates the input filename, and converts character offsets to numbers.