mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 11:42:35 +01:00
compiler_vm: remove left-over arguments processing code
This commit is contained in:
parent
e764c9c71a
commit
e0105c0646
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'bash $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = ": <<'____CMDLINE____'\n";
|
||||
$self->{cmdline_closing_comment} = "____CMDLINE____\n";
|
||||
|
||||
|
@ -13,10 +13,6 @@ sub initialize {
|
||||
$self->{execfile} = 'prog';
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'go $options run $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'ghc -v0 $options -o $execfile $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = "{-|\n=============== CMDLINE ===============\n";
|
||||
$self->{cmdline_closing_comment} = "=============== CMDLINE ===============\n-}\n";
|
||||
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'd8 $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = "/************* CMDLINE *************\n";
|
||||
$self->{cmdline_closing_comment} = "************** CMDLINE *************/\n";
|
||||
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'ksh $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = ": <<'____CMDLINE____'\n";
|
||||
$self->{cmdline_closing_comment} = "____CMDLINE____\n";
|
||||
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'lua $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = "--[[--------------- CMDLINE ---------------\n";
|
||||
$self->{cmdline_closing_comment} = "------------------- CMDLINE ---------------]]\n";
|
||||
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'python $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = "'''\n=============== CMDLINE ===============\n";
|
||||
$self->{cmdline_closing_comment} = "=============== CMDLINE ===============\n'''\n";
|
||||
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'python3 $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = "'''\n=============== CMDLINE ===============\n";
|
||||
$self->{cmdline_closing_comment} = "=============== CMDLINE ===============\n'''\n";
|
||||
|
||||
|
@ -10,8 +10,6 @@ use strict;
|
||||
package ruby;
|
||||
use parent '_default';
|
||||
|
||||
use Text::ParseWords qw(shellwords);
|
||||
|
||||
sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
|
||||
@ -19,51 +17,6 @@ sub initialize {
|
||||
$self->{execfile} = 'prog.rb';
|
||||
$self->{default_options} = '-w';
|
||||
$self->{cmdline} = 'ruby $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
}
|
||||
|
||||
sub preprocess_code {
|
||||
my $self = shift;
|
||||
$self->SUPER::preprocess_code;
|
||||
|
||||
if (defined $self->{arguments}) {
|
||||
my @args = shellwords($self->{arguments});
|
||||
my $prelude .= "\nmy \$arglen = " . (scalar @args) . ";\n";
|
||||
|
||||
if (@args) {
|
||||
$prelude .= "my \@args = (";
|
||||
|
||||
my $comma = "";
|
||||
foreach my $arg (@args) {
|
||||
$arg = quotemeta $arg;
|
||||
$prelude .= "$comma\"$arg\"";
|
||||
$comma = ", ";
|
||||
}
|
||||
|
||||
$prelude .= ");\n";
|
||||
} else {
|
||||
$prelude .= "my \@args;\n";
|
||||
}
|
||||
|
||||
$self->{code} = "$prelude\n$self->{code}";
|
||||
}
|
||||
}
|
||||
|
||||
sub postprocess_output {
|
||||
my $self = shift;
|
||||
$self->SUPER::postprocess_output;
|
||||
|
||||
$self->{output} =~ s/\s+at $self->{sourcefile} line \d+, near ".*?"//;
|
||||
$self->{output} =~ s/\s*Execution of $self->{sourcefile} aborted due to compilation errors.//;
|
||||
|
||||
$self->{cmdline_opening_comment} = "=cut =============== CMDLINE ===============\n";
|
||||
$self->{cmdline_closing_comment} = "=cut\n";
|
||||
|
||||
$self->{output_opening_comment} = "=cut =============== OUTPUT ===============\n";
|
||||
$self->{output_closing_comment} = "=cut\n";
|
||||
}
|
||||
|
||||
1;
|
||||
|
@ -14,10 +14,6 @@ sub initialize {
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'tclsh $options $sourcefile';
|
||||
|
||||
if (length $self->{arguments}) {
|
||||
$self->{cmdline} .= " $self->{arguments}";
|
||||
}
|
||||
|
||||
$self->{cmdline_opening_comment} = "set CMDLINE {\n";
|
||||
$self->{cmdline_closing_comment} = "}\n";
|
||||
|
||||
|
24
modules/compiler_vm/languages/zsh.pm
Executable file
24
modules/compiler_vm/languages/zsh.pm
Executable file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
package zsh;
|
||||
use parent '_default';
|
||||
|
||||
sub initialize {
|
||||
my ($self, %conf) = @_;
|
||||
|
||||
$self->{sourcefile} = 'prog.zsh';
|
||||
$self->{execfile} = 'prog.zsh';
|
||||
$self->{default_options} = '';
|
||||
$self->{cmdline} = 'zsh $options $sourcefile';
|
||||
|
||||
$self->{cmdline_opening_comment} = ": <<'____CMDLINE____'\n";
|
||||
$self->{cmdline_closing_comment} = "____CMDLINE____\n";
|
||||
|
||||
$self->{output_opening_comment} = ": << '____OUTPUT____'\n";
|
||||
$self->{output_closing_comment} = "____OUTPUT____\n";
|
||||
}
|
||||
|
||||
1;
|
Loading…
Reference in New Issue
Block a user