...
Source file src/pkg/cmd/compile/internal/syntax/tokens.go
1
2
3
4
5 package syntax
6
7 type token uint
8
9
10
11 const (
12 _ token = iota
13 _EOF
14
15
16 _Name
17 _Literal
18
19
20
21 _Operator
22 _AssignOp
23 _IncOp
24 _Assign
25 _Define
26 _Arrow
27 _Star
28
29
30 _Lparen
31 _Lbrack
32 _Lbrace
33 _Rparen
34 _Rbrack
35 _Rbrace
36 _Comma
37 _Semi
38 _Colon
39 _Dot
40 _DotDotDot
41
42
43 _Break
44 _Case
45 _Chan
46 _Const
47 _Continue
48 _Default
49 _Defer
50 _Else
51 _Fallthrough
52 _For
53 _Func
54 _Go
55 _Goto
56 _If
57 _Import
58 _Interface
59 _Map
60 _Package
61 _Range
62 _Return
63 _Select
64 _Struct
65 _Switch
66 _Type
67 _Var
68
69
70 tokenCount
71 )
72
73 const (
74
75 Break = _Break
76 Continue = _Continue
77 Fallthrough = _Fallthrough
78 Goto = _Goto
79
80
81 Go = _Go
82 Defer = _Defer
83 )
84
85
86 const _ uint64 = 1 << (tokenCount - 1)
87
88
89 func contains(tokset uint64, tok token) bool {
90 return tokset&(1<<tok) != 0
91 }
92
93 type LitKind uint
94
95
96
97
98 const (
99 IntLit LitKind = iota
100 FloatLit
101 ImagLit
102 RuneLit
103 StringLit
104 )
105
106 type Operator uint
107
108
109
110 const (
111 _ Operator = iota
112
113
114 Def
115 Not
116 Recv
117
118
119 OrOr
120
121
122 AndAnd
123
124
125 Eql
126 Neq
127 Lss
128 Leq
129 Gtr
130 Geq
131
132
133 Add
134 Sub
135 Or
136 Xor
137
138
139 Mul
140 Div
141 Rem
142 And
143 AndNot
144 Shl
145 Shr
146 )
147
148
149 const (
150 _ = iota
151 precOrOr
152 precAndAnd
153 precCmp
154 precAdd
155 precMul
156 )
157
View as plain text