aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/working/array-list.ey19
-rw-r--r--interpreter/ElymasGlobal.pm10
2 files changed, 25 insertions, 4 deletions
diff --git a/examples/working/array-list.ey b/examples/working/array-list.ey
new file mode 100644
index 0000000..de34ad9
--- /dev/null
+++ b/examples/working/array-list.ey
@@ -0,0 +1,19 @@
+<
+ [ 0 1 2 ] /list defv
+
+ {
+ list [ -102 ] cat =list
+ }
+
+ {
+ list dump
+ }
+> -- /dumpAll deff /append deff
+
+"here" dump
+
+3 append
+4 append
+5 append
+
+dumpAll
diff --git a/interpreter/ElymasGlobal.pm b/interpreter/ElymasGlobal.pm
index 9cb0337..fddf483 100644
--- a/interpreter/ElymasGlobal.pm
+++ b/interpreter/ElymasGlobal.pm
@@ -37,7 +37,8 @@ our $global = {
push @$data, ['{', 'tok', '{'];
}, ['func', '{'], 'quote'],
'}' => [sub {
- my ($data, $scope) = @_;
+ my ($data, $refScope) = @_;
+ my $scope = $$refScope;
--$quoted;
@@ -61,13 +62,14 @@ our $global = {
} else {
push @$data, [sub {
my ($data) = @_;
- my $lscope = \{ ' parent' => $$scope };
+ my $lscope = \{ ' parent' => $scope };
interpretCode(\@code, $data, $lscope);
}, ['func', 'Dumper(\@code)']];
}
}, ['func', '}'], 'quote'],
"}'" => [sub {
- my ($data, $scope) = @_;
+ my ($data, $refScope) = @_;
+ my $scope = $$refScope;
--$quoted;
@@ -90,7 +92,7 @@ our $global = {
} else {
push @$data, [sub {
my ($data) = @_;
- interpretCode(\@code, $data, $scope);
+ interpretCode(\@code, $data, \$scope);
}, ['func', 'Dumper(\@code)']];
}
}, ['func', '}'], 'quote'],