Class Token
java.lang.Object
com.iizix.prop.gunit.internal.Token
One token of a unit formula, carrying its span in the original, untouched source string.
The offsets are the whole point of the class. Nothing is substituted into the source before scanning, so start and end index the exact characters the author typed, and an error can be shown under the right caret position even in a formula containing multi-character units such as dlg.
- Author:
- Christopher Mindus
Field Summary
FieldsConstructor Summary
ConstructorsMethod Summary
Field Details
kind
The kind of token.start
public final int startThe inclusive start offset in the original source string.end
public final int endThe exclusive end offset in the original source string, so that the length isend-start.text
The exact source text of the token, as written, i.e. NOT case folded. Empty forTokenKind.EOF.
Constructor Details
Token
Method Details
getLength
public int getLength()Gets the length of the token in characters.- Returns:
- The length, zero for
TokenKind.EOF.
toString