pub fn interpret(
        &mut self, global_functions: HashMap<String, Chunk>,
        variables: HashMap<String, Rc<RefCell<Value>>>,
        fh: &mut Box<dyn BufRead>, running: Arc<AtomicBool>,
        name: &str
    ) -> (
        Option<Chunk>,
        HashMap<String, Rc<RefCell<Value>>>,
        Vec<RefCell<HashMap<String, Chunk>>>,
    ) {
        let mut compiler = Compiler::new(self.debug);
        let chunk_opt = compiler.compile(fh, name);
        match chunk_opt {
            None => return (None, HashMap::new(), Vec::new()),
            _ => {}
        }
        let chunk = chunk_opt.unwrap();
        let mut global_functions_rr = RefCell::new(global_functions);
        let call_stack_chunks = vec![];
        let mut scopes = vec![RefCell::new(variables)];
        let mut chunk_values = HashMap::new();
        let mut prev_local_vars_stacks = vec![];

        self.run(
            &mut scopes,
            &mut global_functions_rr,
            &call_stack_chunks,
            &chunk,
            &mut chunk_values,
            0,
            None,
            None,
            &mut prev_local_vars_stacks,
            (0, 0),
            running.clone(),
        );
        if self.print_stack {
            self.stack.clear();
        }
        let updated_variables = match scopes.first() {
            Some(scope) => scope.borrow().clone(),
            _ => HashMap::new(),
        };
        return (Some(chunk), updated_variables, vec![global_functions_rr]);
    }
/// Takes the global functions, the global variables, the file to
/// read the program code from, and the running flag as its
/// arguments.  Compiles the program code and executes it,
/// returning the chunk (if compiled successfully), the updated
/// set of global variables, and the updated set of global
/// functions.
Takes the global functions, the global variables, the file to
read the program code from, and the running flag as its
arguments.  Compiles the program code and executes it,
returning the chunk (if compiled successfully), the updated
set of global variables, and the updated set of global
functions.
Takes the global functions the global variables the file to read the program code from and the running flag as its arguments . Compiles the program code and executes it returning the chunk ( if compiled successfully ) the updated set of global variables and the updated set of global functions .
pub fn interpret(
        &mut self, global_functions: HashMap<String, Chunk>,
        variables: HashMap<String, Rc<RefCell<Value>>>,
        fh: &mut Box<dyn BufRead>, running: Arc<AtomicBool>,
        name: &str
    ) -> (
        Option<Chunk>,
        HashMap<String, Rc<RefCell<Value>>>,
        Vec<RefCell<HashMap<String, Chunk>>>,
    ) {
        let mut compiler = Compiler::new(self.debug);
        let chunk_opt = compiler.compile(fh, name);
        match chunk_opt {
            None => return (None, HashMap::new(), Vec::new()),
            _ => {}
        }
        let chunk = chunk_opt.unwrap();
        let mut global_functions_rr = RefCell::new(global_functions);
        let call_stack_chunks = vec![];
        let mut scopes = vec![RefCell::new(variables)];
        let mut chunk_values = HashMap::new();
        let mut prev_local_vars_stacks = vec![];
        self.run(
            &mut scopes,
            &mut global_functions_rr,
            &call_stack_chunks,
            &chunk,
            &mut chunk_values,
            0,
            None,
            None,
            &mut prev_local_vars_stacks,
            (0, 0),
            running.clone(),
        );
        if self.print_stack {
            self.stack.clear();
        }
        let updated_variables = match scopes.first() {
            Some(scope) => scope.borrow().clone(),
            _ => HashMap::new(),
        };
        return (Some(chunk), updated_variables, vec![global_functions_rr]);
    }
pub fn interpret ( & mut self , global_functions : HashMap < String , Chunk > , variables : HashMap < String , Rc < RefCell < Value > > > , fh : & mut Box < dyn BufRead > , running : Arc < AtomicBool > , name : & str ) -> ( Option < Chunk > , HashMap < String , Rc < RefCell < Value > > > , Vec < RefCell < HashMap < String , Chunk > > > , ) { let mut compiler = Compiler :: new ( self . debug ) ; let chunk_opt = compiler . compile ( fh , name ) ; match chunk_opt { None => return ( None , HashMap :: new ( ) , Vec :: new ( ) ) , _ => { } } let chunk = chunk_opt . unwrap ( ) ; let mut global_functions_rr = RefCell :: new ( global_functions ) ; let call_stack_chunks = vec ! [ ] ; let mut scopes = vec ! [ RefCell new ( variables ) ] ; let mut chunk_values = HashMap :: new ( ) ; let mut prev_local_vars_stacks = vec ! [ ] ; self . run ( & mut scopes , & mut global_functions_rr , & call_stack_chunks , & chunk , & mut chunk_values , 0 , None , None , & mut prev_local_vars_stacks , ( 0 , 0 ) , running . clone ( ) , ) ; if self . print_stack { self . stack . clear ( ) ; } let updated_variables = match scopes . first ( ) { Some ( scope ) => scope . borrow ( ) . clone ( ) , _ => HashMap :: new ( ) , } ; return ( Some ( chunk ) , updated_variables , vec ! [ global_functions_rr ] ) ; }
Takes the global functions, the global variables, the file to
read the program code from, and the running flag as its
arguments.
Takes the global functions the global variables the file to read the program code from and the running flag as its arguments .
&mut self
global_functions
HashMap<String, Chunk>
variables
HashMap<String, Rc<RefCell<Value>>>
fh
&mut Box<dyn BufRead>
running
Arc<AtomicBool>
name
&str