Finish bracketing of parse nodes. (#2430)

- Finishes remaining "todo" parse nodes.
- Improving error recovery for invalid designators and structs, so that the parse tree still looks similar to a valid parse tree.
- Call expressions now have the thing being called as a child (of the start) instead of a sibling.
- Use of Start is replacing use of End in several parse nodes, like structs and call expressions.
- Adjusting documentation of parse node structures in an attempt to make it more consistent and understandable.
- The current state for interfaces and if/else is mostly being documented, not altered.
This commit is contained in:
Jon Ross-Perkins
2022-11-30 09:14:07 -08:00
committed by GitHub
parent 46f4887cf7
commit 6bfd202f4e
18 changed files with 243 additions and 152 deletions
+1 -6
View File
@@ -26,7 +26,7 @@ auto ParseTree::Parse(TokenizedBuffer& tokens, DiagnosticConsumer& consumer)
// Delegate to the parser.
auto tree = Parser::Parse(tokens, emitter);
auto verify_error = tree.Verify();
CARBON_CHECK(!verify_error) << *verify_error;
CARBON_CHECK(!verify_error) << tree << *verify_error;
return tree;
}
@@ -215,11 +215,6 @@ auto ParseTree::Verify() const -> llvm::Optional<Error> {
break;
}
}
} else if (n_impl.kind.child_count() == ParseNodeKind::TodoFixParseNode) {
while (subtree_size < n_impl.subtree_size && !nodes.empty()) {
auto child_impl = node_impls_[nodes.pop_back_val().index()];
subtree_size += child_impl.subtree_size;
}
} else {
for (int i = 0; i < n_impl.kind.child_count(); ++i) {
if (nodes.empty()) {