java.lang.Object
com.google.googlejavaformat.InputOutput
com.google.googlejavaformat.Input
- Direct Known Subclasses:
JavaInput
public abstract class Input extends InputOutput
An input to the formatter.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Input.Tok
ATok
("tock") is a token, or a comment, or a newline, or a maximal string of blanks.static interface
Input.Token
AToken
is a language-level token. -
Field Summary
-
Constructor Summary
Constructors Constructor Description Input()
-
Method Summary
Modifier and Type Method Description FormatterDiagnostic
createDiagnostic(int inputPosition, String message)
Construct a diagnostic.abstract int
getColumnNumber(int inputPosition)
Converts a character offset in the input to a 0-based column number.abstract int
getkN()
Get the number of toks.abstract int
getLineNumber(int inputPosition)
Converts a character offset in the input to a line number.abstract ImmutableMap<Integer,Integer>
getPositionToColumnMap()
abstract ImmutableRangeMap<Integer,? extends Input.Token>
getPositionTokenMap()
A map from [start, end] position ranges toInput.Token
s.abstract String
getText()
abstract Input.Token
getToken(int k)
Get the Token by index.abstract ImmutableList<? extends Input.Token>
getTokens()
Get the input tokens.String
toString()
Methods inherited from class com.google.googlejavaformat.InputOutput
computeRanges, getLine, getLineCount, getRanges, makeKToIJ, setLines
-
Constructor Details
-
Input
public Input()
-
-
Method Details
-
getTokens
Get the input tokens.- Returns:
- the input tokens
-
getPositionTokenMap
A map from [start, end] position ranges toInput.Token
s. -
getPositionToColumnMap
-
getText
-
getkN
public abstract int getkN()Get the number of toks.- Returns:
- the number of toks, excluding the EOF tok
-
getToken
Get the Token by index.- Parameters:
k
- the Tok index
-
toString
- Overrides:
toString
in classInputOutput
-
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
Construct a diagnostic. Populates the input filename, and converts character offsets to numbers.
-