T
- public final class Located<T> extends Object
Warning: Equality test on located values is just
forwarded to the values themselves; in other words, the actual
positions are ignored when comparing instances of Located
.
Typically, this means one can use located values as keys in a map
in an intermediate AST as if they were not located, but must be wary
of potential duplicate keys at different spots during the parsing
phase.
toString()
is implemented in such a way that
pairs of start/end positions are written in the following
format:
(`start source`[`start offset`, `start line`+`start column offset`].. `end source`[`end offset`, `end line`+`end column offset`])
Modifier and Type | Field and Description |
---|---|
LexBuffer.Position |
end
The end position of the value in the input file
|
LexBuffer.Position |
start
The start position of the value in the input file
|
T |
val
The value whose location is stored in this instance
|
Modifier and Type | Method and Description |
---|---|
static <T> Located<T> |
dummy(T val) |
boolean |
equals(@Nullable Object o) |
int |
hashCode() |
int |
length() |
static <T,U> Located<T> |
like(T val,
Located<U> loc) |
static <T> Located<T> |
of(T val,
LexBuffer.Position start,
LexBuffer.Position end) |
@NonNull String |
toString() |
public final T val
public final LexBuffer.Position start
public final LexBuffer.Position end
public int length()
public static <T> Located<T> of(T val, LexBuffer.Position start, LexBuffer.Position end)
val
- start
- end
- val
wrapped with the given
start
and end
positionspublic static <T> Located<T> dummy(T val)
val
-