From d544c2f4bb2964ee757c2a5e148cac452c77ced1 Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com> Date: Sun, 1 Dec 2013 17:21:05 -0800 Subject: [PATCH] sequence is still segfaulting; its inner parsers seem to be getting corrupted somehow --- src/bindings/php/Tests/EndTest.php | 8 ++------ src/bindings/swig/hammer.i | 22 +++++++++------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/bindings/php/Tests/EndTest.php b/src/bindings/php/Tests/EndTest.php index 55e05b82..92e49650 100644 --- a/src/bindings/php/Tests/EndTest.php +++ b/src/bindings/php/Tests/EndTest.php @@ -12,17 +12,13 @@ class EndPTest extends PHPUnit_Framework_TestCase public function testSuccess() { - echo 'in testSuccess\n'; -// $result = h_parse($this->parser, "a"); - // TODO: fixme when h_ch is fixed -// $this->assertEquals(98, $result); + $result = h_parse($this->parser, "a"); + $this->assertEquals("a", $result); } -/* public function testFailure() { $result = h_parse($this->parser, "aa"); $this->assertEquals(NULL, $result); } -*/ } ?> \ No newline at end of file diff --git a/src/bindings/swig/hammer.i b/src/bindings/swig/hammer.i index be696751..eb6428a5 100644 --- a/src/bindings/swig/hammer.i +++ b/src/bindings/swig/hammer.i @@ -549,22 +549,18 @@ function ch($ch) return h_ch($ch); } +function choice() +{ + $arg_list = func_get_args(); + $arg_list[] = NULL; + return h_choice__a($arg_list); +} + function sequence() { - echo 'in sequence\n'; - $numargs = func_num_args(); $arg_list = func_get_args(); - var_dump($arg_list); - for ($i = 0; $i < $numargs; $i++) - { - var_dump($arg_list[$i] instanceof _p_HParser_); - if (! $arg_list[$i] instanceof _p_HParser_) - { - echo 'PHP says that is not an HParser!'; - return NULL; - } - } - //return hammer::h_sequence__a($arg_list); + $arg_list[] = NULL; + return h_sequence__a($arg_list); } " #endif -- GitLab