Choice parsing in toolchain (#3574)

Implement Choice parsing in toolchain according to
[design](https://github.com/carbon-language/carbon-lang/blob/trunk/docs/design/sum_types.md).
This commit is contained in:
kshokhin authored and GitHub committed 2024-01-23 18:22:27 +00:00
1 parent afd194de9d
commit 65e95942de
16 files changed
+491

No files matched your search

@@ -158,6 +158,11 @@ static auto TryHandleAsDecl(Context& context, Context::StateStackEntry state,
State::VarAsDecl);
return true;
}
case Lex::TokenKind::Choice: {
ApplyIntroducer(context, state, NodeKind::ChoiceIntroducer,
State::ChoiceIntroducer);
return true;
}
case Lex::TokenKind::Semi: {
if (saw_modifier) {
@@ -201,6 +206,7 @@ static auto ResolveAmbiguousTokenAsDeclaration(Context& context,
#define CARBON_PARSE_NODE_KIND_TOKEN_MODIFIER(Name, ...) \
case Lex::TokenKind::Name:
#include "toolchain/parse/node_kind.def"
return false;
default: