11use crate :: Error ;
22use prettytable:: { format, Cell , Row , Table } ;
33use regex:: Regex ;
4- use remap:: { state , Formatter , Object , Program , Runtime , Value } ;
4+ use remap:: { diagnostic :: Formatter , state , Program , Runtime , Target , Value } ;
55use remap_functions:: all as funcs;
66use rustyline:: completion:: Completer ;
77use rustyline:: error:: ReadlineError ;
@@ -28,7 +28,7 @@ pub(crate) fn run(mut objects: Vec<Value>) -> Result<(), Error> {
2828 let func_docs_regex = Regex :: new ( r"^help\sdocs\s(\w{1,})$" ) . unwrap ( ) ;
2929
3030 let mut compiler_state = state:: Compiler :: default ( ) ;
31- let mut rt = Runtime :: new ( state:: Program :: default ( ) ) ;
31+ let mut rt = Runtime :: new ( state:: Runtime :: default ( ) ) ;
3232 let mut rl = Editor :: < Repl > :: new ( ) ;
3333 rl. set_helper ( Some ( Repl :: new ( ) ) ) ;
3434
@@ -135,7 +135,7 @@ pub(crate) fn run(mut objects: Vec<Value>) -> Result<(), Error> {
135135}
136136
137137fn resolve (
138- object : Option < & mut impl Object > ,
138+ object : Option < & mut impl Target > ,
139139 runtime : & mut Runtime ,
140140 program : & str ,
141141 state : & mut state:: Compiler ,
@@ -145,18 +145,12 @@ fn resolve(
145145 Some ( object) => object,
146146 } ;
147147
148- let program = match Program :: new_with_state (
149- program. to_owned ( ) ,
150- & remap_functions:: all ( ) ,
151- None ,
152- true ,
153- state,
154- ) {
155- Ok ( ( program, _) ) => program,
148+ let program = match remap:: compile_with_state ( program, & remap_functions:: all ( ) , state) {
149+ Ok ( program) => program,
156150 Err ( diagnostics) => return Formatter :: new ( program, diagnostics) . colored ( ) . to_string ( ) ,
157151 } ;
158152
159- match runtime. run ( object, & program) {
153+ match runtime. resolve ( object, & program) {
160154 Ok ( value) => value. to_string ( ) ,
161155 Err ( err) => err. to_string ( ) ,
162156 }
0 commit comments