mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 16:01:04 +01:00
Support declaration modifier keywords (#3412)
Co-authored-by: Jon Ross-Perkins <jperkins@google.com>
This commit is contained in:
co-authored by
Jon Ross-Perkins
parent
22dff46ed2
commit
fada410559
@@ -32,6 +32,7 @@ auto HandleStatement(Context& context) -> void {
|
||||
}
|
||||
case Lex::TokenKind::Let: {
|
||||
context.PushState(State::Let);
|
||||
context.AddLeafNode(NodeKind::LetIntroducer, context.Consume());
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::Return: {
|
||||
@@ -44,6 +45,7 @@ auto HandleStatement(Context& context) -> void {
|
||||
}
|
||||
case Lex::TokenKind::Var: {
|
||||
context.PushState(State::VarAsDecl);
|
||||
context.AddLeafNode(NodeKind::VariableIntroducer, context.Consume());
|
||||
break;
|
||||
}
|
||||
case Lex::TokenKind::While: {
|
||||
@@ -101,6 +103,7 @@ auto HandleStatementForHeader(Context& context) -> void {
|
||||
if (context.PositionIs(Lex::TokenKind::Var)) {
|
||||
context.PushState(state);
|
||||
context.PushState(State::VarAsFor);
|
||||
context.AddLeafNode(NodeKind::VariableIntroducer, context.Consume());
|
||||
} else {
|
||||
CARBON_DIAGNOSTIC(ExpectedVariableDecl, Error,
|
||||
"Expected `var` declaration.");
|
||||
|
||||
Reference in New Issue
Block a user