mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-15 22:28:14 +00:00
Parsing support for adapt declarations. (#3871)
This commit is contained in:
1 parent
bb117aea3a
commit
c5b7ff212b
7 files changed
+261
-1
No files matched your search
@@ -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