Hoist some methods from token.ID to token.Token.

This commit is contained in:
Nigel Tao committed 2017-04-30 13:42:48 +10:00
1 parent a48bbf6d2e
commit 5c934e5599
3 files changed
+19 -15

No files matched your search

+1 -6
View File
@@ -61,11 +61,6 @@ func (m *IDMap) ByKey(k Key) string {
return ""
}
type Token struct {
ID ID
Line uint32
}
func alpha(c byte) bool {
return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z') || (c == '_')
}
@@ -102,7 +97,7 @@ loop:
if c <= ' ' {
if c == '\n' {
if len(tokens) > 0 && tokens[len(tokens)-1].ID.IsImplicitSemicolon() {
if len(tokens) > 0 && tokens[len(tokens)-1].IsImplicitSemicolon() {
tokens = append(tokens, Token{IDSemicolon, line})
}
if line == 1<<32-1 {