[Bps-public-commit] r13854 - in Lorzy/trunk: . lib lib/Lorzy lib/PIE t
sartak at bestpractical.com
sartak at bestpractical.com
Tue Jul 8 10:55:23 EDT 2008
Author: sartak
Date: Tue Jul 8 10:55:20 2008
New Revision: 13854
Added:
Lorzy/trunk/lib/Lorzy/
- copied from r13853, /Lorzy/trunk/lib/PIE/
Lorzy/trunk/lib/Lorzy.pm
- copied, changed from r13853, /Lorzy/trunk/lib/PIE.pm
Removed:
Lorzy/trunk/lib/PIE/
Lorzy/trunk/lib/PIE.pm
Modified:
Lorzy/trunk/ (props changed)
Lorzy/trunk/lib/Lorzy/Block.pm
Lorzy/trunk/lib/Lorzy/Builder.pm
Lorzy/trunk/lib/Lorzy/Evaluatable.pm
Lorzy/trunk/lib/Lorzy/Evaluator.pm
Lorzy/trunk/lib/Lorzy/EvaluatorResult.pm
Lorzy/trunk/lib/Lorzy/Expression.pm
Lorzy/trunk/lib/Lorzy/FunctionArgument.pm
Lorzy/trunk/lib/Lorzy/Lambda.pm
Lorzy/trunk/lib/Lorzy/Lambda/Native.pm
Lorzy/trunk/t/01basic.t
Lorzy/trunk/t/builder.t
Lorzy/trunk/t/hello_world.t
Lorzy/trunk/t/introspection.t
Lorzy/trunk/t/leaky-lexicals.t
Lorzy/trunk/t/let.t
Lorzy/trunk/t/list.t
Lorzy/trunk/t/named-params.t
Log:
r63821 at onn: sartak | 2008-07-08 10:55:10 -0400
Rename PIE to Lorzy
Copied: Lorzy/trunk/lib/Lorzy.pm (from r13853, /Lorzy/trunk/lib/PIE.pm)
==============================================================================
--- /Lorzy/trunk/lib/PIE.pm (original)
+++ Lorzy/trunk/lib/Lorzy.pm Tue Jul 8 10:55:20 2008
@@ -1,7 +1,7 @@
=head1 NAME
-PIE - The Pinglin Interactive Evaluator
+Lorzy - The Pinglin Interactive Evaluator
=head1 AUTHOR
@@ -14,7 +14,7 @@
=cut
-package PIE;
+package Lorzy;
our $VERSION = 0;
Modified: Lorzy/trunk/lib/Lorzy/Block.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Block.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Block.pm Tue Jul 8 10:55:20 2008
@@ -1,4 +1,4 @@
-package PIE::Block;
+package Lorzy::Block;
use Moose::Role;
our $BLOCK_IDS = 0;
@@ -19,10 +19,10 @@
my $next = shift;
my $class = shift;
my $self = $class->$next(@_);
- return $self if ref($self) eq 'PIE::Lambda::Native';
+ return $self if ref($self) eq 'Lorzy::Lambda::Native';
$self->_walk( $self,
sub { my $block = shift;
- return unless $block->does('PIE::Block');
+ return unless $block->does('Lorzy::Block');
$block->outer_block($self);
return 1;
} );
Modified: Lorzy/trunk/lib/Lorzy/Builder.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Builder.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Builder.pm Tue Jul 8 10:55:20 2008
@@ -1,27 +1,27 @@
-package PIE::Builder;
+package Lorzy::Builder;
use Moose;
use Params::Validate;
-use PIE::Lambda;
+use Lorzy::Lambda;
-use PIE::Expression;
+use Lorzy::Expression;
use UNIVERSAL::require;
sub build_op_expression {
my ($self, $name, $args) = @_;
my $class = $name;
- $class = "PIE::Expression::$name" unless ($name =~ /^PIE::Expression/);
+ $class = "Lorzy::Expression::$name" unless ($name =~ /^Lorzy::Expression/);
if ($class->can('meta')) {
$name = $class;
}
else {
- $class = "PIE::Expression";
+ $class = "Lorzy::Expression";
}
# XXX: in case of primitive-ops, we should only bulid the args we
# know about
- my @known_args = $class eq 'PIE::Expression' ? keys %$args : keys %{ $class->signature };
+ my @known_args = $class eq 'Lorzy::Expression' ? keys %$args : keys %{ $class->signature };
return $class->new( name => $name, builder => $self, builder_args => $args,
args => { map { $_ => $self->build_expression( $args->{$_} ) } @known_args } );
@@ -30,7 +30,7 @@
sub build_expression {
my ($self, $tree) = @_;
if (!ref($tree)) {
- return PIE::Expression::String->new(args => { value => $tree} );
+ return Lorzy::Expression::String->new(args => { value => $tree} );
}
elsif (ref($tree) eq 'HASH') {
return $self->build_op_expression($tree->{name}, $tree->{args});
@@ -43,7 +43,7 @@
sub defun {
my $self = shift;
my %args = validate( @_, { ops => 1, signature => 1 });
- return PIE::Lambda->new( progn => PIE::Expression::ProgN->new(
+ return Lorzy::Lambda->new( progn => Lorzy::Expression::ProgN->new(
nodes => [map { $self->build_expression($_) } @{$args{ops}} ]),
signature => $args{signature} );
}
Modified: Lorzy/trunk/lib/Lorzy/Evaluatable.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Evaluatable.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Evaluatable.pm Tue Jul 8 10:55:20 2008
@@ -1,5 +1,5 @@
-package PIE::Evaluatable;
+package Lorzy::Evaluatable;
use Moose::Role;
requires 'evaluate';
Modified: Lorzy/trunk/lib/Lorzy/Evaluator.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Evaluator.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Evaluator.pm Tue Jul 8 10:55:20 2008
@@ -1,14 +1,14 @@
-package PIE::Evaluator;
+package Lorzy::Evaluator;
use Moose;
use MooseX::AttributeHelpers;
-use PIE::EvaluatorResult;
+use Lorzy::EvaluatorResult;
use Params::Validate;
has result => (
is => 'ro',
- isa => 'PIE::EvaluatorResult',
- default => sub { return PIE::EvaluatorResult->new()}
+ isa => 'Lorzy::EvaluatorResult',
+ default => sub { return Lorzy::EvaluatorResult->new()}
);
has global_symbols => (
@@ -30,7 +30,7 @@
has stack_block => (
is => 'rw',
metaclass => 'Collection::Array',
- isa => 'ArrayRef[PIE::Block]',
+ isa => 'ArrayRef[Lorzy::Block]',
default => sub { [] },
provides => {
'push' => 'push_stack_block',
@@ -118,8 +118,8 @@
# self, a lambda, any number of positional params. (to be replaced with a params object?)
my ( $self, $lambda, $args ) = validate_pos(
@_,
- { isa => 'PIE::Evaluator' },
- { ISA => 'PIE::Lambda' },
+ { isa => 'Lorzy::Evaluator' },
+ { ISA => 'Lorzy::Lambda' },
{ ISA => "HASHREF" }
);
Carp::confess unless($lambda);
@@ -144,11 +144,11 @@
sub _enumerate_core_expressions {
my $self = shift;
no strict 'refs';
- use PIE::Expression;
+ use Lorzy::Expression;
my @core_expressions
- = grep { $_ && $_->isa('PIE::Expression') }
- map { /^(.*)::$/ ? 'PIE::Expression::' . $1 : '' }
- keys %{'PIE::Expression::'};
+ = grep { $_ && $_->isa('Lorzy::Expression') }
+ map { /^(.*)::$/ ? 'Lorzy::Expression::' . $1 : '' }
+ keys %{'Lorzy::Expression::'};
return @core_expressions;
}
Modified: Lorzy/trunk/lib/Lorzy/EvaluatorResult.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/EvaluatorResult.pm (original)
+++ Lorzy/trunk/lib/Lorzy/EvaluatorResult.pm Tue Jul 8 10:55:20 2008
@@ -1,4 +1,4 @@
-package PIE::EvaluatorResult;
+package Lorzy::EvaluatorResult;
use Moose;
has success => (
@@ -14,7 +14,7 @@
has value => (
is => 'rw',
-# isa => 'Str | Undef | PIE::EvaluatorResult::RunTime',
+# isa => 'Str | Undef | Lorzy::EvaluatorResult::RunTime',
required => 0
);
Modified: Lorzy/trunk/lib/Lorzy/Expression.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Expression.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Expression.pm Tue Jul 8 10:55:20 2008
@@ -1,9 +1,9 @@
-package PIE::Expression;
-use PIE::FunctionArgument;
+package Lorzy::Expression;
+use Lorzy::FunctionArgument;
use Moose;
-with 'PIE::Evaluatable';
+with 'Lorzy::Evaluatable';
has name => (
is => 'ro',
@@ -16,12 +16,12 @@
has signature => (
is => 'rw',
default => sub { {}},
- isa => 'HashRef[PIE::FunctionArgument]');
+ isa => 'HashRef[Lorzy::FunctionArgument]');
has args => (
is => 'rw',
default => sub { {} },
- isa => 'HashRef[PIE::Expression]');
+ isa => 'HashRef[Lorzy::Expression]');
sub evaluate {
my ($self, $ev) = @_;
@@ -30,18 +30,18 @@
return $ev->result->value;
}
-package PIE::Expression::True;
+package Lorzy::Expression::True;
use Moose;
use MooseX::ClassAttribute;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
class_has signature => ( is => 'ro', default => sub { { }});
sub evaluate {1}
-package PIE::Expression::False;
+package Lorzy::Expression::False;
use Moose;
-extends 'PIE::Expression::True';
+extends 'Lorzy::Expression::True';
sub evaluate {
my $self = shift;
@@ -49,9 +49,9 @@
}
-package PIE::Expression::IfThen;
+package Lorzy::Expression::IfThen;
use Moose;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
use Params::Validate qw/validate_pos/;
use MooseX::ClassAttribute;
@@ -59,23 +59,23 @@
is => 'ro',
default => sub {
{
- condition => PIE::FunctionArgument->new(
+ condition => Lorzy::FunctionArgument->new(
name => 'condition',
- type => 'PIE::Evaluatable'),
+ type => 'Lorzy::Evaluatable'),
- if_true => PIE::FunctionArgument->new(
+ if_true => Lorzy::FunctionArgument->new(
name => 'if_true',
- type => 'PIE::Evaluatable'),
- if_false => PIE::FunctionArgument->new(
+ type => 'Lorzy::Evaluatable'),
+ if_false => Lorzy::FunctionArgument->new(
name => 'if_false',
- type => 'PIE::Evaluatable'
+ type => 'Lorzy::Evaluatable'
)
}
}
);
sub evaluate {
- my ($self, $evaluator) = validate_pos(@_, { isa => 'PIE::Expression'}, { isa => 'PIE::Evaluator'}, );
+ my ($self, $evaluator) = validate_pos(@_, { isa => 'Lorzy::Expression'}, { isa => 'Lorzy::Evaluator'}, );
my $truth= $self->args->{condition}->evaluate($evaluator);
if ($truth) {
@@ -85,16 +85,16 @@
}
}
-package PIE::Expression::String;
+package Lorzy::Expression::String;
use Moose;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
use Params::Validate qw/validate_pos/;
use MooseX::ClassAttribute;
class_has signature => (
is => 'ro',
default => sub {
- { value => PIE::FunctionArgument->new( name => 'value', type => 'Str' )
+ { value => Lorzy::FunctionArgument->new( name => 'value', type => 'Str' )
};
}
);
@@ -106,8 +106,8 @@
sub evaluate {
my ( $self, $eval ) = validate_pos(
@_,
- { isa => 'PIE::Expression' },
- { isa => 'PIE::Evaluator' }
+ { isa => 'Lorzy::Expression' },
+ { isa => 'Lorzy::Evaluator' }
);
@@ -115,10 +115,10 @@
}
-package PIE::Expression::ProgN;
+package Lorzy::Expression::ProgN;
use MooseX::ClassAttribute;
use Moose;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
class_has signature => ( is => 'ro', default => sub { { }});
has nodes => (
@@ -145,53 +145,53 @@
return $res;
}
-package PIE::Expression::Symbol;
+package Lorzy::Expression::Symbol;
use Moose;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
use Params::Validate qw/validate_pos/;
use MooseX::ClassAttribute;
class_has signature => (
is => 'ro',
- default => sub { { symbol => PIE::FunctionArgument->new( name => 'symbol', type => 'Str')}});
+ default => sub { { symbol => Lorzy::FunctionArgument->new( name => 'symbol', type => 'Str')}});
sub evaluate {
- my ($self, $eval) = validate_pos(@_, { isa => 'PIE::Expression'}, { isa => 'PIE::Evaluator'});
+ my ($self, $eval) = validate_pos(@_, { isa => 'Lorzy::Expression'}, { isa => 'Lorzy::Evaluator'});
my $symbol = $self->{'args'}->{'symbol'}->evaluate($eval);
my $result = $eval->resolve_symbol_name($symbol);
- return ref($result) && $result->meta->does_role('PIE::Evaluatable') ? $result->evaluate($eval): $result; # XXX: figure out evaluation order here
+ return ref($result) && $result->meta->does_role('Lorzy::Evaluatable') ? $result->evaluate($eval): $result; # XXX: figure out evaluation order here
}
-package PIE::Expression::List;
+package Lorzy::Expression::List;
use Moose;
-extends 'PIE::Expression::ProgN';
+extends 'Lorzy::Expression::ProgN';
sub evaluate {
my ($self, $evaluator) = @_;
- return bless \$self->nodes, 'PIE::EvaluatorResult::RunTime';
+ return bless \$self->nodes, 'Lorzy::EvaluatorResult::RunTime';
}
-package PIE::Expression::ForEach;
+package Lorzy::Expression::ForEach;
use Moose;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
use MooseX::ClassAttribute;
class_has signature => (
is => 'ro',
- default => sub { { list => PIE::FunctionArgument->new( name => 'list'),
- binding => PIE::FunctionArgument->new( name => 'Str'),
- do => PIE::FunctionArgument->new( name => 'Str', type => 'PIE::Lambda'), # XXX: type for runtime?
+ default => sub { { list => Lorzy::FunctionArgument->new( name => 'list'),
+ binding => Lorzy::FunctionArgument->new( name => 'Str'),
+ do => Lorzy::FunctionArgument->new( name => 'Str', type => 'Lorzy::Lambda'), # XXX: type for runtime?
}});
sub evaluate {
my ($self, $evaluator) = @_;
my $lambda = $self->args->{do}->evaluate($evaluator);
- die unless $lambda->isa("PIE::Lambda");
+ die unless $lambda->isa("Lorzy::Lambda");
my $binding = $self->args->{binding}->evaluate($evaluator);
my $list = $self->args->{list}->evaluate($evaluator);
- die unless ref($list) eq 'PIE::EvaluatorResult::RunTime';
+ die unless ref($list) eq 'Lorzy::EvaluatorResult::RunTime';
my $nodes = $$list;
foreach (@$nodes) {
@@ -200,21 +200,21 @@
}
-package PIE::Expression::Symbol;
+package Lorzy::Expression::Symbol;
use Moose;
-extends 'PIE::Expression';
+extends 'Lorzy::Expression';
use Params::Validate qw/validate_pos/;
use MooseX::ClassAttribute;
class_has signature => (
is => 'ro',
- default => sub { { symbol => PIE::FunctionArgument->new( name => 'symbol', type => 'Str')}});
+ default => sub { { symbol => Lorzy::FunctionArgument->new( name => 'symbol', type => 'Str')}});
-package PIE::Expression::Let;
+package Lorzy::Expression::Let;
use Moose;
-extends 'PIE::Expression::ProgN';
-with 'PIE::Block';
+extends 'Lorzy::Expression::ProgN';
+with 'Lorzy::Block';
has bindings => (
is => 'rw',
@@ -224,12 +224,12 @@
has lambda => (
is => 'ro',
- isa => 'PIE::Lambda',
+ isa => 'Lorzy::Lambda',
lazy => 1,
default => sub {
my $self = shift;
- PIE::Lambda->new(
- progn => PIE::Expression::ProgN->new( nodes => $self->nodes ),
+ Lorzy::Lambda->new(
+ progn => Lorzy::Expression::ProgN->new( nodes => $self->nodes ),
signature => $self->mk_signature,
block_id => $self->block_id,
outer_block => $self->outer_block,
@@ -250,7 +250,7 @@
sub mk_signature {
my $self = shift;
- return { map { $_ => PIE::FunctionArgument->new( name => $_, type => 'Str') } keys %{ $self->bindings } };
+ return { map { $_ => Lorzy::FunctionArgument->new( name => $_, type => 'Str') } keys %{ $self->bindings } };
}
sub evaluate {
Modified: Lorzy/trunk/lib/Lorzy/FunctionArgument.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/FunctionArgument.pm (original)
+++ Lorzy/trunk/lib/Lorzy/FunctionArgument.pm Tue Jul 8 10:55:20 2008
@@ -1,4 +1,4 @@
-package PIE::FunctionArgument;
+package Lorzy::FunctionArgument;
use Moose;
@@ -11,7 +11,7 @@
has type => (
is => 'rw',
- isa => 'Str'# I want an enum of String, Number, Undef, PIE::Expression..what else?
+ isa => 'Str'# I want an enum of String, Number, Undef, Lorzy::Expression..what else?
);
has description => (
Modified: Lorzy/trunk/lib/Lorzy/Lambda.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Lambda.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Lambda.pm Tue Jul 8 10:55:20 2008
@@ -1,20 +1,20 @@
-package PIE::Lambda;
+package Lorzy::Lambda;
use Moose; use MooseX::Params::Validate;
-with 'PIE::Block';
+with 'Lorzy::Block';
has progn => (
is => 'ro',
- isa => 'PIE::Expression::ProgN',
- default => sub { PIE::Expression::ProgN->new },
+ isa => 'Lorzy::Expression::ProgN',
+ default => sub { Lorzy::Expression::ProgN->new },
handles => [qw(nodes)]
);
has signature => (
is => 'rw',
default => sub { {} },
- isa => 'HashRef[PIE::FunctionArgument]');
+ isa => 'HashRef[Lorzy::FunctionArgument]');
sub check_args {
my $self = shift;
Modified: Lorzy/trunk/lib/Lorzy/Lambda/Native.pm
==============================================================================
--- /Lorzy/trunk/lib/PIE/Lambda/Native.pm (original)
+++ Lorzy/trunk/lib/Lorzy/Lambda/Native.pm Tue Jul 8 10:55:20 2008
@@ -1,9 +1,9 @@
-package PIE::Lambda::Native;
+package Lorzy::Lambda::Native;
use Moose;
use YAML;
use Scalar::Defer;
-extends 'PIE::Lambda';
+extends 'Lorzy::Lambda';
has body => (
is => 'ro',
Modified: Lorzy/trunk/t/01basic.t
==============================================================================
--- Lorzy/trunk/t/01basic.t (original)
+++ Lorzy/trunk/t/01basic.t Tue Jul 8 10:55:20 2008
@@ -1,72 +1,72 @@
use Test::More qw'no_plan';
use strict;
-use_ok('PIE::Expression');
-use_ok('PIE::Evaluator');
-use_ok('PIE::Lambda');
-use_ok('PIE::Lambda::Native');
-use_ok('PIE::Builder');
-use_ok('PIE::FunctionArgument');
-my $trivial = PIE::Expression::True->new;
+use_ok('Lorzy::Expression');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Lambda');
+use_ok('Lorzy::Lambda::Native');
+use_ok('Lorzy::Builder');
+use_ok('Lorzy::FunctionArgument');
+my $trivial = Lorzy::Expression::True->new;
-my $evaluator = PIE::Evaluator->new;
+my $evaluator = Lorzy::Evaluator->new;
ok( $evaluator->run($trivial) );
ok( $evaluator->result->success );
ok( $evaluator->result->value );
-my $false = PIE::Expression::False->new();
-my $eval2 = PIE::Evaluator->new;
+my $false = Lorzy::Expression::False->new();
+my $eval2 = Lorzy::Evaluator->new;
ok( $eval2->run($false) );
ok( !$eval2->result->value );
ok( $eval2->result->success );
-my $if_true = PIE::Expression::IfThen->new( args => {
- condition => PIE::Expression::True->new(),
- if_true => PIE::Expression::True->new(),
- if_false => PIE::Expression::False->new()}
+my $if_true = Lorzy::Expression::IfThen->new( args => {
+ condition => Lorzy::Expression::True->new(),
+ if_true => Lorzy::Expression::True->new(),
+ if_false => Lorzy::Expression::False->new()}
);
-my $eval3 = PIE::Evaluator->new();
+my $eval3 = Lorzy::Evaluator->new();
ok( $eval3->run($if_true) );
ok( $eval3->result->value );
ok( $eval3->result->success, $eval3->result->error );
-my $if_false = PIE::Expression::IfThen->new( args => {
- condition => PIE::Expression::False->new(),
- if_true => PIE::Expression::True->new(),
- if_false => PIE::Expression::False->new()}
+my $if_false = Lorzy::Expression::IfThen->new( args => {
+ condition => Lorzy::Expression::False->new(),
+ if_true => Lorzy::Expression::True->new(),
+ if_false => Lorzy::Expression::False->new()}
);
-my $eval4 = PIE::Evaluator->new();
+my $eval4 = Lorzy::Evaluator->new();
ok( $eval4->run($if_false) );
ok( !$eval4->result->value );
ok( $eval4->result->success );
-my $script = PIE::Lambda->new(
- progn => PIE::Expression::ProgN->new(
+my $script = Lorzy::Lambda->new(
+ progn => Lorzy::Expression::ProgN->new(
nodes => [
- PIE::Expression::True->new()
+ Lorzy::Expression::True->new()
]),
);
-my $eval7 = PIE::Evaluator->new();
+my $eval7 = Lorzy::Evaluator->new();
$eval7->apply_script($script, {} );
ok( $eval7->result->success );
ok( $eval7->result->value );
-my $script2 = PIE::Lambda->new(
- progn => PIE::Expression::ProgN->new(
+my $script2 = Lorzy::Lambda->new(
+ progn => Lorzy::Expression::ProgN->new(
nodes => [$if_true] ) );
-my $eval8 = PIE::Evaluator->new();
+my $eval8 = Lorzy::Evaluator->new();
$eval8->apply_script($script2, {});
ok( $eval8->result->success );
ok( $eval8->result->value );
-my $eval9 = PIE::Evaluator->new();
+my $eval9 = Lorzy::Evaluator->new();
-my $MATCH_REGEX = PIE::Lambda::Native->new(
+my $MATCH_REGEX = Lorzy::Lambda::Native->new(
body => sub {
my $args = shift;
my $arg = $args->{'tested-string'};
@@ -75,8 +75,8 @@
},
signature => {
- 'tested-string' => PIE::FunctionArgument->new( name => 'tested-string' => type => 'Str'),
- 'regexp' => PIE::FunctionArgument->new( name => 'regexp', type => 'Str' )
+ 'tested-string' => Lorzy::FunctionArgument->new( name => 'tested-string' => type => 'Str'),
+ 'regexp' => Lorzy::FunctionArgument->new( name => 'regexp', type => 'Str' )
}
);
@@ -85,16 +85,16 @@
$eval9->apply_script(
$MATCH_REGEX,
- { 'tested-string' => PIE::Expression::String->new( args => {value => 'I do love software'} ),
- 'regexp' => PIE::Expression::String->new( args => { value => 'software' })
+ { 'tested-string' => Lorzy::Expression::String->new( args => {value => 'I do love software'} ),
+ 'regexp' => Lorzy::Expression::String->new( args => { value => 'software' })
}
);
ok( $eval9->result->success, $eval9->result->error );
is( $eval9->result->value, 1 );
-my $builder = PIE::Builder->new();
-my $eval10 = PIE::Evaluator->new();
+my $builder = Lorzy::Builder->new();
+my $eval10 = Lorzy::Evaluator->new();
$eval10->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
$eval10->apply_script(
Modified: Lorzy/trunk/t/builder.t
==============================================================================
--- Lorzy/trunk/t/builder.t (original)
+++ Lorzy/trunk/t/builder.t Tue Jul 8 10:55:20 2008
@@ -1,11 +1,11 @@
use Test::More qw'no_plan';
use strict;
-use_ok('PIE::Expression');
-use_ok('PIE::Evaluator');
-use_ok('PIE::Builder');
+use_ok('Lorzy::Expression');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Builder');
-my $builder = PIE::Builder->new();
-my $eval = PIE::Evaluator->new();
+my $builder = Lorzy::Builder->new();
+my $eval = Lorzy::Evaluator->new();
#$eval->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
my $script = $builder->defun(
@@ -33,13 +33,13 @@
'signature' => {},
'name' => 'True',
'args' => {}
- }, 'PIE::Expression::True' ),
+ }, 'Lorzy::Expression::True' ),
bless( {
'signature' => {},
'name' => 'False',
'args' => {}
- }, 'PIE::Expression::False' )
+ }, 'Lorzy::Expression::False' )
]
- }, 'PIE::Expression::ProgN' )
+ }, 'Lorzy::Expression::ProgN' )
] );
Modified: Lorzy/trunk/t/hello_world.t
==============================================================================
--- Lorzy/trunk/t/hello_world.t (original)
+++ Lorzy/trunk/t/hello_world.t Tue Jul 8 10:55:20 2008
@@ -1,8 +1,8 @@
use Test::More tests => 14;
-use_ok('PIE::Evaluator');
-use_ok('PIE::Builder');
-use_ok('PIE::FunctionArgument');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Builder');
+use_ok('Lorzy::FunctionArgument');
package Hello;
@@ -11,9 +11,9 @@
has 'evaluator' => (
is => 'rw',
- isa => 'PIE::Evaluator',
+ isa => 'Lorzy::Evaluator',
lazy => 1,
- default => sub { return PIE::Evaluator->new() },
+ default => sub { return Lorzy::Evaluator->new() },
);
has 'rules' => (
@@ -32,7 +32,7 @@
my $self = shift;
my $name = shift;
- my $args = { name => PIE::Expression::String->new( args => { value => $name } ) };
+ my $args = { name => Lorzy::Expression::String->new( args => { value => $name } ) };
for ( @{ $self->rules || [] } ) {
$self->evaluator->apply_script( $_, $args);
@@ -50,64 +50,64 @@
my $hello = Hello->new;
isa_ok( $hello => 'Hello' );
-use PIE::Lambda::Native;
+use Lorzy::Lambda::Native;
$hello->evaluator->set_global_symbol( 'make-fred',
- PIE::Lambda::Native->new( body => sub { return 'fred' } ) );
+ Lorzy::Lambda::Native->new( body => sub { return 'fred' } ) );
$hello->evaluator->set_global_symbol( 'make-bob',
- PIE::Lambda::Native->new( body => sub { return 'bob' } ) );
+ Lorzy::Lambda::Native->new( body => sub { return 'bob' } ) );
$hello->evaluator->set_global_symbol(
'make-whoever',
- PIE::Lambda::Native->new(
+ Lorzy::Lambda::Native->new(
body => sub { my $args = shift; return $args->{'name'} },
signature => {
- name => PIE::FunctionArgument->new( name => 'name', type => 'Str' )
+ name => Lorzy::FunctionArgument->new( name => 'name', type => 'Str' )
}
)
);
my $tree = [ { name => 'make-fred' } ];
-my $builder = PIE::Builder->new();
+my $builder = Lorzy::Builder->new();
my $script = $builder->defun(
ops => $tree,
signature =>
- { name => PIE::FunctionArgument->new( name => 'name', type => 'Str' ) }
+ { name => Lorzy::FunctionArgument->new( name => 'name', type => 'Str' ) }
);
$hello->rules( [$script] );
-isa_ok( $hello->rules->[0], 'PIE::Lambda' );
+isa_ok( $hello->rules->[0], 'Lorzy::Lambda' );
is( $hello->run('jesse'), 'Hello fred' );
my $script2 = $builder->defun(
ops => [ { name => 'make-bob' }, { name => 'make-fred' } ],
signature =>
- { name => PIE::FunctionArgument->new( name => 'name', type => 'Str' ) }
+ { name => Lorzy::FunctionArgument->new( name => 'name', type => 'Str' ) }
);
$hello->rules( [$script2] );
-isa_ok( $hello->rules->[0], 'PIE::Lambda' );
+isa_ok( $hello->rules->[0], 'Lorzy::Lambda' );
is( $hello->run('jesse'), 'Hello fred' );
my $script3 = $builder->defun(
ops => [ { name => 'make-bob' } ],
signature =>
- { name => PIE::FunctionArgument->new( name => 'name', type => 'Str' ) }
+ { name => Lorzy::FunctionArgument->new( name => 'name', type => 'Str' ) }
);
my $script4 = $builder->defun(
ops => [ { name => 'make-fred' } ],
signature =>
- { name => PIE::FunctionArgument->new( name => 'name', type => 'Str' ) }
+ { name => Lorzy::FunctionArgument->new( name => 'name', type => 'Str' ) }
);
$hello->rules( [ $script3, $script4 ] );
-isa_ok( $hello->rules->[0], 'PIE::Lambda' );
-isa_ok( $hello->rules->[1], 'PIE::Lambda' );
+isa_ok( $hello->rules->[0], 'Lorzy::Lambda' );
+isa_ok( $hello->rules->[1], 'Lorzy::Lambda' );
is( $hello->run('jesse'), 'Hello fred' );
$hello->rules( [ $hello->evaluator->get_global_symbol('make-whoever') ] );
-isa_ok( $hello->rules->[0], 'PIE::Lambda' );
+isa_ok( $hello->rules->[0], 'Lorzy::Lambda' );
is( $hello->run('jesse'), 'Hello jesse' );
1;
Modified: Lorzy/trunk/t/introspection.t
==============================================================================
--- Lorzy/trunk/t/introspection.t (original)
+++ Lorzy/trunk/t/introspection.t Tue Jul 8 10:55:20 2008
@@ -1,22 +1,22 @@
#!/usr/bin/perl
use Test::More qw/no_plan/;
-use_ok('PIE::Evaluator');
-use_ok('PIE::Lambda::Native');
-my $e = PIE::Evaluator->new();
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Lambda::Native');
+my $e = Lorzy::Evaluator->new();
my $signatures = $e->core_expression_signatures;
-is_deeply($signatures->{'PIE::Expression::True'} , {});
-is_deeply($signatures->{'PIE::Expression::IfThen'} , { if_true => { type => 'PIE::Evaluatable'},
- if_false => {type => 'PIE::Evaluatable'},
- condition => {type => 'PIE::Evaluatable'}
+is_deeply($signatures->{'Lorzy::Expression::True'} , {});
+is_deeply($signatures->{'Lorzy::Expression::IfThen'} , { if_true => { type => 'Lorzy::Evaluatable'},
+ if_false => {type => 'Lorzy::Evaluatable'},
+ condition => {type => 'Lorzy::Evaluatable'}
});
my $symbols = $e->symbol_signatures();
is_deeply($symbols, {});
-my $MATCH_REGEX = PIE::Lambda::Native->new(
+my $MATCH_REGEX = Lorzy::Lambda::Native->new(
body => sub {
my $args = shift;
my $arg = $args->{'tested-string'};
@@ -25,8 +25,8 @@
},
signature => {
- 'tested-string' => PIE::FunctionArgument->new( name => 'tested-string' => type => 'Str'),
- 'regexp' => PIE::FunctionArgument->new( name => 'regexp', type => 'Str' )
+ 'tested-string' => Lorzy::FunctionArgument->new( name => 'tested-string' => type => 'Str'),
+ 'regexp' => Lorzy::FunctionArgument->new( name => 'regexp', type => 'Str' )
}
);
Modified: Lorzy/trunk/t/leaky-lexicals.t
==============================================================================
--- Lorzy/trunk/t/leaky-lexicals.t (original)
+++ Lorzy/trunk/t/leaky-lexicals.t Tue Jul 8 10:55:20 2008
@@ -1,17 +1,17 @@
use Test::More qw'no_plan';
use strict;
-use_ok('PIE::Expression');
-use_ok('PIE::Evaluator');
-use_ok('PIE::Lambda');
-use_ok('PIE::Lambda::Native');
-use_ok('PIE::Builder');
-use_ok('PIE::FunctionArgument');
+use_ok('Lorzy::Expression');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Lambda');
+use_ok('Lorzy::Lambda::Native');
+use_ok('Lorzy::Builder');
+use_ok('Lorzy::FunctionArgument');
-my $eval = PIE::Evaluator->new;
-my $builder = PIE::Builder->new();
+my $eval = Lorzy::Evaluator->new;
+my $builder = Lorzy::Builder->new();
-my $A_SIDE = PIE::Builder->defun(
+my $A_SIDE = Lorzy::Builder->defun(
ops => [
{ name => 'Symbol', args => { symbol => 'x'}},
@@ -19,7 +19,7 @@
],
- signature => { x => PIE::FunctionArgument->new(name => 'x', type => 'Str')});
+ signature => { x => Lorzy::FunctionArgument->new(name => 'x', type => 'Str')});
$eval->set_global_symbol( 'a' => $A_SIDE );
@@ -27,7 +27,7 @@
my $defined_b = $builder->defun(
ops => [{ name => 'a', args => { x => 'x456' }} ],
signature =>
- { y => PIE::FunctionArgument->new( name => 'y', type => 'String' ) }
+ { y => Lorzy::FunctionArgument->new( name => 'y', type => 'String' ) }
);
$eval->set_global_symbol( b=> $defined_b);
Modified: Lorzy/trunk/t/let.t
==============================================================================
--- Lorzy/trunk/t/let.t (original)
+++ Lorzy/trunk/t/let.t Tue Jul 8 10:55:20 2008
@@ -1,13 +1,13 @@
use Test::More tests => 13;
use strict;
-use_ok('PIE::Expression');
-use_ok('PIE::Evaluator');
-use_ok('PIE::Builder');
-use_ok('PIE::Lambda::Native');
-use_ok('PIE::FunctionArgument');
+use_ok('Lorzy::Expression');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Builder');
+use_ok('Lorzy::Lambda::Native');
+use_ok('Lorzy::FunctionArgument');
use Test::Exception;
-my $MATCH_REGEX = PIE::Lambda::Native->new(
+my $MATCH_REGEX = Lorzy::Lambda::Native->new(
body => sub {
my $args = shift;
my $arg = $args->{'tested-string'};
@@ -16,14 +16,14 @@
},
signature => {
- 'tested-string' => PIE::FunctionArgument->new( name => 'tested-string' => type => 'Str'),
- 'regexp' => PIE::FunctionArgument->new( name => 'regexp', type => 'Str' )
+ 'tested-string' => Lorzy::FunctionArgument->new( name => 'tested-string' => type => 'Str'),
+ 'regexp' => Lorzy::FunctionArgument->new( name => 'regexp', type => 'Str' )
}
);
-my $builder = PIE::Builder->new();
-my $eval = PIE::Evaluator->new();
+my $builder = Lorzy::Builder->new();
+my $eval = Lorzy::Evaluator->new();
$eval->set_global_symbol( 'match-regexp' => $MATCH_REGEX );
my $script =
@@ -48,15 +48,15 @@
}
}
] } } ],
- signature => { 'tested-string' => PIE::FunctionArgument->new( name => 'tested-string' => type => 'Str' ) },
+ signature => { 'tested-string' => Lorzy::FunctionArgument->new( name => 'tested-string' => type => 'Str' ) },
);
is(scalar @{$script->progn->nodes}, 1);
-isa_ok($script->progn->nodes->[0], 'PIE::Expression::Let');
+isa_ok($script->progn->nodes->[0], 'Lorzy::Expression::Let');
is(scalar @{$script->progn->nodes->[0]->nodes}, 1);
ok(exists $script->progn->nodes->[0]->bindings->{REGEXP});
-isa_ok($script->progn->nodes->[0]->bindings->{REGEXP}, 'PIE::Expression');
+isa_ok($script->progn->nodes->[0]->bindings->{REGEXP}, 'Lorzy::Expression');
lives_ok {
Modified: Lorzy/trunk/t/list.t
==============================================================================
--- Lorzy/trunk/t/list.t (original)
+++ Lorzy/trunk/t/list.t Tue Jul 8 10:55:20 2008
@@ -1,13 +1,13 @@
use Test::More tests => 6;
use strict;
-use_ok('PIE::Expression');
-use_ok('PIE::Evaluator');
-use_ok('PIE::Builder');
-use_ok('PIE::Lambda::Native');
-use_ok('PIE::FunctionArgument');
+use_ok('Lorzy::Expression');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::Builder');
+use_ok('Lorzy::Lambda::Native');
+use_ok('Lorzy::FunctionArgument');
use Test::Exception;
-my $builder = PIE::Builder->new();
-my $eval = PIE::Evaluator->new();
+my $builder = Lorzy::Builder->new();
+my $eval = Lorzy::Evaluator->new();
my $script =
$builder->defun(
@@ -24,7 +24,7 @@
my @remembered;
$eval->set_global_symbol( 'remember' =>
-PIE::Lambda::Native->new(
+Lorzy::Lambda::Native->new(
body => sub {
my $args = shift;
push @remembered, $args->{what};
@@ -32,7 +32,7 @@
},
signature => {
- 'what' => PIE::FunctionArgument->new( name => 'what' => type => 'Str'),
+ 'what' => Lorzy::FunctionArgument->new( name => 'what' => type => 'Str'),
}
) );
Modified: Lorzy/trunk/t/named-params.t
==============================================================================
--- Lorzy/trunk/t/named-params.t (original)
+++ Lorzy/trunk/t/named-params.t Tue Jul 8 10:55:20 2008
@@ -2,12 +2,12 @@
use warnings;
use strict;
-use_ok('PIE::Lambda');
-use_ok('PIE::Lambda::Native');
-use_ok('PIE::Expression');
-use_ok('PIE::Evaluator');
-use_ok('PIE::FunctionArgument');
-my $MATCH_REGEX = PIE::Lambda::Native->new(
+use_ok('Lorzy::Lambda');
+use_ok('Lorzy::Lambda::Native');
+use_ok('Lorzy::Expression');
+use_ok('Lorzy::Evaluator');
+use_ok('Lorzy::FunctionArgument');
+my $MATCH_REGEX = Lorzy::Lambda::Native->new(
body => sub {
my $args = shift;
my $arg = $args->{'tested-string'};
@@ -17,19 +17,19 @@
},
signature => {
- 'tested-string' => PIE::FunctionArgument->new( name => 'tested-string' => type => 'Str' ),
- 'regex'=> PIE::FunctionArgument->new( name => 'regex', type => 'Str' )
+ 'tested-string' => Lorzy::FunctionArgument->new( name => 'tested-string' => type => 'Str' ),
+ 'regex'=> Lorzy::FunctionArgument->new( name => 'regex', type => 'Str' )
}
);
-my $eval5 = PIE::Evaluator->new;
+my $eval5 = Lorzy::Evaluator->new;
$eval5->set_global_symbol( 'match-regex' => $MATCH_REGEX );
-my $match_p = PIE::Expression->new(
+my $match_p = Lorzy::Expression->new(
name => 'match-regex',
args => {
- 'tested-string' => PIE::Expression::String->new( args => {value => 'I do love software'} ),
- 'regex' => PIE::Expression::String->new( args => { value => 'software' } )
+ 'tested-string' => Lorzy::Expression::String->new( args => {value => 'I do love software'} ),
+ 'regex' => Lorzy::Expression::String->new( args => { value => 'software' } )
}
);
@@ -38,15 +38,15 @@
is( $eval5->result->value, 1 );
-my $eval6 = PIE::Evaluator->new();
+my $eval6 = Lorzy::Evaluator->new();
$eval6->set_global_symbol( 'match-regex' => $MATCH_REGEX );
-my $match_fail_p = PIE::Expression->new(
+my $match_fail_p = Lorzy::Expression->new(
name => 'match-regex',
args => {
- 'tested-string' => PIE::Expression::String->new( args => { value => 'I do love hardware' }),
- 'regex' => PIE::Expression::String->new( args => { value => 'software'} )
+ 'tested-string' => Lorzy::Expression::String->new( args => { value => 'I do love hardware' }),
+ 'regex' => Lorzy::Expression::String->new( args => { value => 'software'} )
}
);
@@ -55,11 +55,11 @@
ok( !$eval6->result->value );
-my $match_orz = PIE::Expression->new(
+my $match_orz = Lorzy::Expression->new(
name => 'match-regex',
args => {
- 'tested-string' => PIE::Expression::String->new( args => { value => 'I do love software'} ),
- 'wrong-param-name' => PIE::Expression::String->new( args => { value => 'software' }),
+ 'tested-string' => Lorzy::Expression::String->new( args => { value => 'I do love software'} ),
+ 'wrong-param-name' => Lorzy::Expression::String->new( args => { value => 'software' }),
}
);
More information about the Bps-public-commit
mailing list