lexer: add Step()/NewLine()/Reset() methods to TokenPosition
Signed-off-by: Alejandro Mery <amery@jpi.io>
This commit is contained in:
@@ -23,6 +23,20 @@ type TokenPosition struct {
|
||||
Row int
|
||||
}
|
||||
|
||||
func (pos *TokenPosition) Reset() {
|
||||
pos.Line = 1
|
||||
pos.Row = 1
|
||||
}
|
||||
|
||||
func (pos *TokenPosition) Step(n int) {
|
||||
pos.Row += n
|
||||
}
|
||||
|
||||
func (pos *TokenPosition) NewLine() {
|
||||
pos.Line += 1
|
||||
pos.Row = 1
|
||||
}
|
||||
|
||||
// Token
|
||||
type Token interface {
|
||||
Type() TokenType
|
||||
|
||||
Reference in New Issue
Block a user