Permalink
Browse files

Gist example of Marpa::R2 AST

  • Loading branch information...
Jeffrey Kegler
Jeffrey Kegler committed Feb 10, 2013
1 parent 6e09331 commit e3aeba3d8cbf178c873061807b99878c1d38788e
Showing with 3 additions and 10 deletions.
  1. +3 −10 gist/ast/ast.pl
View
@@ -124,25 +124,18 @@ sub doit {
my $value = my_parser( $grammar, \$input );
my $ast_dump = Data::Dumper::Dumper($value);
my $result = doit($value);
- Test::More::is( $ast_dump, $expected_ast_dump, 'AST of scannerless parse' );
- Test::More::is( $result, $expected_output, 'Value of scannerless parse' );
+ Test::More::is( $ast_dump, $expected_ast_dump, 'AST' );
+ Test::More::is( $result, $expected_output, qq{Value of "$input"} );
}
TEST2: {
my $input = '42*2+7/3, 42*(2+7)/3, 2**7-3, 2**(7-3)';
my $output_re = qr/\A 86[.]3\d+ \s+ 126 \s+ 125 \s+ 16\z/xms;
my $value = my_parser( $grammar, \$input );
my $result = doit($value);
- Test::More::like( $result, $output_re, 'Value of scannerless parse' );
+ Test::More::like( $result, $output_re, qq{Value of "$input"} );
}
-# TODO: {
- # local $TODO = 'Work in progress';
- # say Data::Dumper::Dumper(doit($value));
- # my $actual = Data::Dumper::Dumper($value);
- # Test::More::is( $actual, '', 'Value' );
-# }
-
package My_Nodes::script;
sub doit { return join q{ }, @_; }

0 comments on commit e3aeba3

Please sign in to comment.