public static final class LexBuffer.Position extends Object
line
number in the input where this position occurs, and the
offset of said line in the input. The column number can
be retrieved via column()
.
LexBuffer
uses LexBuffer.Position
to register the positions in
the current input of the last lexeme start and the current position (which
happens to be the last lexeme end when in a semantic action).
LexBuffer
s do not manage line numbers by themselves, only absolute
character offsets, so that updating line
and bol
is
the responsibility of the lexer's semantic actions.
See LexBuffer.newline()
.
Instances of this class are immutable so the lexer must create new ones when updating them, but a parser using this lexer or semantic actions can safely use positions without having to copy them defensively.
LexBuffer.newline()
,
LexBuffer.getLexemeStart()
,
LexBuffer.getLexemeEnd()
Modifier and Type | Field and Description |
---|---|
int |
bol
The offset of the beginning of the line of this position
|
String |
filename
The filename that this position relates to, or a
description of the input if not a regular file
|
int |
line
The line of this position, starting at 1
|
int |
offset
The character offset of this position, starting at 0
|
public final String filename
public final int offset
public final int line
public final int bol