mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-09-07 23:56:52 +00:00
ability to give custom env into readEval function
This commit is contained in:
parent
9aa9d4b20f
commit
34bb3fea8a
@ -39,13 +39,13 @@ class Lisp
|
||||
return $this->printer->pstr($value, $printReadable);
|
||||
}
|
||||
|
||||
public function readEval(string $input)
|
||||
public function readEval(string $input, ?Env $customEnv = null)
|
||||
{
|
||||
$tokens = $this->tokenizer->tokenize($input);
|
||||
|
||||
$expr = $this->reader->read($tokens);
|
||||
|
||||
return $this->eval->eval($expr, $this->env);
|
||||
return $this->eval->eval($expr, $customEnv ? $customEnv : $this->env);
|
||||
}
|
||||
|
||||
// read, eval, print
|
||||
|
Loading…
Reference in New Issue
Block a user