diff options
| author | Drahflow <drahflow@gmx.de> | 2013-01-14 12:19:52 +0100 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2013-01-14 12:19:52 +0100 |
| commit | 347a635d04df610e1a5a56a46eddf071533a13ac (patch) | |
| tree | a986746e11cf41e3a8236b7be9ecd152c0cbb518 /interpreter | |
| parent | 99977d7858af0a0932848bddf819526a47f99d53 (diff) | |
More performance.
Diffstat (limited to 'interpreter')
| -rw-r--r-- | interpreter/Elymas.pm | 25 | ||||
| -rw-r--r-- | interpreter/ElymasGlobal.pm | 4 |
2 files changed, 17 insertions, 12 deletions
diff --git a/interpreter/Elymas.pm b/interpreter/Elymas.pm index 2f81365..20f8c36 100644 --- a/interpreter/Elymas.pm +++ b/interpreter/Elymas.pm @@ -52,23 +52,24 @@ sub arrayAccess { sub interpretCode { my ($code, $data, $scope) = @_; - foreach my $t (@$code) { - eval { - if($t->[1] eq 'tok') { - die "unexpanded token in interpretCode"; - } elsif(ref($t->[1]) eq 'ARRAY' and $t->[1]->[0] eq 'func') { + my $t; + + eval { + foreach my $tt (@$code) { + $t = $tt; + if(ref($t->[1]) eq 'ARRAY' and $t->[1]->[0] eq 'func') { execute($t, $data, $scope); } else { push @$data, $t; } - }; - if($@) { - #print "Code: " . Dumper($tokens); - #print "Scope: " . Dumper($scope); - print "Stack: " . Dumper($data); - print "Token: " . Dumper($t); - die; } + }; + if($@) { + #print "Code: " . Dumper($tokens); + #print "Scope: " . Dumper($scope); + print "Stack: " . Dumper($data); + print "Token: " . Dumper($t); + die; } } diff --git a/interpreter/ElymasGlobal.pm b/interpreter/ElymasGlobal.pm index 8fda948..5384cb5 100644 --- a/interpreter/ElymasGlobal.pm +++ b/interpreter/ElymasGlobal.pm @@ -49,6 +49,8 @@ our $global = { unshift @code, $t; }; + die "unexpanded token in quoted code" if grep { $_->[1] eq 'tok' } @code; + if($quoted) { push @$data, [sub { my ($data, $refScope) = @_; @@ -82,6 +84,8 @@ our $global = { unshift @code, $t; }; + die "unexpanded token in quoted code" if grep { $_->[1] eq 'tok' } @code; + if($quoted) { push @$data, [sub { my ($data, $refScope) = @_; |
