diff options
author | Scott Olson <scott@solson.me> | 2016-02-24 04:32:18 -0600 |
---|---|---|
committer | Scott Olson <scott@solson.me> | 2016-02-24 04:32:21 -0600 |
commit | 6498adb002bcf7e715afe46c23b8635d4592c156 (patch) | |
tree | d01e199673e596332d478b31298b7aff15db7963 /src/libexpr/parser.y | |
parent | 8f71bc33d5af7bc6d4728e5e36e89bcad27d2096 (diff) |
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.
Diffstat (limited to 'src/libexpr/parser.y')
-rw-r--r-- | src/libexpr/parser.y | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index f87aa2619..80ecd44c5 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -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); |