rewrite macro parser, improving speed and making parameter parsing more sane

This commit is contained in:
Graham Knop 2008-09-16 02:09:37 +00:00
parent e2942b450e
commit f0e6a30d75
9 changed files with 293 additions and 65 deletions

View file

@ -0,0 +1,28 @@
package WebGUI::Macro::InfiniteMacro;
use strict;
use warnings;
sub process {
my $session = shift;
my $slow = shift;
if ($slow) {
my $rand = int(rand(10000));
return <<END;
^InfiniteMacro(^dfkgjhdfgk();dssdfsdfawilygth4 wu gbzwilrstg
sdfgdsfg
r7ilsgg hbawl
dsfgsdfgiegvgv
dfggvac
"sdaf${rand}gsdfgdsfg"
w3avvbfielysv iw4yvg silyrgvb iyzrsv bilw4u bgizs4rv,
"efgkhgsdfges.rkdjgdskjghsalkgh\\"\\"\\"sag" );';
END
}
else {
return '^InfiniteMacro();';
}
}
1;

View file

@ -0,0 +1,12 @@
package WebGUI::Macro::MacroEnd;
use strict;
use warnings;
sub process {
my $session = shift;
return "Nest();";
}
1;

View file

@ -0,0 +1,12 @@
package WebGUI::Macro::MacroNest;
use strict;
use warnings;
sub process {
my $session = shift;
return "^Extras;";
}
1;

View file

@ -0,0 +1,12 @@
package WebGUI::Macro::MacroStart;
use strict;
use warnings;
sub process {
my $session = shift;
return "^Macro";
}
1;

View file

@ -0,0 +1,12 @@
package WebGUI::Macro::ReverseParams;
use strict;
use warnings;
sub process {
my $session = shift;
return join '', reverse @_;
}
1;

View file

@ -0,0 +1,14 @@
package WebGUI::Macro::VisualMacro;
use strict;
use warnings;
sub process {
my $session = shift;
my @params = @_;
$_ = "`$_`" for @params;
return "\@MacroCall[" . join('.', @params) . "]:";
}
1;