Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make grammar pass new testml tests.

  • Loading branch information...
commit a689d2f315b08d94d1e227c7b801ea4cf765209c 1 parent 83472ba
Ingy döt Net authored
Showing with 14 additions and 15 deletions.
  1. +2 −5 lib/TestML/Parser.pm
  2. +10 −8 lib/TestML/Parser/Grammar.pm
  3. +2 −2 t/Bridge.pm
7 lib/TestML/Parser.pm
View
@@ -110,6 +110,7 @@ method point_call($/) {
}
method transform_call($/) {
+ @expression_stack.pop();
my $transform_name = ~$<transform_name>;
my $transform = TestML::Transform.new(
name => $transform_name,
@@ -118,7 +119,7 @@ method transform_call($/) {
@expression_stack[*-1].transforms.push($transform);
}
-method transform_argument_list_start($/) {
+method transform_name($/) {
@expression_stack.push(TestML::Expression.new);
$transform_arguments = [];
}
@@ -128,10 +129,6 @@ method transform_argument($/) {
@expression_stack.push(TestML::Expression.new);
}
-method transform_argument_list_stop($/) {
- @expression_stack.pop();
-}
-
method string_call($/) {
my $string = $<quoted_string>.ast;
my $transform = TestML::Transform.new(
18 lib/TestML/Parser/Grammar.pm
View
@@ -155,13 +155,7 @@ token string_call {
token transform_call {
<transform_name>
- '('
- <transform_argument_list_start>
- <wspace>*
- <transform_argument_list>
- <wspace>*
- <transform_argument_list_stop>
- ')'
+ <transform_argument_list>?
}
token transform_name {
@@ -191,7 +185,15 @@ token constant_call {
token transform_argument_list_start { <ALWAYS> }
token transform_argument_list {
- [ <transform_argument> [ <wspace>* ',' <wspace>* <transform_argument> ]* ]?
+ '('
+ <wspace>*
+ <transform_arguments>?
+ <wspace>*
+ ')'
+}
+
+token transform_arguments {
+ <transform_argument> [ <wspace>* ',' <wspace>* <transform_argument> ]*
}
token transform_argument_list_stop { <ALWAYS> }
4 t/Bridge.pm
View
@@ -11,8 +11,8 @@ our sub my_thing($this) {
return $str.split("\n").join(' - ');
}
-our sub combine($this, $suffix) {
- return $this.value ~ ' ' ~ $suffix.value;
+our sub combine {
+ return @_.map({$_.value}).join(' ');
}
our sub parse_testml($this) {
Please sign in to comment.
Something went wrong with that request. Please try again.