diff --git a/README.md b/README.md index 8290a20..0721bcc 100644 --- a/README.md +++ b/README.md @@ -1359,6 +1359,10 @@ To run all test and all benchmarks: $ go test -bench . ./... +To test with race detection: + + $ go test -race ./... + ## References diff --git a/lexer/lexer.go b/lexer/lexer.go index 31cda74..48899f8 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -131,16 +131,6 @@ func (l *Lexer) NextToken() Token { return result } -// Pos returns the current byte position. -func (l *Lexer) Pos() int { - return l.pos -} - -// Line returns the current line number. -func (l *Lexer) Line() int { - return l.line -} - // run starts lexical analysis func (l *Lexer) run() { for l.nextFunc = lexContent; l.nextFunc != nil; { diff --git a/parser/parser.go b/parser/parser.go index 867719e..22eed3c 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -104,7 +104,7 @@ func errExpected(expect lexer.TokenKind, tok *lexer.Token) { // program : statement* func (p *parser) parseProgram() *ast.Program { - result := ast.NewProgram(p.lex.Pos(), p.lex.Line()) + result := ast.NewProgram(p.next().Pos, p.next().Line) for p.isStatement() { result.AddStatement(p.parseStatement()) @@ -368,7 +368,7 @@ func (p *parser) parseInverseChain() *ast.Program { return p.parseInverseAndProgram() } - result := ast.NewProgram(p.lex.Pos(), p.lex.Line()) + result := ast.NewProgram(p.next().Pos, p.next().Line) // openInverseChain block, blockParams := p.parseOpenBlock()