mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 22:02:52 +01:00
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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user