@@ -83,21 +83,13 @@ class VerifyRoundTrip: ParsableCommand {
83
83
abstract: " Verify that printing the parsed syntax tree produces the original source "
84
84
)
85
85
86
- init ( sourceFile: String ? , swiftVersion : String ? , enableBareSlashRegex : Bool ? ) {
86
+ init ( sourceFile: String ? ) {
87
87
self . sourceFile = sourceFile
88
- self . swiftVersion = swiftVersion
89
- self . enableBareSlashRegex = enableBareSlashRegex
90
88
}
91
89
92
90
@Argument ( help: " The source file that should be parsed; if omitted, use stdin " )
93
91
var sourceFile : String ?
94
92
95
- @Option ( name: . long, help: " Interpret input according to a specific Swift language version number " )
96
- var swiftVersion : String ?
97
-
98
- @Option ( name: . long, help: " Enable or disable the use of forward slash regular-expression literal syntax " )
99
- var enableBareSlashRegex : Bool ?
100
-
101
93
@Flag ( name: . long, help: " Perform sequence folding with the standard operators " )
102
94
var foldSequences : Bool = false
103
95
@@ -117,22 +109,15 @@ class VerifyRoundTrip: ParsableCommand {
117
109
118
110
try source. withUnsafeBufferPointer { sourceBuffer in
119
111
try Self . run (
120
- source: sourceBuffer, swiftVersion: swiftVersion,
121
- enableBareSlashRegex: enableBareSlashRegex,
122
- foldSequences: foldSequences
112
+ source: sourceBuffer, foldSequences: foldSequences
123
113
)
124
114
}
125
115
}
126
116
127
117
static func run(
128
- source: UnsafeBufferPointer < UInt8 > , swiftVersion: String ? ,
129
- enableBareSlashRegex: Bool ? , foldSequences: Bool
118
+ source: UnsafeBufferPointer < UInt8 > , foldSequences: Bool
130
119
) throws {
131
- let tree = try Parser . parse (
132
- source: source,
133
- languageVersion: swiftVersion,
134
- enableBareSlashRegexLiteral: enableBareSlashRegex
135
- )
120
+ let tree = Parser . parse ( source: source)
136
121
137
122
let resultTree : Syntax
138
123
if foldSequences {
@@ -158,24 +143,14 @@ class PrintDiags: ParsableCommand {
158
143
@Argument ( help: " The source file that should be parsed; if omitted, use stdin " )
159
144
var sourceFile : String ?
160
145
161
- @Option ( name: . long, help: " Interpret input according to a specific Swift language version number " )
162
- var swiftVersion : String ?
163
-
164
- @Option ( name: . long, help: " Enable or disable the use of forward slash regular-expression literal syntax " )
165
- var enableBareSlashRegex : Bool ?
166
-
167
146
@Flag ( name: . long, help: " Perform sequence folding with the standard operators " )
168
147
var foldSequences : Bool = false
169
148
170
149
func run( ) throws {
171
150
let source = try getContentsOfSourceFile ( at: sourceFile)
172
151
173
- try source. withUnsafeBufferPointer { sourceBuffer in
174
- let tree = try Parser . parse (
175
- source: sourceBuffer,
176
- languageVersion: swiftVersion,
177
- enableBareSlashRegexLiteral: enableBareSlashRegex
178
- )
152
+ source. withUnsafeBufferPointer { sourceBuffer in
153
+ let tree = Parser . parse ( source: sourceBuffer)
179
154
180
155
var diags = ParseDiagnosticsGenerator . diagnostics ( for: tree)
181
156
print ( DiagnosticsFormatter . annotatedSource ( tree: tree, diags: diags) )
@@ -202,24 +177,14 @@ class PrintInitCall: ParsableCommand {
202
177
@Argument ( help: " The source file that should be parsed; if omitted, use stdin " )
203
178
var sourceFile : String ?
204
179
205
- @Option ( name: . long, help: " Interpret input according to a specific Swift language version number " )
206
- var swiftVersion : String ?
207
-
208
- @Option ( name: . long, help: " Enable or disable the use of forward slash regular-expression literal syntax " )
209
- var enableBareSlashRegex : Bool ?
210
-
211
180
@Flag ( name: . long, help: " Perform sequence folding with the standard operators " )
212
181
var foldSequences : Bool = false
213
182
214
183
func run( ) throws {
215
184
let source = try getContentsOfSourceFile ( at: sourceFile)
216
185
217
- try source. withUnsafeBufferPointer { sourceBuffer in
218
- var tree = try Parser . parse (
219
- source: sourceBuffer,
220
- languageVersion: swiftVersion,
221
- enableBareSlashRegexLiteral: enableBareSlashRegex
222
- )
186
+ source. withUnsafeBufferPointer { sourceBuffer in
187
+ var tree = Parser . parse ( source: sourceBuffer)
223
188
224
189
if foldSequences {
225
190
tree = foldAllSequences ( tree) . 0 . as ( SourceFileSyntax . self) !
@@ -241,24 +206,14 @@ class PrintTree: ParsableCommand {
241
206
@Argument ( help: " The source file that should be parsed; if omitted, use stdin " )
242
207
var sourceFile : String ?
243
208
244
- @Option ( name: . long, help: " Interpret input according to a specific Swift language version number " )
245
- var swiftVersion : String ?
246
-
247
- @Option ( name: . long, help: " Enable or disable the use of forward slash regular-expression literal syntax " )
248
- var enableBareSlashRegex : Bool ?
249
-
250
209
@Flag ( name: . long, help: " Perform sequence folding with the standard operators " )
251
210
var foldSequences : Bool = false
252
211
253
212
func run( ) throws {
254
213
let source = try getContentsOfSourceFile ( at: sourceFile)
255
214
256
- try source. withUnsafeBufferPointer { sourceBuffer in
257
- let tree = try Parser . parse (
258
- source: sourceBuffer,
259
- languageVersion: swiftVersion,
260
- enableBareSlashRegexLiteral: enableBareSlashRegex
261
- )
215
+ source. withUnsafeBufferPointer { sourceBuffer in
216
+ let tree = Parser . parse ( source: sourceBuffer)
262
217
263
218
let resultTree : Syntax
264
219
if foldSequences {
@@ -283,12 +238,6 @@ class Reduce: ParsableCommand {
283
238
@Argument ( help: " The test case that should be reduced; if omitted, use stdin " )
284
239
var sourceFile : String ?
285
240
286
- @Option ( name: . long, help: " Interpret input according to a specific Swift language version number " )
287
- var swiftVersion : String ?
288
-
289
- @Option ( name: . long, help: " Enable or disable the use of forward slash regular-expression literal syntax " )
290
- var enableBareSlashRegex : Bool ?
291
-
292
241
@Flag ( name: . long, help: " Perform sequence folding with the standard operators " )
293
242
var foldSequences : Bool = false
294
243
@@ -326,16 +275,6 @@ class Reduce: ParsableCommand {
326
275
process. arguments = [
327
276
" verify-round-trip " , tempFileURL. path,
328
277
]
329
- if let enableBareSlashRegex = enableBareSlashRegex {
330
- process. arguments! += [
331
- " --enable-bare-slash-regex " , enableBareSlashRegex ? " true " : " false "
332
- ]
333
- }
334
- if let swiftVersion = swiftVersion {
335
- process. arguments! += [
336
- " --swift-version " , swiftVersion
337
- ]
338
- }
339
278
if foldSequences {
340
279
process. arguments! += [ " --fold-sequences " ]
341
280
}
@@ -372,8 +311,8 @@ class Reduce: ParsableCommand {
372
311
private func runVerifyRoundTripInCurrentProcess( source: [ UInt8 ] ) throws -> Bool {
373
312
do {
374
313
try source. withUnsafeBufferPointer { sourceBuffer in
375
- try VerifyRoundTrip . run ( source : sourceBuffer , swiftVersion : self . swiftVersion , enableBareSlashRegex : self . enableBareSlashRegex ,
376
- foldSequences: foldSequences)
314
+ try VerifyRoundTrip . run (
315
+ source : sourceBuffer , foldSequences: foldSequences)
377
316
}
378
317
} catch {
379
318
return false
0 commit comments