mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-18 18:30:30 +00:00
Change return of SkipPastLikelyEnd to be last consumed token (#3493)
This approach means the parse subtree includes the full token range consumed. --------- Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
1 parent
1addf10054
commit
6067ca3f49
28 files changed
+72
-94
No files matched your search
@@ -72,12 +72,8 @@ static auto HandleStatementKeywordFinish(Context& context, NodeKind node_kind)
|
||||
context.emitter().Emit(*context.position(), ExpectedStatementSemi,
|
||||
context.tokens().GetKind(state.token));
|
||||
state.has_error = true;
|
||||
// Recover to the next semicolon if possible, otherwise indicate the
|
||||
// keyword for the error.
|
||||
// Recover to the next semicolon if possible.
|
||||
semi = context.SkipPastLikelyEnd(state.token);
|
||||
if (!semi) {
|
||||
semi = state.token;
|
||||
}
|
||||
}
|
||||
context.AddNode(node_kind, *semi, state.subtree_start, state.has_error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user