Skip to content

Commit

Permalink
removes data races (fixes aymerick#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
aymerick committed Jun 1, 2016
1 parent 8a07897 commit 06a192e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1359,6 +1359,10 @@ To run all test and all benchmarks:

$ go test -bench . ./...

To test with race detection:

$ go test -race ./...


## References

Expand Down
10 changes: 0 additions & 10 deletions lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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; {
Expand Down
4 changes: 2 additions & 2 deletions parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 06a192e

Please sign in to comment.