Package com.google.googlejavaformat
Class Input
java.lang.Object
com.google.googlejavaformat.InputOutput
com.google.googlejavaformat.Input
- Direct Known Subclasses:
JavaInput
An input to the formatter.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceATok("tock") is a token, or a comment, or a newline, or a maximal string of blanks.static interfaceATokenis a language-level token. -
Field Summary
Fields inherited from class com.google.googlejavaformat.InputOutput
EMPTY_RANGE, ranges -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateDiagnostic(int inputPosition, String message) Construct a diagnostic.abstract intgetColumnNumber(int inputPosition) Converts a character offset in the input to a 0-based column number.abstract intgetkN()Get the number of toks.abstract intgetLineNumber(int inputPosition) Converts a character offset in the input to a line number.abstract com.google.common.collect.ImmutableRangeMap<Integer,? extends Input.Token> A map from [start, end] position ranges toInput.Tokens.abstract StringgetText()abstract Input.TokengetToken(int k) Get the Token by index.abstract com.google.common.collect.ImmutableList<? extends Input.Token>Get the input tokens.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
public abstract com.google.common.collect.ImmutableRangeMap<Integer,? extends Input.Token> getPositionTokenMap()A map from [start, end] position ranges toInput.Tokens. -
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:
toStringin 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.
-