mirror of
https://github.com/peklaiho/madlisp.git
synced 2024-11-22 21:35:03 +00:00
separate coreLibs and userLibs for LispFactory
This commit is contained in:
parent
90a9b3aa53
commit
871df1f691
@ -3,7 +3,7 @@ namespace MadLisp;
|
||||
|
||||
class LispFactory
|
||||
{
|
||||
public function make(array $libraries = []): Lisp
|
||||
public function make(array $coreLibs = [], array $userLibs = []): Lisp
|
||||
{
|
||||
$tokenizer = new Tokenizer();
|
||||
$reader = new Reader();
|
||||
@ -50,14 +50,19 @@ class LispFactory
|
||||
(new Lib\Time())->register($env);
|
||||
(new Lib\Types())->register($env);
|
||||
|
||||
// Register additional libraries
|
||||
foreach ($libraries as $lib) {
|
||||
// Register additional libs for root env
|
||||
foreach ($coreLibs as $lib) {
|
||||
$lib->register($env);
|
||||
}
|
||||
|
||||
// User environment
|
||||
$env = new Env('user', $env);
|
||||
|
||||
// Register additional libs for user env
|
||||
foreach ($userLibs as $lib) {
|
||||
$lib->register($env);
|
||||
}
|
||||
|
||||
return new Lisp($tokenizer, $reader, $eval, $printer, $env);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user