Add loop macro and a test
This commit is contained in:
parent
2e784310fb
commit
8bdc8232f9
|
@ -977,6 +977,25 @@ sub macro_return {
|
||||||
}
|
}
|
||||||
$macros{'return'} = \¯o_return;
|
$macros{'return'} = \¯o_return;
|
||||||
|
|
||||||
|
sub macro_loop {
|
||||||
|
my $ts = shift;
|
||||||
|
|
||||||
|
my $inner = macro_progn($ts);
|
||||||
|
|
||||||
|
return create_block(
|
||||||
|
"nil",
|
||||||
|
sub {
|
||||||
|
my $ctx = shift;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
$inner->($ctx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$macros{loop} = \¯o_loop;
|
||||||
|
|
||||||
sub compile {
|
sub compile {
|
||||||
my ($term) = @_;
|
my ($term) = @_;
|
||||||
my @tokens = tokenize($term);
|
my @tokens = tokenize($term);
|
||||||
|
|
Loading…
Reference in a new issue