about summary refs log tree commit diff
path: root/tvix
diff options
context:
space:
mode:
Diffstat (limited to 'tvix')
-rw-r--r--tvix/eval/src/errors.rs2
-rw-r--r--tvix/eval/src/eval.rs10
2 files changed, 10 insertions, 2 deletions
diff --git a/tvix/eval/src/errors.rs b/tvix/eval/src/errors.rs
index a5ba5bf40059..07ee8a4c7dae 100644
--- a/tvix/eval/src/errors.rs
+++ b/tvix/eval/src/errors.rs
@@ -31,6 +31,8 @@ pub enum Error {
 
     // Unknown variable in dynamic scope (with, rec, ...).
     UnknownDynamicVariable(String),
+
+    ParseErrors(Vec<rnix::parser::ParseError>),
 }
 
 impl Display for Error {
diff --git a/tvix/eval/src/eval.rs b/tvix/eval/src/eval.rs
index d8037ea143c7..94290af5376d 100644
--- a/tvix/eval/src/eval.rs
+++ b/tvix/eval/src/eval.rs
@@ -2,14 +2,20 @@ use std::path::PathBuf;
 
 use rnix::{self, types::TypedNode};
 
-use crate::{errors::EvalResult, value::Value};
+use crate::{
+    errors::{Error, EvalResult},
+    value::Value,
+};
 
 pub fn interpret(code: &str, location: Option<PathBuf>) -> EvalResult<Value> {
     let ast = rnix::parse(code);
 
     let errors = ast.errors();
     if !errors.is_empty() {
-        todo!()
+        for err in &errors {
+            eprintln!("parse error: {}", err);
+            return Err(Error::ParseErrors(errors));
+        }
     }
 
     if std::env::var("TVIX_DISPLAY_AST").is_ok() {