mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 22:02:23 +01:00
Parsing support for adapt declarations. (#3871)
This commit is contained in:
@@ -110,6 +110,12 @@ static auto HandleBaseAsDecl(Context& context, Context::StateStackEntry state)
|
||||
static auto TryHandleAsDecl(Context& context, Context::StateStackEntry state,
|
||||
bool saw_modifier) -> bool {
|
||||
switch (context.PositionKind()) {
|
||||
case Lex::TokenKind::Adapt: {
|
||||
ApplyIntroducer(context, state, NodeKind::AdaptIntroducer,
|
||||
State::AdaptDecl);
|
||||
context.PushState(State::Expr);
|
||||
return true;
|
||||
}
|
||||
case Lex::TokenKind::Alias: {
|
||||
ApplyIntroducer(context, state, NodeKind::AliasIntroducer, State::Alias);
|
||||
return true;
|
||||
@@ -199,6 +205,7 @@ static auto ResolveAmbiguousTokenAsDeclaration(Context& context,
|
||||
// also modifiers (such as `base`). Other introducer tokens need to be
|
||||
// added by hand.
|
||||
switch (context.PositionKind(Lookahead::NextToken)) {
|
||||
case Lex::TokenKind::Adapt:
|
||||
case Lex::TokenKind::Alias:
|
||||
case Lex::TokenKind::Class:
|
||||
case Lex::TokenKind::Constraint:
|
||||
|
||||
Reference in New Issue
Block a user