|
@@ -68,10 +68,9 @@ auto Context::ConsumeAndAddOpenParen(Lex::TokenIndex default_token,
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-auto Context::ConsumeAndAddCloseSymbol(Lex::TokenIndex expected_open,
|
|
|
|
|
- State state, NodeKind close_kind)
|
|
|
|
|
|
|
+auto Context::ConsumeAndAddCloseSymbol(State state, NodeKind close_kind)
|
|
|
-> void {
|
|
-> void {
|
|
|
- Lex::TokenKind open_token_kind = tokens().GetKind(expected_open);
|
|
|
|
|
|
|
+ Lex::TokenKind open_token_kind = tokens().GetKind(state.token);
|
|
|
|
|
|
|
|
if (!open_token_kind.is_opening_symbol()) {
|
|
if (!open_token_kind.is_opening_symbol()) {
|
|
|
AddNode(close_kind, state.token, /*has_error=*/true);
|
|
AddNode(close_kind, state.token, /*has_error=*/true);
|
|
@@ -85,7 +84,7 @@ auto Context::ConsumeAndAddCloseSymbol(Lex::TokenIndex expected_open,
|
|
|
emitter_.Emit(*position_, ExpectedCloseSymbol,
|
|
emitter_.Emit(*position_, ExpectedCloseSymbol,
|
|
|
open_token_kind.closing_symbol());
|
|
open_token_kind.closing_symbol());
|
|
|
|
|
|
|
|
- SkipTo(tokens().GetMatchedClosingToken(expected_open));
|
|
|
|
|
|
|
+ SkipTo(tokens().GetMatchedClosingToken(state.token));
|
|
|
AddNode(close_kind, Consume(), /*has_error=*/true);
|
|
AddNode(close_kind, Consume(), /*has_error=*/true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|