-
Notifications
You must be signed in to change notification settings - Fork 0
/
trigraphs.go
281 lines (249 loc) · 3.48 KB
/
trigraphs.go
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
// Code generated by golex. DO NOT EDIT.
// Copyright 2016 The CC Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Based on [0], 6.4.
//
// Implements translation phases 1 and 2 of [0], 5.1.1.2.
package cc
import (
"fmt"
)
const (
_ = iota
scTRIGRAPHS
)
func (t *trigraphsReader) scan() (r int) {
c := t.Enter()
yystate0:
yyrule := -1
_ = yyrule
c = t.Rule0()
switch yyt := t.sc; yyt {
default:
panic(fmt.Errorf(`invalid start condition %d`, yyt))
case 0: // start condition: INITIAL
goto yystart1
case 1: // start condition: TRIGRAPHS
goto yystart5
}
goto yystate0 // silence unused label error
goto yyAction // silence unused label error
yyAction:
switch yyrule {
case 1:
goto yyrule1
case 2:
goto yyrule2
case 3:
goto yyrule3
case 4:
goto yyrule4
case 5:
goto yyrule5
case 6:
goto yyrule6
case 7:
goto yyrule7
case 8:
goto yyrule8
case 9:
goto yyrule9
case 10:
goto yyrule10
case 11:
goto yyrule11
}
goto yystate1 // silence unused label error
yystate1:
c = t.Next()
yystart1:
switch {
default:
goto yyabort
case c == '\\':
goto yystate3
case c == '\r':
goto yystate2
}
yystate2:
c = t.Next()
yyrule = 10
t.Mark()
goto yyrule10
yystate3:
c = t.Next()
switch {
default:
goto yyabort
case c == '\n':
goto yystate2
case c == '\r':
goto yystate4
}
yystate4:
c = t.Next()
switch {
default:
goto yyabort
case c == '\n':
goto yystate2
}
goto yystate5 // silence unused label error
yystate5:
c = t.Next()
yystart5:
switch {
default:
goto yyabort
case c == '?':
goto yystate6
case c == '\\':
goto yystate3
case c == '\r':
goto yystate2
}
yystate6:
c = t.Next()
switch {
default:
goto yyabort
case c == '?':
goto yystate7
}
yystate7:
c = t.Next()
switch {
default:
goto yyabort
case c == '!':
goto yystate8
case c == '(':
goto yystate10
case c == ')':
goto yystate11
case c == '-':
goto yystate12
case c == '/':
goto yystate13
case c == '<':
goto yystate16
case c == '=':
goto yystate17
case c == '>':
goto yystate18
case c == '\'':
goto yystate9
}
yystate8:
c = t.Next()
yyrule = 1
t.Mark()
goto yyrule1
yystate9:
c = t.Next()
yyrule = 2
t.Mark()
goto yyrule2
yystate10:
c = t.Next()
yyrule = 3
t.Mark()
goto yyrule3
yystate11:
c = t.Next()
yyrule = 4
t.Mark()
goto yyrule4
yystate12:
c = t.Next()
yyrule = 5
t.Mark()
goto yyrule5
yystate13:
c = t.Next()
yyrule = 6
t.Mark()
switch {
default:
goto yyrule6
case c == '\n':
goto yystate14
case c == '\r':
goto yystate15
}
yystate14:
c = t.Next()
yyrule = 11
t.Mark()
goto yyrule11
yystate15:
c = t.Next()
switch {
default:
goto yyabort
case c == '\n':
goto yystate14
}
yystate16:
c = t.Next()
yyrule = 7
t.Mark()
goto yyrule7
yystate17:
c = t.Next()
yyrule = 8
t.Mark()
goto yyrule8
yystate18:
c = t.Next()
yyrule = 9
t.Mark()
goto yyrule9
yyrule1: // "??!"
{
return '|'
}
yyrule2: // "??'"
{
return '^'
}
yyrule3: // "??("
{
return '['
}
yyrule4: // "??)"
{
return ']'
}
yyrule5: // "??-"
{
return '~'
}
yyrule6: // "??/"
{
return '\\'
}
yyrule7: // "??<"
{
return '{'
}
yyrule8: // "??="
{
return '#'
}
yyrule9: // "??>"
{
return '}'
}
yyrule10: // \\\r?\n|\r
yyrule11: // "??/"\r?\n
goto yystate0
panic("unreachable")
goto yyabort // silence unused label error
yyabort: // no lexem recognized
if c, ok := t.Abort(); ok {
return c
}
goto yyAction
}