aboutsummaryrefslogtreecommitdiff
path: root/interpreter/Elymas.pm
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-01-03 22:11:37 +0100
committerDrahflow <drahflow@gmx.de>2013-01-03 22:11:37 +0100
commit19d573cf7c6dd729289ef5151f15db51bcc79d91 (patch)
tree288980504ab3721cfa7fd0aea59514957c17b45d /interpreter/Elymas.pm
parentd7d307dc6563fe27bf43cab1e83ac21204fea6c6 (diff)
Compiler can now push ints and strings
Diffstat (limited to 'interpreter/Elymas.pm')
-rw-r--r--interpreter/Elymas.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/interpreter/Elymas.pm b/interpreter/Elymas.pm
index 6bfe4cf..0749443 100644
--- a/interpreter/Elymas.pm
+++ b/interpreter/Elymas.pm
@@ -52,7 +52,7 @@ sub arrayAccess {
my $i = pop @$data or die "Stack underflow";
die "array index must be int" unless $i->[1] eq 'int';
- push @$data, $array->[0]->[$i->[0]];
+ push @$data, $array->[0]->[$i->[0] % @{$array->[0]}];
}
sub interpretCode {
@@ -109,6 +109,7 @@ sub typeEqual {
if($a->[0] eq 'range') {
return $a->[1] == $b->[1] && $a->[2] == $b->[2];
} elsif($a->[0] eq 'array' or $a->[0] eq 'func') {
+ return 0 if(not defined $a->[2] or not defined $b->[2]);
return 0 if(@{$a->[2]} != @{$b->[2]});
return 0 if(@{$a->[3]} != @{$b->[3]});