File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,14 +34,14 @@ pub fn run() -> anyhow::Result<()> {
3434
3535 let mut interpreter = Interpreter :: new ( ) ;
3636 interpreter. configure ( ndc_stdlib:: register) ;
37- loop {
37+ for command_nr in 1 .. {
3838 match rl. readline ( "λ " ) {
3939 Ok ( line) => {
4040 // If we can't append the history we just ignore this
4141 let _ = rl. add_history_entry ( line. as_str ( ) ) ;
4242
4343 // Run the line we just read through the interpreter
44- match interpreter. eval_named ( "<repl>" , line. as_str ( ) ) {
44+ match interpreter. eval_named ( format ! ( "<repl:{command_nr}>" ) , line. as_str ( ) ) {
4545 Ok ( value) => {
4646 let output = value. to_string ( ) ;
4747 if !output. is_empty ( ) {
Original file line number Diff line number Diff line change @@ -107,7 +107,11 @@ impl Interpreter {
107107 }
108108
109109 /// Execute source code with a custom source name for diagnostics.
110- pub fn eval_named ( & mut self , name : & str , input : & str ) -> Result < Value , InterpreterError > {
110+ pub fn eval_named (
111+ & mut self ,
112+ name : impl Into < String > ,
113+ input : & str ,
114+ ) -> Result < Value , InterpreterError > {
111115 let source_id = self . source_db . add ( name, input) ;
112116 let expressions = self . parse_and_analyse ( input, source_id) ?;
113117 self . interpret_vm ( input, expressions. into_iter ( ) )
You can’t perform that action at this time.
0 commit comments