mirror of
https://github.com/NixOS/nix
synced 2025-06-28 17:51:15 +02:00
Throw a specific error for incomplete parse errors.
`nix-repl` will use this for deciding whether to keep waiting for input or error out right away.
This commit is contained in:
parent
8f71bc33d5
commit
6498adb002
3 changed files with 11 additions and 1 deletions
|
@ -31,10 +31,12 @@ namespace nix {
|
|||
Path basePath;
|
||||
Symbol path;
|
||||
string error;
|
||||
bool atEnd;
|
||||
Symbol sLetBody;
|
||||
ParseData(EvalState & state)
|
||||
: state(state)
|
||||
, symbols(state.symbols)
|
||||
, atEnd(false)
|
||||
, sLetBody(symbols.create("<let-body>"))
|
||||
{ };
|
||||
};
|
||||
|
@ -539,7 +541,12 @@ Expr * EvalState::parse(const char * text,
|
|||
int res = yyparse(scanner, &data);
|
||||
yylex_destroy(scanner);
|
||||
|
||||
if (res) throw ParseError(data.error);
|
||||
if (res) {
|
||||
if (data.atEnd)
|
||||
throw IncompleteParseError(data.error);
|
||||
else
|
||||
throw ParseError(data.error);
|
||||
}
|
||||
|
||||
data.result->bindVars(staticEnv);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue