blynn / nex

Lexer for Go
http://cs.stanford.edu/~blynn/nex/
GNU General Public License v3.0
416 stars 47 forks source link

Fix panic caused by .Line() #28

Closed threez closed 9 years ago

threez commented 9 years ago
panic: runtime error: index out of range
goroutine 1 [running]:
main.Lexer.Error(0x8202be060, 0x82029a240, 0x0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x820232300, ...)
    /lexer.go:2225 +0x492
func (yylex Lexer) Error(e string) {
    fmt.Printf("Line %d, column %d: %s", yylex.Line() + 1,  yylex.Column() + 1, e)
}

In case of lex $end(0)

blynn commented 9 years ago

Thanks!