Remove token ID/Key distinction, part 9 of N

This commit is contained in:
Nigel Tao committed 2018-04-15 15:41:48 +10:00
1 parent 1717d5befd
commit 10b6eaebb6
3 files changed
+112 -84

No files matched your search

+1 -9
View File
@@ -54,15 +54,7 @@ func (m *Map) Insert(name string) (ID, error) {
if key > maxKey {
return 0, errors.New("token: too many distinct tokens")
}
flags := Flags(0)
if numeric(name[0]) {
flags |= FlagsLiteral | FlagsNumLiteral
} else if name[0] == '"' {
flags |= FlagsLiteral | FlagsStrLiteral
} else {
flags |= FlagsIdent
}
id := ID(key<<KeyShift) | ID(flags)
id := ID(key << KeyShift)
m.byName[name] = id
m.byKey = append(m.byKey, name)
return id, nil