Skip to content

Commit

Permalink
libnixf/Parse: exit early if missing = for binding
Browse files Browse the repository at this point in the history
  • Loading branch information
inclyc committed Feb 7, 2024
1 parent 36a89ce commit ef62100
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libnixf/src/Parse/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,11 @@ std::unique_ptr<Binding> Parser::parseBinding() {
assert(LastToken && "LastToken should be set after valid attrpath");
auto SyncEq = withSync(tok_eq);
auto SyncSemi = withSync(tok_semi_colon);
if (ExpectResult ER = expect(tok_eq); ER.ok())
consume();
if (ExpectResult ER = expect(tok_eq); !ER.ok())
return std::make_unique<Binding>(
LexerCursorRange{Path->lCur(), LastToken->rCur()}, std::move(Path),
nullptr);
consume();
auto Expr = parseExpr();
if (!Expr)
diagNullExpr(Diags, LastToken->rCur(), "binding");
Expand Down

0 comments on commit ef62100

Please sign in to comment.