diff options
| author | Drahflow <drahflow@gmx.de> | 2013-09-02 11:27:01 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2013-09-02 11:27:01 +0200 |
| commit | 92b6155a1c3a209936dddebb8bf3372ebee78f94 (patch) | |
| tree | 8680757163dc8dbbea513b60f27945ec9c021af9 /interpreter | |
| parent | dd98844bd4968664f9dd7be996df596873733ecd (diff) | |
I CAN HAZ TCP/IP CONNECTION!
Very crappy HTTP client:
"drahflow.name:80" net .tcp .connect "+" via
"GET / HTTP/1.0\n\n" +writeall
4096 +read dump
Diffstat (limited to 'interpreter')
| -rw-r--r-- | interpreter/ElymasGlobal.pm | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/interpreter/ElymasGlobal.pm b/interpreter/ElymasGlobal.pm index 321a10d..1d1770d 100644 --- a/interpreter/ElymasGlobal.pm +++ b/interpreter/ElymasGlobal.pm @@ -174,6 +174,51 @@ EOPERL weaken($sub); } }, ['func', "}'"], 'quote'], + "}\"" => [sub { + my ($data) = @_; + + --$quoted; + + my @code; + + while(1) { + my $t = pop @$data or die "Stack underflow"; + last if($t->[1] eq 'tok' and $t->[0] eq '{'); + + unshift @code, $t; + }; + + die "unexpanded token in quoted code" if grep { $_->[1] eq 'tok' } @code; + + if($quoted) { + my $sub = <<'EOPERL' . + sub { + my ($data) = @_; + my $s = sub { + my ($data, $lscope) = @_; +EOPERL + compileCode(\@code) . <<'EOPERL'; + }; + push @$data, [$s, ['func', 'compiled sub (1)']]; + weaken($s); + } +EOPERL + $sub = eval($sub); + push @$data, [$sub, ['func', 'func-quoted'], \@code]; + weaken($sub); + } else { + my $sub = <<'EOPERL' . + sub { + my ($data, $lscope) = @_; +EOPERL + compileCode(\@code) . <<'EOPERL'; + }; +EOPERL + $sub = eval($sub); + push @$data, [$sub, ['func', 'compiled sub (2)']]; + weaken($sub); + } + }, ['func', "}'"], 'quote'], 'quoted' => [sub { my ($data, $scope) = @_; push @$data, [$quoted? 1: 0, 'int']; |
