[parse] Implement initial parsing support for Lambda expressions (#6583)

This adds the necessary parser infrastructure to recognize and parse
lambda expressions in Carbon.

Key changes:
- Added  and  Parse Node Kinds.
- Updated  to use  to accommodate the growing number of node kinds.
- Implemented parser states and handlers for lambda syntax ( or ).
- Added  structure to .
- Added diagnostics for missing lambda bodies.
- Added a stub in  phase to defer semantic analysis using .
- Added parser tests for lambdas.
This commit is contained in:
Burak Emir
2026-01-14 16:58:15 +00:00
committed by GitHub
parent 83651bb9ee
commit 80639a02f0
19 changed files with 496 additions and 15 deletions
+5
View File
@@ -79,6 +79,11 @@ auto HandleExprInPostfix(Context& context) -> void {
context.PushState(state);
break;
}
case Lex::TokenKind::Fn: {
context.PushState(state);
context.PushState(StateKind::LambdaIntroducer);
break;
}
case Lex::TokenKind::False: {
context.AddLeafNode(NodeKind::BoolLiteralFalse, context.Consume());
context.PushState(state);