Hi everyone,
It’s now been a little more than two months since we introduced the new parser to swift-syntax. We have made some great progress since the last update:
- We significantly improved the recovery and diagnostics of the parser:
- 40 hand-crafted diagnostics were introduced to the parser
- The majority of diagnostics for missing or unexpected tokens can be automatically generated with accomponying Fix-Its. For example parsing a standalone
for i
auto-genrates an diagnostic with textexpected 'in', expression, and body in 'for' statement
and a Fix-It that transforms the code tofor i in <#expression#> {}
. - We imported the old parser's test suite into the new parser, started off with 1821 TODOs for diagnostics that either needed to be ported to the new parser or deemed as semantic and thus later diagnosed in ASTGen. 1469 of these have been resolved, leaving 352 remaining.
- We added an initial ASTGen library to the compiler, which will translate the parsed syntax trees into the C++ Abstract Syntax Tree (AST) used by the rest of the compiler.
-
Felix Wehnert added a pretty-printer of parser diagnostics to the
swift-parser-cli
testing tool that prints the diagnostics as ASCII art:1 │ foo.[].[].[] ∣ │ │ ╰─ expected name in member access ∣ │ ╰─ expected name in member access ∣ ╰─ expected name in member access
- SwiftLint switched to the new parser rewrote more than 100 rules from SourceKit to SwiftSyntax.
- Sourcery also migrated from the legacy C++ parser to the new parser.