From: Robin Edwards Date: Thu, 18 Feb 2010 14:36:10 +0000 (+0000) Subject: added new idea for a usecase X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d554fe7d3007c1d51d843294a8f0332e1d831d58;p=p5sagit%2FDevel-Declare-Keyword.git added new idea for a usecase --- diff --git a/examples/Perl6If.pm b/examples/Perl6If.pm new file mode 100644 index 0000000..49b7f95 --- /dev/null +++ b/examples/Perl6If.pm @@ -0,0 +1,28 @@ +package SQL; +use lib 'lib/'; +use Keyword qw/debug/; +use Carp; +use Data::Dumper; + +our $DBH; + +keyword if (if) { +} + +parse if ($kd) { + my $stmt = $kd->strip_to_char('{'); +# $kd->terminate; + + my ($exp) =~ /if\s+(.+)\s*{/; + + $kd->line("if ($exp) {"); + + return $exp; +} + +action sql ($exp) { + return $exp; +} + + +1; diff --git a/t/usecase/if.t b/t/usecase/if.t new file mode 100644 index 0000000..fa5c515 --- /dev/null +++ b/t/usecase/if.t @@ -0,0 +1,17 @@ +use Test::More qw/no_plan/; +use strict; +use warnings; +use lib 'examples/'; +use Perl6If; +use Data::Dumper; + +ok 1; + +if 1 { + ok 1 ; +} +else { + nok 1; +} + +ok 1;