Skip to content

Commit 0a67557

Browse files
authored
Merge pull request #1047 from allevato/print-trivia
Add `--include-trivia` flag to `swift-parser-cli`.
2 parents 1ba598a + 61b61cb commit 0a67557

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Sources/swift-parser-cli/swift-parser-cli.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ class PrintTree: ParsableCommand {
182182
@Flag(name: .long, help: "Perform sequence folding with the standard operators")
183183
var foldSequences: Bool = false
184184

185+
@Flag(name: .long, help: "Include trivia in the output")
186+
var includeTrivia: Bool = false
187+
185188
func run() throws {
186189
let source = try getContentsOfSourceFile(at: sourceFile)
187190

@@ -195,7 +198,7 @@ class PrintTree: ParsableCommand {
195198
resultTree = Syntax(tree)
196199
}
197200

198-
print(resultTree.recursiveDescription)
201+
print(resultTree.debugDescription(includeChildren: true, includeTrivia: includeTrivia))
199202
}
200203
}
201204
}

0 commit comments

Comments
 (0)