Class Input

  • Direct Known Subclasses:
    JavaInput

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

      • Input

        public Input()
    • Method Detail

      • 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<java.lang.Integer,​? extends Input.Token> getPositionTokenMap()
        A map from [start, end] position ranges to Input.Tokens.
      • getPositionToColumnMap

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

        public abstract java.lang.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
      • 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,
                                                    java.lang.String message)
        Construct a diagnostic. Populates the input filename, and converts character offsets to numbers.