mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-22 00:47:28 +01:00
Remove token ID/Key distinction, part 9 of N
This commit is contained in:
1 parent
1717d5befd
commit
10b6eaebb6
3 files changed
+112
-84
No files matched your search
+1
-9
@@ -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
|
||||
|
||||
Reference in new issue
Block a user