22
22
public class TokenSpec {
23
23
public let name: String
24
24
public let kind : String
25
- public let serializationCode : Int
26
25
public let nameForDiagnostics : String
27
26
public let unprefixedKind : String
28
27
public let text : String ?
@@ -44,7 +43,6 @@ public class TokenSpec {
44
43
init (
45
44
name: String ,
46
45
kind: String ,
47
- serializationCode: Int ,
48
46
nameForDiagnostics: String ,
49
47
unprefixedKind: String ? = nil ,
50
48
text: String ? = nil ,
@@ -55,7 +53,6 @@ public class TokenSpec {
55
53
) {
56
54
self . name = name
57
55
self . kind = kind
58
- self . serializationCode = serializationCode
59
56
self . nameForDiagnostics = nameForDiagnostics
60
57
if let unprefixedKind = unprefixedKind {
61
58
self . unprefixedKind = unprefixedKind
@@ -74,7 +71,6 @@ public class TokenSpec {
74
71
public class KeywordSpec : TokenSpec {
75
72
init (
76
73
name: String ,
77
- serializationCode: Int ,
78
74
text: String ,
79
75
classification: String = " Keyword " ,
80
76
requiresLeadingSpace: Bool = false ,
@@ -83,7 +79,6 @@ public class KeywordSpec: TokenSpec {
83
79
super. init (
84
80
name: name,
85
81
kind: " kw_ \( text) " ,
86
- serializationCode: serializationCode,
87
82
nameForDiagnostics: text,
88
83
unprefixedKind: text,
89
84
text: text,
@@ -111,15 +106,13 @@ public class PoundKeywordSpec: TokenSpec {
111
106
init (
112
107
name: String ,
113
108
kind: String ,
114
- serializationCode: Int ,
115
109
nameForDiagnostics: String ? = nil ,
116
110
text: String ,
117
111
classification: String = " Keyword "
118
112
) {
119
113
super. init (
120
114
name: name,
121
115
kind: " pound_ \( kind) " ,
122
- serializationCode: serializationCode,
123
116
nameForDiagnostics: nameForDiagnostics ?? text,
124
117
unprefixedKind: kind,
125
118
text: text,
@@ -136,7 +129,6 @@ public class PoundObjectLiteralSpec: PoundKeywordSpec {
136
129
init (
137
130
name: String ,
138
131
kind: String ,
139
- serializationCode: Int ,
140
132
text: String ,
141
133
classification: String = " ObjectLiteral " ,
142
134
nameForDiagnostics: String ,
@@ -146,7 +138,6 @@ public class PoundObjectLiteralSpec: PoundKeywordSpec {
146
138
super. init (
147
139
name: name,
148
140
kind: kind,
149
- serializationCode: serializationCode,
150
141
nameForDiagnostics: nameForDiagnostics,
151
142
text: text,
152
143
classification: classification
@@ -160,14 +151,12 @@ public class PoundDirectiveKeywordSpec: PoundKeywordSpec {
160
151
init (
161
152
name: String ,
162
153
kind: String ,
163
- serializationCode: Int ,
164
154
text: String ,
165
155
classification: String = " PoundDirectiveKeyword "
166
156
) {
167
157
super. init (
168
158
name: name,
169
159
kind: kind,
170
- serializationCode: serializationCode,
171
160
text: text,
172
161
classification: classification
173
162
)
@@ -178,14 +167,12 @@ public class PoundConditionalDirectiveKeywordSpec: PoundDirectiveKeywordSpec {
178
167
override init (
179
168
name: String ,
180
169
kind: String ,
181
- serializationCode: Int ,
182
170
text: String ,
183
171
classification: String = " PoundDirectiveKeyword "
184
172
) {
185
173
super. init (
186
174
name: name,
187
175
kind: kind,
188
- serializationCode: serializationCode,
189
176
text: text,
190
177
classification: classification
191
178
)
@@ -196,7 +183,6 @@ public class PunctuatorSpec: TokenSpec {
196
183
init (
197
184
name: String ,
198
185
kind: String ,
199
- serializationCode: Int ,
200
186
text: String ,
201
187
classification: String = " None " ,
202
188
requiresLeadingSpace: Bool = false ,
@@ -205,7 +191,6 @@ public class PunctuatorSpec: TokenSpec {
205
191
super. init (
206
192
name: name,
207
193
kind: kind,
208
- serializationCode: serializationCode,
209
194
nameForDiagnostics: text,
210
195
unprefixedKind: nil ,
211
196
text: text,
@@ -226,19 +211,19 @@ public let SYNTAX_TOKENS: [TokenSpec] = [
226
211
% class _name = type ( token) . __name__
227
212
% parameters = [ " name: \" %s \" " % token. name]
228
213
% if class_name in [ 'Keyword', 'SwiftKeyword', 'DeclKeyword', 'StmtKeyword', 'ExprKeyword', 'PatternKeyword', 'SilKeyword'] :
229
- % parameters += [ " serializationCode: %s " % token . serialization_code , " text: \" %s \" " % token. text]
214
+ % parameters += [ " text: \" %s \" " % token. text]
230
215
% elif class _name in [ 'PoundKeyword', 'PoundConfig', 'PoundDirectiveKeyword', 'PoundConditionalDirectiveKeyword'] :
231
- % parameters += [ " kind: \" %s \" " % token. kind, " serializationCode: %s " % token . serialization_code , " text: \" %s \" " % token. text]
216
+ % parameters += [ " kind: \" %s \" " % token. kind, " text: \" %s \" " % token. text]
232
217
% elif class _name in [ 'Punctuator', 'Misc', 'Literal'] :
233
- % parameters += [ " kind: \" %s \" " % token. kind, " serializationCode: %s " % token . serialization_code ]
218
+ % parameters += [ " kind: \" %s \" " % token. kind]
234
219
% if class_name != 'Punctuator':
235
220
% parameters += [ " nameForDiagnostics: \" %s \" " % token. name_for_diagnostics]
236
221
% end
237
222
% if token. text:
238
223
% parameters += [ " text: \" %s \" " % token. text]
239
224
% end
240
225
% elif class _name == 'PoundObjectLiteral':
241
- % parameters += [ " kind: \" %s \" " % token. kind, " serializationCode: %s " % token . serialization_code , " text: \" %s \" " % token. text, " nameForDiagnostics: \" %s \" " % token. name_for_diagnostics, " protocol: \" %s \" " % token. protocol]
226
+ % parameters += [ " kind: \" %s \" " % token. kind, " text: \" %s \" " % token. text, " nameForDiagnostics: \" %s \" " % token. name_for_diagnostics, " protocol: \" %s \" " % token. protocol]
242
227
% else:
243
228
% print( " Unknown token `%s` " , ( token. name) , file= sys. stderr)
244
229
% sys . exit( 1 )
0 commit comments