Skip to content

Commit

Permalink
fix lexer line number (#421)
Browse files Browse the repository at this point in the history
* fix lexer line number

* fix typo
  • Loading branch information
srliao authored Mar 30, 2022
1 parent adc3f75 commit ac6399e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/parse/lex.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (l *lexer) emit(t ItemType) {

// ignore skips over the pending input before this point.
func (l *lexer) ignore() {
l.line += strings.Count(l.input[l.start:l.pos], "\n")
// l.line += strings.Count(l.input[l.start:l.pos], "\n")
l.start = l.pos
l.startLine = l.line
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/parse/lex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func TestLex(t *testing.T) {
// last := "roar"
// stop := false
for n := l.nextItem(); n.typ != itemEOF; n = l.nextItem() {
// log.Println(n)
log.Printf("%v - %v: %v\n", n.line, n.pos, n)
if n.typ == itemError {
t.FailNow()
}
Expand Down

0 comments on commit ac6399e

Please sign in to comment.