]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: set lexer nlsemi state directly
authorRobert Griesemer <gri@golang.org>
Sat, 20 Feb 2016 20:53:34 +0000 (12:53 -0800)
committerRobert Griesemer <gri@golang.org>
Sun, 21 Feb 2016 05:13:58 +0000 (05:13 +0000)
commitaa5b44aeabccd25a320d6ea609c41781bdbf5ce0
tree6e7a0c765a6128d304a123b9c322fcee8baa594a
parent20ee67acc920807d19d336b1cc1614d2ad529953
cmd/compile: set lexer nlsemi state directly

The old code used an extra function call and switch to inspect the
current token and determine the new state of curio.nlsemi. However,
the lexer knows the token w/o the need of an extra test and thus
can set curio.nlsemi directly:

- removed need for extra function call in next
- renamed _yylex to next
- set nlsemi at the point a token is identified
- moved nlsemi from curio to lexer - it's really part of the lexer state

This change makes the lexer call sequence less convoluted and should
also speed up the lexing a bit.

Change-Id: Iaf2683081f04231cb62c94e1400d455f98f6f82a
Reviewed-on: https://go-review.googlesource.com/19765
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/lex.go