1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
|
package js
// generated by hasher -file hash.go -type Hash; DO NOT EDIT, except for adding more constants to the list and rerun go generate
// uses github.com/tdewolff/hasher
//go:generate hasher -type=Hash -file=hash.go
// Hash defines perfect hashes for a predefined list of strings
type Hash uint32
// Unique hash definitions to be used instead of strings
const (
Break Hash = 0x5 // break
Case Hash = 0x3404 // case
Catch Hash = 0xba05 // catch
Class Hash = 0x505 // class
Const Hash = 0x2c05 // const
Continue Hash = 0x3e08 // continue
Debugger Hash = 0x8408 // debugger
Default Hash = 0xab07 // default
Delete Hash = 0xcd06 // delete
Do Hash = 0x4c02 // do
Else Hash = 0x3704 // else
Enum Hash = 0x3a04 // enum
Export Hash = 0x1806 // export
Extends Hash = 0x4507 // extends
False Hash = 0x5a05 // false
Finally Hash = 0x7a07 // finally
For Hash = 0xc403 // for
Function Hash = 0x4e08 // function
If Hash = 0x5902 // if
Implements Hash = 0x5f0a // implements
Import Hash = 0x6906 // import
In Hash = 0x4202 // in
Instanceof Hash = 0x710a // instanceof
Interface Hash = 0x8c09 // interface
Let Hash = 0xcf03 // let
New Hash = 0x1203 // new
Null Hash = 0x5504 // null
Package Hash = 0x9507 // package
Private Hash = 0x9c07 // private
Protected Hash = 0xa309 // protected
Public Hash = 0xb506 // public
Return Hash = 0xd06 // return
Static Hash = 0x2f06 // static
Super Hash = 0x905 // super
Switch Hash = 0x2606 // switch
This Hash = 0x2304 // this
Throw Hash = 0x1d05 // throw
True Hash = 0xb104 // true
Try Hash = 0x6e03 // try
Typeof Hash = 0xbf06 // typeof
Var Hash = 0xc703 // var
Void Hash = 0xca04 // void
While Hash = 0x1405 // while
With Hash = 0x2104 // with
Yield Hash = 0x8005 // yield
)
// String returns the hash' name.
func (i Hash) String() string {
start := uint32(i >> 8)
n := uint32(i & 0xff)
if start+n > uint32(len(_Hash_text)) {
return ""
}
return _Hash_text[start : start+n]
}
// ToHash returns the hash whose name is s. It returns zero if there is no
// such hash. It is case sensitive.
func ToHash(s []byte) Hash {
if len(s) == 0 || len(s) > _Hash_maxLen {
return 0
}
h := uint32(_Hash_hash0)
for i := 0; i < len(s); i++ {
h ^= uint32(s[i])
h *= 16777619
}
if i := _Hash_table[h&uint32(len(_Hash_table)-1)]; int(i&0xff) == len(s) {
t := _Hash_text[i>>8 : i>>8+i&0xff]
for i := 0; i < len(s); i++ {
if t[i] != s[i] {
goto NEXT
}
}
return i
}
NEXT:
if i := _Hash_table[(h>>16)&uint32(len(_Hash_table)-1)]; int(i&0xff) == len(s) {
t := _Hash_text[i>>8 : i>>8+i&0xff]
for i := 0; i < len(s); i++ {
if t[i] != s[i] {
return 0
}
}
return i
}
return 0
}
const _Hash_hash0 = 0x9acb0442
const _Hash_maxLen = 10
const _Hash_text = "breakclassupereturnewhilexporthrowithiswitchconstaticaselsen" +
"umcontinuextendsdofunctionullifalseimplementsimportryinstanc" +
"eofinallyieldebuggerinterfacepackageprivateprotectedefaultru" +
"epublicatchtypeoforvarvoidelete"
var _Hash_table = [1 << 6]Hash{
0x0: 0x2f06, // static
0x1: 0x9c07, // private
0x3: 0xb104, // true
0x6: 0x5a05, // false
0x7: 0x4c02, // do
0x9: 0x2c05, // const
0xa: 0x2606, // switch
0xb: 0x6e03, // try
0xc: 0x1203, // new
0xd: 0x4202, // in
0xf: 0x8005, // yield
0x10: 0x5f0a, // implements
0x11: 0xc403, // for
0x12: 0x505, // class
0x13: 0x3a04, // enum
0x16: 0xc703, // var
0x17: 0x5902, // if
0x19: 0xcf03, // let
0x1a: 0x9507, // package
0x1b: 0xca04, // void
0x1c: 0xcd06, // delete
0x1f: 0x5504, // null
0x20: 0x1806, // export
0x21: 0xd06, // return
0x23: 0x4507, // extends
0x25: 0x2304, // this
0x26: 0x905, // super
0x27: 0x1405, // while
0x29: 0x5, // break
0x2b: 0x3e08, // continue
0x2e: 0x3404, // case
0x2f: 0xab07, // default
0x31: 0x8408, // debugger
0x32: 0x1d05, // throw
0x33: 0xbf06, // typeof
0x34: 0x2104, // with
0x35: 0xba05, // catch
0x36: 0x4e08, // function
0x37: 0x710a, // instanceof
0x38: 0xa309, // protected
0x39: 0x8c09, // interface
0x3b: 0xb506, // public
0x3c: 0x3704, // else
0x3d: 0x7a07, // finally
0x3f: 0x6906, // import
}
|