mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 17:21:04 +01:00
Parse support for where operator (#4275)
Includes support for the `impls`, `=`, and `==` requirement operators to the right of a `where`, but `and` to allow multiple requirements is still a TODO. --------- Co-authored-by: Josh L <josh11b@users.noreply.github.com> Co-authored-by: Richard Smith <richard@metafoo.co.uk>
This commit is contained in:
co-authored by
Josh L
Richard Smith
parent
8fa173b58a
commit
c33c9a02f6
@@ -323,6 +323,15 @@ auto HandleExprLoop(Context& context) -> void {
|
||||
state.state = State::ExprLoopForShortCircuitOperatorAsOr;
|
||||
break;
|
||||
|
||||
// `where` also needs a virtual parse tree node, and parses its right
|
||||
// argument in a mode where it can handle requirement operators like
|
||||
// `impls` and `=`.
|
||||
case Lex::TokenKind::Where:
|
||||
context.AddNode(NodeKind::WhereOperand, state.token, state.has_error);
|
||||
context.PushState(state, State::WhereFinish);
|
||||
context.PushState(State::RequirementBegin);
|
||||
return;
|
||||
|
||||
default:
|
||||
state.state = State::ExprLoopForInfixOperator;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user