diff --git a/src/bindings/php/Tests/ActionTest.php b/src/bindings/php/Tests/ActionTest.php index 2912533a10e7880f426f663c772c373054b70531..f4e6a5632cf463c4314e60719e6056e45eb380b9 100644 --- a/src/bindings/php/Tests/ActionTest.php +++ b/src/bindings/php/Tests/ActionTest.php @@ -19,20 +19,20 @@ class ActionTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = action(sequence(choice(ch("a"), ch("A")), choice(ch("b"), ch("B"))), "actTest"); + $this->parser = hammer_action(hammer_sequence(hammer_choice(hammer_ch("a"), hammer_ch("A")), hammer_choice(hammer_ch("b"), hammer_ch("B"))), "actTest"); } public function testSuccess() { - $result1 = h_parse($this->parser, "ab"); - $result2 = h_parse($this->parser, "AB"); - $result3 = h_parse($this->parser, "aB"); + $result1 = hammer_parse($this->parser, "ab"); + $result2 = hammer_parse($this->parser, "AB"); + $result3 = hammer_parse($this->parser, "aB"); $this->assertEquals(["A", "B"], $result1); $this->assertEquals(["A", "B"], $result2); $this->assertEquals(["A", "B"], $result3); } public function testFailure() { - $result = h_parse($this->parser, "XX"); + $result = hammer_parse($this->parser, "XX"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/AndTest.php b/src/bindings/php/Tests/AndTest.php index 03f92582040b5f02fd3b5898b31801c8c49dec16..91cb1156c2392ddf8aa14a3f1c2ef2ec4cff96c2 100644 --- a/src/bindings/php/Tests/AndTest.php +++ b/src/bindings/php/Tests/AndTest.php @@ -9,26 +9,26 @@ class AndTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser1 = sequence(h_and(ch("0")), ch("0")); - $this->parser2 = sequence(h_and(ch("0")), ch("1")); - $this->parser3 = sequence(ch("1"), h_and(ch("2"))); + $this->parser1 = hammer_sequence(hammer_and(hammer_ch("0")), hammer_ch("0")); + $this->parser2 = hammer_sequence(hammer_and(hammer_ch("0")), hammer_ch("1")); + $this->parser3 = hammer_sequence(hammer_ch("1"), hammer_and(hammer_ch("2"))); } public function testSuccess1() { - $result = h_parse($this->parser1, "0"); + $result = hammer_parse($this->parser1, "0"); $this->assertEquals(array("0"), $result); } public function testFailure2() { - $result = h_parse($this->parser2, "0"); + $result = hammer_parse($this->parser2, "0"); $this->assertEquals(NULL, $result); } public function testSuccess3() { - $result = h_parse($this->parser3, "12"); + $result = hammer_parse($this->parser3, "12"); $this->assertEquals(array("1"), $result); } } diff --git a/src/bindings/php/Tests/ButNotTest.php b/src/bindings/php/Tests/ButNotTest.php index 9f8117a3de9f0be9b0892715ad2a65573d5e60a2..f1af3dd74aade6ac44eb78a1bbbc6a8f86696d2b 100644 --- a/src/bindings/php/Tests/ButNotTest.php +++ b/src/bindings/php/Tests/ButNotTest.php @@ -8,27 +8,27 @@ class ButNotTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser1 = h_butnot(ch("a"), h_token("ab")); - $this->parser2 = h_butnot(h_ch_range('0', '9'), ch('6')); + $this->parser1 = hammer_butnot(hammer_ch("a"), hammer_token("ab")); + $this->parser2 = hammer_butnot(hammer_ch_range('0', '9'), hammer_ch('6')); } public function testSuccess1() { - $result1 = h_parse($this->parser1, "a"); - $result2 = h_parse($this->parser1, "aa"); + $result1 = hammer_parse($this->parser1, "a"); + $result2 = hammer_parse($this->parser1, "aa"); $this->assertEquals("a", $result1); $this->assertEquals("a", $result1); } public function testFailure1() { - $result = h_parse($this->parser1, "ab"); + $result = hammer_parse($this->parser1, "ab"); $this->assertEquals(NULL, $result); } public function testFailure2() { - $result = h_parse($this->parser2, "6"); + $result = hammer_parse($this->parser2, "6"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/ChRangeTest.php b/src/bindings/php/Tests/ChRangeTest.php index 433c2cea7f38e39fcbe42c02ff2a183dd7956bd6..52f3732ed5a0c70cff073f1f7900346701f9e302 100644 --- a/src/bindings/php/Tests/ChRangeTest.php +++ b/src/bindings/php/Tests/ChRangeTest.php @@ -8,16 +8,16 @@ class ChRangeTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = ch_range("a", "c"); + $this->parser = hammer_ch_range("a", "c"); } public function testSuccess() { - $result = h_parse($this->parser, "b"); + $result = hammer_parse($this->parser, "b"); $this->assertEquals("b", $result); } public function testFailure() { - $result = h_parse($this->parser, "d"); + $result = hammer_parse($this->parser, "d"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/ChTest.php b/src/bindings/php/Tests/ChTest.php index e05ad244d2eb43b4b0f52faf00557761f10e3413..a38c655695c7523f28b4518d79e8d8e7ac0c6bdf 100644 --- a/src/bindings/php/Tests/ChTest.php +++ b/src/bindings/php/Tests/ChTest.php @@ -8,16 +8,16 @@ class ChTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = ch("\xa2"); + $this->parser = hammer_ch("\xa2"); } public function testSuccess() { - $result = h_parse($this->parser, "\xa2"); + $result = hammer_parse($this->parser, "\xa2"); $this->assertEquals("\xa2", $result); } public function testFailure() { - $result = h_parse($this->parser, "95"); + $result = hammer_parse($this->parser, "95"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/ChoiceTest.php b/src/bindings/php/Tests/ChoiceTest.php index 42bb0a90a94e57ca850195b52091c5cf6e91592f..cd9e4138b1475e075e82adcce8570d8077fa09ae 100644 --- a/src/bindings/php/Tests/ChoiceTest.php +++ b/src/bindings/php/Tests/ChoiceTest.php @@ -7,20 +7,20 @@ class ChoiceTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = choice(ch("a"), ch("b")); + $this->parser = hammer_choice(hammer_ch("a"), hammer_ch("b")); } public function testSuccess() { - $result1 = h_parse($this->parser, "a"); - $result2 = h_parse($this->parser, "b"); + $result1 = hammer_parse($this->parser, "a"); + $result2 = hammer_parse($this->parser, "b"); $this->assertEquals("a", $result1); $this->assertEquals("b", $result2); } public function testFailure() { - $result = h_parse($this->parser, "c"); + $result = hammer_parse($this->parser, "c"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/DifferenceTest.php b/src/bindings/php/Tests/DifferenceTest.php index 88c1903d3bb4d84dcea124f13353ac5e16daceb5..297aa42a6cee8fb3b7662f1c0cf8056383ad0f58 100644 --- a/src/bindings/php/Tests/DifferenceTest.php +++ b/src/bindings/php/Tests/DifferenceTest.php @@ -7,18 +7,18 @@ class DifferenceTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_difference(h_token("ab"), ch("a")); + $this->parser = hammer_difference(hammer_token("ab"), hammer_ch("a")); } public function testSuccess() { - $result = h_parse($this->parser, "ab"); + $result = hammer_parse($this->parser, "ab"); $this->assertEquals("ab", $result); } public function testFailure() { - $result = h_parse($this->parser, "a"); + $result = hammer_parse($this->parser, "a"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/EndTest.php b/src/bindings/php/Tests/EndTest.php index 773bc3600e7ff77206381b46c023e1c31aa6ee40..d6af2af89481f43ee9161353d1c3eb388a2331ab 100644 --- a/src/bindings/php/Tests/EndTest.php +++ b/src/bindings/php/Tests/EndTest.php @@ -7,17 +7,17 @@ class EndPTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = sequence(ch("a"), h_end_p()); + $this->parser = hammer_sequence(hammer_ch("a"), hammer_end()); } public function testSuccess() { - $result = h_parse($this->parser, "a"); + $result = hammer_parse($this->parser, "a"); $this->assertEquals(array("a"), $result); } public function testFailure() { - $result = h_parse($this->parser, "aa"); + $result = hammer_parse($this->parser, "aa"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/EpsilonPTest.php b/src/bindings/php/Tests/EpsilonPTest.php index 432afef4b3c1472c49fb7fca7c6f68df3fe51f27..41100ccc0018d2a1f59c190818e906e3c12ebf45 100644 --- a/src/bindings/php/Tests/EpsilonPTest.php +++ b/src/bindings/php/Tests/EpsilonPTest.php @@ -9,26 +9,26 @@ class EpsilonPTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser1 = sequence(ch("a"), h_epsilon_p(), ch("b")); - $this->parser2 = sequence(h_epsilon_p(), ch("a")); - $this->parser3 = sequence(ch("a"), h_epsilon_p()); + $this->parser1 = hammer_sequence(hammer_ch("a"), hammer_epsilon(), hammer_ch("b")); + $this->parser2 = hammer_sequence(hammer_epsilon(), hammer_ch("a")); + $this->parser3 = hammer_sequence(hammer_ch("a"), hammer_epsilon()); } public function testSuccess1() { - $result = h_parse($this->parser1, "ab"); + $result = hammer_parse($this->parser1, "ab"); $this->assertEquals(array("a", "b"), $result); } public function testSuccess2() { - $result = h_parse($this->parser2, "a"); + $result = hammer_parse($this->parser2, "a"); $this->assertEquals(array("a"), $result); } public function testSuccess3() { - $result = h_parse($this->parser3, "ab"); + $result = hammer_parse($this->parser3, "ab"); $this->assertEquals(array("a"), $result); } } diff --git a/src/bindings/php/Tests/IgnoreTest.php b/src/bindings/php/Tests/IgnoreTest.php index 82ef554ba03978fc4f5bc902bca0966a7ed22f96..805ae08c0e88099d88a3d944c0b620b302b34e50 100644 --- a/src/bindings/php/Tests/IgnoreTest.php +++ b/src/bindings/php/Tests/IgnoreTest.php @@ -7,18 +7,18 @@ class IgnoreTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = sequence(ch("a"), h_ignore(ch("b")), ch("c")); + $this->parser = hammer_sequence(hammer_ch("a"), hammer_ignore(hammer_ch("b")), hammer_ch("c")); } public function testSuccess() { - $result = h_parse($this->parser, "abc"); + $result = hammer_parse($this->parser, "abc"); $this->assertEquals(array("a", "c"), $result); } public function testFailure() { - $result = h_parse($this->parser, "ac"); + $result = hammer_parse($this->parser, "ac"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/InTest.php b/src/bindings/php/Tests/InTest.php index cdc1e9306ce5f486245445c714f2b2f834670d64..e209f1fc2b8e517bddd19c45a8df6b98e2c01d7c 100644 --- a/src/bindings/php/Tests/InTest.php +++ b/src/bindings/php/Tests/InTest.php @@ -7,16 +7,16 @@ class InTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = in("abc"); + $this->parser = hammer_in("abc"); } public function testSuccess() { - $result = h_parse($this->parser, "b"); + $result = hammer_parse($this->parser, "b"); $this->assertEquals("b", $result); } public function testFailure() { - $result = h_parse($this->parser, "d"); + $result = hammer_parse($this->parser, "d"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Int16Test.php b/src/bindings/php/Tests/Int16Test.php index 4b170cc398740f794836d64da7f8d217e0337059..f9f10cb0e6d47bae41eb723f24dae421c688d3f0 100644 --- a/src/bindings/php/Tests/Int16Test.php +++ b/src/bindings/php/Tests/Int16Test.php @@ -8,22 +8,22 @@ class Int16Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_int16(); + $this->parser = hammer_int16(); } public function testNegative() { - $result = h_parse($this->parser, "\xfe\x00"); + $result = hammer_parse($this->parser, "\xfe\x00"); $this->assertEquals(-0x200, $result); } public function testPositive() { - $result = h_parse($this->parser, "\x02\x00"); + $result = hammer_parse($this->parser, "\x02\x00"); $this->assertEquals(0x200, $result); } public function testFailure() { - $result = h_parse($this->parser, "\xfe"); + $result = hammer_parse($this->parser, "\xfe"); $this->assertEquals(NULL, $result); - $result = h_parse($this->parser, "\x02"); + $result = hammer_parse($this->parser, "\x02"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Int32Test.php b/src/bindings/php/Tests/Int32Test.php index c538aa256f5842180e9680f7c326114c1e66057d..5798195abc8ccee4181c6e4b7483015bc7decb28 100644 --- a/src/bindings/php/Tests/Int32Test.php +++ b/src/bindings/php/Tests/Int32Test.php @@ -8,23 +8,23 @@ class Int32Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_int32(); + $this->parser = hammer_int32(); } public function testNegative() { - $result = h_parse($this->parser, "\xff\xfe\x00\x00"); + $result = hammer_parse($this->parser, "\xff\xfe\x00\x00"); $this->assertEquals(-0x20000, $result); } public function testPositive() { - $result = h_parse($this->parser, "\x00\x02\x00\x00"); + $result = hammer_parse($this->parser, "\x00\x02\x00\x00"); $this->assertEquals(0x20000, $result); } public function testFailure() { - $result = h_parse($this->parser, "\xff\xfe\x00"); + $result = hammer_parse($this->parser, "\xff\xfe\x00"); $this->assertEquals(NULL, $result); - $result = h_parse($this->parser, "\x00\x02\x00"); + $result = hammer_parse($this->parser, "\x00\x02\x00"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Int64Test.php b/src/bindings/php/Tests/Int64Test.php index 4c0faa2245891a414a2cb33f26b454bb087291f4..631a39f621e1ef3b2ebb8167b1b2021778c8debb 100644 --- a/src/bindings/php/Tests/Int64Test.php +++ b/src/bindings/php/Tests/Int64Test.php @@ -8,16 +8,16 @@ class Int64Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_int64(); + $this->parser = hammer_int64(); } public function testSuccess() { - $result = h_parse($this->parser, "\xff\xff\xff\xfe\x00\x00\x00\x00"); + $result = hammer_parse($this->parser, "\xff\xff\xff\xfe\x00\x00\x00\x00"); $this->assertEquals(-0x200000000, $result); } public function testFailure() { - $result = h_parse($this->parser, "\xff\xff\xff\xfe\x00\x00\x00"); + $result = hammer_parse($this->parser, "\xff\xff\xff\xfe\x00\x00\x00"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Int8Test.php b/src/bindings/php/Tests/Int8Test.php index 164d7737f6e882f50e37835452c84ca2b5344c86..b0769ecd4521c5fb055d252cd881591e01f727b7 100644 --- a/src/bindings/php/Tests/Int8Test.php +++ b/src/bindings/php/Tests/Int8Test.php @@ -8,16 +8,16 @@ class Int8Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_int8(); + $this->parser = hammer_int8(); } public function testSuccess() { - $result = h_parse($this->parser, "\x88"); + $result = hammer_parse($this->parser, "\x88"); $this->assertEquals(-0x78, $result); } public function testFailure() { - $result = h_parse($this->parser, ""); + $result = hammer_parse($this->parser, ""); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/IntRangeTest.php b/src/bindings/php/Tests/IntRangeTest.php index ce56fce273e1e242770fc28ff5da65e8ea959043..4d300e3ac39c280e8e1ce80d366b3f394914c39d 100644 --- a/src/bindings/php/Tests/IntRangeTest.php +++ b/src/bindings/php/Tests/IntRangeTest.php @@ -7,16 +7,16 @@ class IntRangeTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_int_range(h_uint8(), 3, 10); + $this->parser = hammer_int_range(hammer_uint8(), 3, 10); } public function testSuccess() { - $result = h_parse($this->parser, "\x05"); + $result = hammer_parse($this->parser, "\x05"); $this->assertEquals(5, $result); } public function testFailure() { - $result = h_parse($this->parser, "\xb"); + $result = hammer_parse($this->parser, "\xb"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/LeftTest.php b/src/bindings/php/Tests/LeftTest.php index c671a80875d29b9333c75a161c9b5f13171e8ea2..e0ef01e4c51402dff6bdd97c187c17b9d25f31b2 100644 --- a/src/bindings/php/Tests/LeftTest.php +++ b/src/bindings/php/Tests/LeftTest.php @@ -7,18 +7,18 @@ class LeftTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_left(ch("a"), ch(" ")); + $this->parser = hammer_left(hammer_ch("a"), hammer_ch(" ")); } public function testSuccess() { - $result = h_parse($this->parser, "a "); + $result = hammer_parse($this->parser, "a "); $this->assertEquals("a", $result); } public function testFailure() { - $result1 = h_parse($this->parser, "a"); - $result2 = h_parse($this->parser, " "); - $result3 = h_parse($this->parser, "ab"); + $result1 = hammer_parse($this->parser, "a"); + $result2 = hammer_parse($this->parser, " "); + $result3 = hammer_parse($this->parser, "ab"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); $this->assertEquals(NULL, $result3); diff --git a/src/bindings/php/Tests/LeftrecTest.php b/src/bindings/php/Tests/LeftrecTest.php index 52ed931afe3c1b80ccaa4b6191698f338f144beb..e578a31513b0a499e6b6ab1f9704d0ee65ba9053 100644 --- a/src/bindings/php/Tests/LeftrecTest.php +++ b/src/bindings/php/Tests/LeftrecTest.php @@ -7,27 +7,27 @@ class LeftrecTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_indirect(); - h_bind_indirect($this->parser, choice(sequence($this->parser, ch("a")), ch("a"))); + $this->parser = hammer_indirect(); + hammer_bind_indirect($this->parser, hammer_choice(hammer_sequence($this->parser, hammer_ch("a")), hammer_ch("a"))); } public function testSuccess1() { - $result = h_parse($this->parser, "a"); + $result = hammer_parse($this->parser, "a"); $this->assertEquals("a", $result); } /* These don't work in the underlying C so they won't work here either */ /* public function testSuccess2() { - $result = h_parse($this->parser, "aa"); + $result = hammer_parse($this->parser, "aa"); var_dump($result); $this->assertEquals(array("a", "a"), $result); } public function testSuccess3() { - $result = h_parse($this->parser, "aaa"); + $result = hammer_parse($this->parser, "aaa"); var_dump($result); $this->assertEquals(array(array("a", "a"), "a"), $result); } diff --git a/src/bindings/php/Tests/Many1Test.php b/src/bindings/php/Tests/Many1Test.php index cf5071ceba92b73142c749ba7e59e66571ba6058..50a6c416e96ef4af64a1ee0b66b42a28667ea80f 100644 --- a/src/bindings/php/Tests/Many1Test.php +++ b/src/bindings/php/Tests/Many1Test.php @@ -7,14 +7,14 @@ class Many1Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_many1(choice(ch("a"), ch("b"))); + $this->parser = hammer_many1(hammer_choice(hammer_ch("a"), hammer_ch("b"))); } public function testSuccess() { - $result1 = h_parse($this->parser, "a"); - $result2 = h_parse($this->parser, "b"); - $result3 = h_parse($this->parser, "aabbaba"); + $result1 = hammer_parse($this->parser, "a"); + $result2 = hammer_parse($this->parser, "b"); + $result3 = hammer_parse($this->parser, "aabbaba"); $this->assertEquals(array("a"), $result1); $this->assertEquals(array("b"), $result2); $this->assertEquals(array("a", "a", "b", "b", "a", "b", "a"), $result3); @@ -22,8 +22,8 @@ class Many1Test extends PHPUnit_Framework_TestCase public function testFailure() { - $result1 = h_parse($this->parser, ""); - $result2 = h_parse($this->parser, "daabbabadef"); + $result1 = hammer_parse($this->parser, ""); + $result2 = hammer_parse($this->parser, "daabbabadef"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); } diff --git a/src/bindings/php/Tests/ManyTest.php b/src/bindings/php/Tests/ManyTest.php index 6d249a094de4fd6ed3ad7473994928dd040b177e..b2abee297517250910e0759c39afca9b4c10a7f2 100644 --- a/src/bindings/php/Tests/ManyTest.php +++ b/src/bindings/php/Tests/ManyTest.php @@ -7,15 +7,15 @@ class ManyTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_many(choice(ch("a"), ch("b"))); + $this->parser = hammer_many(hammer_choice(hammer_ch("a"), hammer_ch("b"))); } public function testSuccess() { - $result1 = h_parse($this->parser, ""); - $result2 = h_parse($this->parser, "a"); - $result3 = h_parse($this->parser, "b"); - $result4 = h_parse($this->parser, "aabbaba"); + $result1 = hammer_parse($this->parser, ""); + $result2 = hammer_parse($this->parser, "a"); + $result3 = hammer_parse($this->parser, "b"); + $result4 = hammer_parse($this->parser, "aabbaba"); $this->assertEquals(array(), $result1); $this->assertEquals(array("a"), $result2); $this->assertEquals(array("b"), $result3); diff --git a/src/bindings/php/Tests/MiddleTest.php b/src/bindings/php/Tests/MiddleTest.php index 1ccb9da46cf5c7d6a0523a05c934c770b7baa985..93b6c48b68a944d672230304842d531c0c0acfe7 100644 --- a/src/bindings/php/Tests/MiddleTest.php +++ b/src/bindings/php/Tests/MiddleTest.php @@ -7,22 +7,22 @@ class MiddleTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_middle(ch(" "), ch("a"), ch(" ")); + $this->parser = hammer_middle(hammer_ch(" "), hammer_ch("a"), hammer_ch(" ")); } public function testSuccess() { - $result = h_parse($this->parser, " a "); + $result = hammer_parse($this->parser, " a "); $this->assertEquals("a", $result); } public function testFailure() { - $result1 = h_parse($this->parser, "a"); - $result2 = h_parse($this->parser, " "); - $result3 = h_parse($this->parser, " a"); - $result4 = h_parse($this->parser, "a "); - $result5 = h_parse($this->parser, " b "); - $result6 = h_parse($this->parser, "ba "); - $result7 = h_parse($this->parser, " ab"); + $result1 = hammer_parse($this->parser, "a"); + $result2 = hammer_parse($this->parser, " "); + $result3 = hammer_parse($this->parser, " a"); + $result4 = hammer_parse($this->parser, "a "); + $result5 = hammer_parse($this->parser, " b "); + $result6 = hammer_parse($this->parser, "ba "); + $result7 = hammer_parse($this->parser, " ab"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); $this->assertEquals(NULL, $result3); diff --git a/src/bindings/php/Tests/NotInTest.php b/src/bindings/php/Tests/NotInTest.php index f06e53f7331c1554fc2bc25f435f8b6a8ebafaa1..c5a2fdfd73c29c856ff4e5ab468d40bd4895fed5 100644 --- a/src/bindings/php/Tests/NotInTest.php +++ b/src/bindings/php/Tests/NotInTest.php @@ -7,16 +7,16 @@ class NotInTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = not_in("abc"); + $this->parser = hammer_not_in("abc"); } public function testSuccess() { - $result = h_parse($this->parser, "d"); + $result = hammer_parse($this->parser, "d"); $this->assertEquals("d", $result); } public function testFailure() { - $result = h_parse($this->parser, "b"); + $result = hammer_parse($this->parser, "b"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/NotTest.php b/src/bindings/php/Tests/NotTest.php index a2c76aa7eb6ea6a482d2c42df3d964fefa2475ca..15eb77a1173bb48ed3591d810cba9438c04c7e7f 100644 --- a/src/bindings/php/Tests/NotTest.php +++ b/src/bindings/php/Tests/NotTest.php @@ -8,26 +8,26 @@ class NotTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser1 = sequence(ch("a"), choice(ch("+"), h_token("++")), ch("b")); - $this->parser2 = sequence(ch("a"), choice(sequence(ch("+"), h_not(ch("+"))), h_token("++")), ch("b")); + $this->parser1 = hammer_sequence(hammer_ch("a"), hammer_choice(hammer_ch("+"), hammer_token("++")), hammer_ch("b")); + $this->parser2 = hammer_sequence(hammer_ch("a"), hammer_choice(hammer_sequence(hammer_ch("+"), hammer_not(hammer_ch("+"))), hammer_token("++")), hammer_ch("b")); } public function testSuccess1() { - $result = h_parse($this->parser1, "a+b"); + $result = hammer_parse($this->parser1, "a+b"); $this->assertEquals(array("a", "+", "b"), $result); } public function testFailure1() { - $result = h_parse($this->parser1, "a++b"); + $result = hammer_parse($this->parser1, "a++b"); $this->assertEquals(NULL, $result); } public function testSuccess2() { - $result1 = h_parse($this->parser2, "a+b"); - $result2 = h_parse($this->parser2, "a++b"); + $result1 = hammer_parse($this->parser2, "a+b"); + $result2 = hammer_parse($this->parser2, "a++b"); $this->assertEquals(array("a", array("+"), "b"), $result1); $this->assertEquals(array("a", "++", "b"), $result2); } diff --git a/src/bindings/php/Tests/NothingTest.php b/src/bindings/php/Tests/NothingTest.php index fa31b55a883b3ca244418989ae5a199e48f5d1f5..f827e47558e96698593f59ff091ee41893f20666 100644 --- a/src/bindings/php/Tests/NothingTest.php +++ b/src/bindings/php/Tests/NothingTest.php @@ -7,12 +7,12 @@ class NothingPTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_nothing_p(); + $this->parser = hammer_nothing(); } public function testFailure() { - $result = h_parse($this->parser, "a"); + $result = hammer_parse($this->parser, "a"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/OptionalTest.php b/src/bindings/php/Tests/OptionalTest.php index 22b15dfe904b3cf20d0b8a640b7b2bea74554ced..e150415f2a21d4a4ac4eb36f9b0323d05fe326a3 100644 --- a/src/bindings/php/Tests/OptionalTest.php +++ b/src/bindings/php/Tests/OptionalTest.php @@ -7,14 +7,14 @@ class OptionalTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = sequence(ch("a"), h_optional(choice(ch("b"), ch("c"))), ch("d")); + $this->parser = hammer_sequence(hammer_ch("a"), hammer_optional(hammer_choice(hammer_ch("b"), hammer_ch("c"))), hammer_ch("d")); } public function testSuccess() { - $result1 = h_parse($this->parser, "abd"); - $result2 = h_parse($this->parser, "acd"); - $result3 = h_parse($this->parser, "ad"); + $result1 = hammer_parse($this->parser, "abd"); + $result2 = hammer_parse($this->parser, "acd"); + $result3 = hammer_parse($this->parser, "ad"); $this->assertEquals(array("a", "b", "d"), $result1); $this->assertEquals(array("a", "c", "d"), $result2); $this->assertEquals(array("a", NULL, "d"), $result3); @@ -22,9 +22,9 @@ class OptionalTest extends PHPUnit_Framework_TestCase public function testFailure() { - $result1 = h_parse($this->parser, "aed"); - $result2 = h_parse($this->parser, "ab"); - $result3 = h_parse($this->parser, "ac"); + $result1 = hammer_parse($this->parser, "aed"); + $result2 = hammer_parse($this->parser, "ab"); + $result3 = hammer_parse($this->parser, "ac"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); $this->assertEquals(NULL, $result3); diff --git a/src/bindings/php/Tests/PredicateTest.php b/src/bindings/php/Tests/PredicateTest.php index 1df45e273ac1bed5fd8fc0b727e8c0a032c4ec58..cc891d67c3ec2da74ca568b95a13fa85fc6f512b 100644 --- a/src/bindings/php/Tests/PredicateTest.php +++ b/src/bindings/php/Tests/PredicateTest.php @@ -12,18 +12,18 @@ class PredicateTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = predicate(h_many1(choice(ch('a'), ch('b'))), "predTest"); + $this->parser = hammer_predicate(hammer_many1(hammer_choice(hammer_ch('a'), hammer_ch('b'))), "predTest"); } public function testSuccess() { - $result1 = h_parse($this->parser, "aa"); - $result2 = h_parse($this->parser, "bb"); + $result1 = hammer_parse($this->parser, "aa"); + $result2 = hammer_parse($this->parser, "bb"); $this->assertEquals(["a", "a"], $result1); $this->assertEquals(["b", "b"], $result2); } public function testFailure() { - $result = h_parse($this->parser, "ab"); + $result = hammer_parse($this->parser, "ab"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/RepeatNTest.php b/src/bindings/php/Tests/RepeatNTest.php index e6db964e1bd4787583e6c2d1cabf37e233129cc4..5441ef64d2bcb0e08b1ab31a18b227962aa03da4 100644 --- a/src/bindings/php/Tests/RepeatNTest.php +++ b/src/bindings/php/Tests/RepeatNTest.php @@ -7,19 +7,19 @@ class RepeatNTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_repeat_n(choice(ch("a"), ch("b")), 2); + $this->parser = hammer_repeat_n(hammer_choice(hammer_ch("a"), hammer_ch("b")), 2); } public function testSuccess() { - $result = h_parse($this->parser, "abdef"); + $result = hammer_parse($this->parser, "abdef"); $this->assertEquals(array("a", "b"), $result); } public function testFailure() { - $result1 = h_parse($this->parser, "adef"); - $result2 = h_parse($this->parser, "dabdef"); + $result1 = hammer_parse($this->parser, "adef"); + $result2 = hammer_parse($this->parser, "dabdef"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); } diff --git a/src/bindings/php/Tests/RightTest.php b/src/bindings/php/Tests/RightTest.php index 3c5b06e2083a313590b91c341d64e6ffd555f206..215aacec6d7212ea2dc7e496f9cbc16dd59a2944 100644 --- a/src/bindings/php/Tests/RightTest.php +++ b/src/bindings/php/Tests/RightTest.php @@ -7,18 +7,18 @@ class RightTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_right(ch(" "), ch("a")); + $this->parser = hammer_right(hammer_ch(" "), hammer_ch("a")); } public function testSuccess() { - $result = h_parse($this->parser, " a"); + $result = hammer_parse($this->parser, " a"); $this->assertEquals("a", $result); } public function testFailure() { - $result1 = h_parse($this->parser, "a"); - $result2 = h_parse($this->parser, " "); - $result3 = h_parse($this->parser, "ba"); + $result1 = hammer_parse($this->parser, "a"); + $result2 = hammer_parse($this->parser, " "); + $result3 = hammer_parse($this->parser, "ba"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); $this->assertEquals(NULL, $result3); diff --git a/src/bindings/php/Tests/RightrecTest.php b/src/bindings/php/Tests/RightrecTest.php index 9580fdecb1bafa2e423bef24b0e074e1775f3ebe..ed21b353cc2f695bc49f4b1aca35a7152daceba5 100644 --- a/src/bindings/php/Tests/RightrecTest.php +++ b/src/bindings/php/Tests/RightrecTest.php @@ -7,15 +7,15 @@ class RightrecTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_indirect(); - h_bind_indirect($this->parser, choice(sequence(ch("a"), $this->parser), h_epsilon_p())); + $this->parser = hammer_indirect(); + hammer_bind_indirect($this->parser, hammer_choice(hammer_sequence(hammer_ch("a"), $this->parser), hammer_epsilon())); } public function testSuccess() { - $result1 = h_parse($this->parser, "a"); - $result2 = h_parse($this->parser, "aa"); - $result3 = h_parse($this->parser, "aaa"); + $result1 = hammer_parse($this->parser, "a"); + $result2 = hammer_parse($this->parser, "aa"); + $result3 = hammer_parse($this->parser, "aaa"); $this->assertEquals(array("a"), $result1); $this->assertEquals(array("a", array("a")), $result2); $this->assertEquals(array("a", array("a", array("a"))), $result3); diff --git a/src/bindings/php/Tests/SepBy1Test.php b/src/bindings/php/Tests/SepBy1Test.php index a5a36cc3d204a3ba1c5111a8072e92a0e6f07196..57a5affb99bf0bd941d2b51372f0dfe1151e5093 100644 --- a/src/bindings/php/Tests/SepBy1Test.php +++ b/src/bindings/php/Tests/SepBy1Test.php @@ -7,15 +7,15 @@ class SepBy1Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_sepBy1(choice(ch("1"), ch("2"), ch("3")), ch(",")); + $this->parser = hammer_sep_by1(hammer_choice(hammer_ch("1"), hammer_ch("2"), hammer_ch("3")), hammer_ch(",")); } public function testSuccess() { - $result1 = h_parse($this->parser, "1,2,3"); - $result2 = h_parse($this->parser, "1,3,2"); - $result3 = h_parse($this->parser, "1,3"); - $result4 = h_parse($this->parser, "3"); + $result1 = hammer_parse($this->parser, "1,2,3"); + $result2 = hammer_parse($this->parser, "1,3,2"); + $result3 = hammer_parse($this->parser, "1,3"); + $result4 = hammer_parse($this->parser, "3"); $this->assertEquals(array("1", "2", "3"), $result1); $this->assertEquals(array("1", "3", "2"), $result2); $this->assertEquals(array("1", "3"), $result3); @@ -24,7 +24,7 @@ class SepBy1Test extends PHPUnit_Framework_TestCase public function testFailure() { - $result = h_parse($this->parser, ""); + $result = hammer_parse($this->parser, ""); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/SepByTest.php b/src/bindings/php/Tests/SepByTest.php index fdf4ed4901f004326046b81eab636dbaa524c2d0..17c8e1656ed6200c122196c0fd9c400d5cd8b2ef 100644 --- a/src/bindings/php/Tests/SepByTest.php +++ b/src/bindings/php/Tests/SepByTest.php @@ -7,16 +7,16 @@ class SepByTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_sepBy(choice(ch("1"), ch("2"), ch("3")), ch(",")); + $this->parser = hammer_sep_by(hammer_choice(hammer_ch("1"), hammer_ch("2"), hammer_ch("3")), hammer_ch(",")); } public function testSuccess() { - $result1 = h_parse($this->parser, "1,2,3"); - $result2 = h_parse($this->parser, "1,3,2"); - $result3 = h_parse($this->parser, "1,3"); - $result4 = h_parse($this->parser, "3"); - $result5 = h_parse($this->parser, ""); + $result1 = hammer_parse($this->parser, "1,2,3"); + $result2 = hammer_parse($this->parser, "1,3,2"); + $result3 = hammer_parse($this->parser, "1,3"); + $result4 = hammer_parse($this->parser, "3"); + $result5 = hammer_parse($this->parser, ""); $this->assertEquals(array("1", "2", "3"), $result1); $this->assertEquals(array("1", "3", "2"), $result2); $this->assertEquals(array("1", "3"), $result3); diff --git a/src/bindings/php/Tests/SequenceTest.php b/src/bindings/php/Tests/SequenceTest.php index 67ae1f055532ee8c3145ac00282a02a06ab3d06d..bafb4f1c9a74fff8f6471c2f7a9a2afe14a7b54d 100644 --- a/src/bindings/php/Tests/SequenceTest.php +++ b/src/bindings/php/Tests/SequenceTest.php @@ -8,29 +8,29 @@ class SequenceTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser1 = sequence(ch("a"), ch("b")); - $this->parser2 = sequence(ch("a"), h_whitespace(ch("b"))); + $this->parser1 = hammer_sequence(hammer_ch("a"), hammer_ch("b")); + $this->parser2 = hammer_sequence(hammer_ch("a"), hammer_whitespace(hammer_ch("b"))); } public function testSuccess1() { - $result = h_parse($this->parser1, "ab"); + $result = hammer_parse($this->parser1, "ab"); $this->assertEquals(array("a", "b"), $result); } public function testFailure1() { - $result1 = h_parse($this->parser1, "a"); - $result2 = h_parse($this->parser2, "b"); + $result1 = hammer_parse($this->parser1, "a"); + $result2 = hammer_parse($this->parser2, "b"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); } public function testSuccess2() { - $result1 = h_parse($this->parser2, "ab"); - $result2 = h_parse($this->parser2, "a b"); - $result3 = h_parse($this->parser2, "a b"); + $result1 = hammer_parse($this->parser2, "ab"); + $result2 = hammer_parse($this->parser2, "a b"); + $result3 = hammer_parse($this->parser2, "a b"); $this->assertEquals(array("a", "b"), $result1); $this->assertEquals(array("a", "b"), $result2); $this->assertEquals(array("a", "b"), $result3); diff --git a/src/bindings/php/Tests/TokenTest.php b/src/bindings/php/Tests/TokenTest.php index 492c17fbedb4bd9d7dff5e7a02ae2d4ac0be7a96..90c278d7cced74c3f79920d6c369800d047fb653 100644 --- a/src/bindings/php/Tests/TokenTest.php +++ b/src/bindings/php/Tests/TokenTest.php @@ -8,16 +8,16 @@ class TokenTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_token("95\xa2"); + $this->parser = hammer_token("95\xa2"); } public function testSuccess() { - $result = h_parse($this->parser, "95\xa2"); + $result = hammer_parse($this->parser, "95\xa2"); $this->assertEquals("95\xa2", $result); } public function testFailure() { - $result = h_parse($this->parser, "95"); + $result = hammer_parse($this->parser, "95"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Uint16Test.php b/src/bindings/php/Tests/Uint16Test.php index 463938960d69e8ab900a2446432f5458b7094b82..31c99cda7f33fc71ecc036519d59165df958528b 100644 --- a/src/bindings/php/Tests/Uint16Test.php +++ b/src/bindings/php/Tests/Uint16Test.php @@ -8,16 +8,16 @@ class Uint16Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_uint16(); + $this->parser = hammer_uint16(); } public function testSuccess() { - $result = h_parse($this->parser, "\x02\x00"); + $result = hammer_parse($this->parser, "\x02\x00"); $this->assertEquals(0x200, $result); } public function testFailure() { - $result = h_parse($this->parser, "\x02"); + $result = hammer_parse($this->parser, "\x02"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Uint32Test.php b/src/bindings/php/Tests/Uint32Test.php index f9b0f0bb64fa8dc03780eaa2533929104f2cf9d7..593de6607ea8cadb6fddd9645b92c6ecad5354f5 100644 --- a/src/bindings/php/Tests/Uint32Test.php +++ b/src/bindings/php/Tests/Uint32Test.php @@ -8,16 +8,16 @@ class Uint32Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_uint32(); + $this->parser = hammer_uint32(); } public function testSuccess() { - $result = h_parse($this->parser, "\x00\x02\x00\x00"); + $result = hammer_parse($this->parser, "\x00\x02\x00\x00"); $this->assertEquals(0x20000, $result); } public function testFailure() { - $result = h_parse($this->parser, "\x00\x02\x00"); + $result = hammer_parse($this->parser, "\x00\x02\x00"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Uint64Test.php b/src/bindings/php/Tests/Uint64Test.php index 99109164ede71fcee749597975480699b03a5898..e61edb635cf34acfd3223404d0c02ccca87bfeae 100644 --- a/src/bindings/php/Tests/Uint64Test.php +++ b/src/bindings/php/Tests/Uint64Test.php @@ -8,16 +8,16 @@ class Uint64Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_uint64(); + $this->parser = hammer_uint64(); } public function testSuccess() { - $result = h_parse($this->parser, "\x00\x00\x00\x02\x00\x00\x00\x00"); + $result = hammer_parse($this->parser, "\x00\x00\x00\x02\x00\x00\x00\x00"); $this->assertEquals(0x200000000, $result); } public function testFailure() { - $result = h_parse($this->parser, "\x00\x00\x00\x02\x00\x00\x00"); + $result = hammer_parse($this->parser, "\x00\x00\x00\x02\x00\x00\x00"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/Uint8Test.php b/src/bindings/php/Tests/Uint8Test.php index 6797949554a39bd111a92a751fe02b4203575dae..6ebfa28bd468f521773a975aff28204b02ae2999 100644 --- a/src/bindings/php/Tests/Uint8Test.php +++ b/src/bindings/php/Tests/Uint8Test.php @@ -8,16 +8,16 @@ class Uint8Test extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_uint8(); + $this->parser = hammer_uint8(); } public function testSuccess() { - $result = h_parse($this->parser, "\x78"); + $result = hammer_parse($this->parser, "\x78"); $this->assertEquals(0x78, $result); } public function testFailure() { - $result = h_parse($this->parser, ""); + $result = hammer_parse($this->parser, ""); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/WhitespaceTest.php b/src/bindings/php/Tests/WhitespaceTest.php index 96c2f380f707c8d251c8fdf79a129711fc27d77e..c5f6e900f3fa288eb5597989991e5f4ba6a3266c 100644 --- a/src/bindings/php/Tests/WhitespaceTest.php +++ b/src/bindings/php/Tests/WhitespaceTest.php @@ -8,15 +8,15 @@ class WhitespaceTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser1 = h_whitespace(ch("a")); - $this->parser2 = h_whitespace(h_end_p()); + $this->parser1 = hammer_whitespace(hammer_ch("a")); + $this->parser2 = hammer_whitespace(hammer_end()); } public function testSuccess1() { - $result1 = h_parse($this->parser1, "a"); - $result2 = h_parse($this->parser1, " a"); - $result3 = h_parse($this->parser1, " a"); - $result4 = h_parse($this->parser1, "\ta"); + $result1 = hammer_parse($this->parser1, "a"); + $result2 = hammer_parse($this->parser1, " a"); + $result3 = hammer_parse($this->parser1, " a"); + $result4 = hammer_parse($this->parser1, "\ta"); $this->assertEquals("a", $result1); $this->assertEquals("a", $result2); $this->assertEquals("a", $result3); @@ -24,19 +24,19 @@ class WhitespaceTest extends PHPUnit_Framework_TestCase } public function testFailure1() { - $result = h_parse($this->parser1, "_a"); + $result = hammer_parse($this->parser1, "_a"); $this->assertEquals(NULL, $result); } public function testSuccess2() { - $result1 = h_parse($this->parser2, ""); - $result2 = h_parse($this->parser2, " "); + $result1 = hammer_parse($this->parser2, ""); + $result2 = hammer_parse($this->parser2, " "); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); } public function testFailure2() { - $result = h_parse($this->parser2, " x"); + $result = hammer_parse($this->parser2, " x"); $this->assertEquals(NULL, $result); } } diff --git a/src/bindings/php/Tests/XorTest.php b/src/bindings/php/Tests/XorTest.php index c9a25f0a2de5f5b6cf2609b9240cc0466c4b93d1..1d20d1e9a4fc55017045a35e2baca7da4e670dba 100644 --- a/src/bindings/php/Tests/XorTest.php +++ b/src/bindings/php/Tests/XorTest.php @@ -7,21 +7,21 @@ class XorTest extends PHPUnit_Framework_TestCase protected function setUp() { - $this->parser = h_xor(ch_range("0", "6"), ch_range("5", "9")); + $this->parser = hammer_xor(hammer_ch_range("0", "6"), hammer_ch_range("5", "9")); } public function testSuccess() { - $result1 = h_parse($this->parser, "0"); - $result2 = h_parse($this->parser, "9"); + $result1 = hammer_parse($this->parser, "0"); + $result2 = hammer_parse($this->parser, "9"); $this->assertEquals("0", $result1); $this->assertEquals("9", $result2); } public function testFailure() { - $result1 = h_parse($this->parser, "5"); - $result2 = h_parse($this->parser, "a"); + $result1 = hammer_parse($this->parser, "5"); + $result2 = hammer_parse($this->parser, "a"); $this->assertEquals(NULL, $result1); $this->assertEquals(NULL, $result2); } diff --git a/src/bindings/php/hammer.i b/src/bindings/php/hammer.i index c9753609b99604de7c04819bfa6e54f7e29c8693..63038ccf89b44766c40ce3406a8ef3f5249495ea 100644 --- a/src/bindings/php/hammer.i +++ b/src/bindings/php/hammer.i @@ -77,6 +77,42 @@ } } +%rename("hammer_token") h_token; +%rename("hammer_int_range") h_int_range; +%rename("hammer_bits") h_bits; +%rename("hammer_int64") h_int64; +%rename("hammer_int32") h_int32; +%rename("hammer_int16") h_int16; +%rename("hammer_int8") h_int8; +%rename("hammer_uint64") h_uint64; +%rename("hammer_uint32") h_uint32; +%rename("hammer_uint16") h_uint16; +%rename("hammer_uint8") h_uint8; +%rename("hammer_whitespace") h_whitespace; +%rename("hammer_left") h_left; +%rename("hammer_right") h_right; +%rename("hammer_middle") h_middle; +%rename("hammer_end") h_end_p; +%rename("hammer_nothing") h_nothing_p; +%rename("hammer_butnot") h_butnot; +%rename("hammer_difference") h_difference; +%rename("hammer_xor") h_xor; +%rename("hammer_many") h_many; +%rename("hammer_many1") h_many1; +%rename("hammer_repeat_n") h_repeat_n; +%rename("hammer_optional") h_optional; +%rename("hammer_ignore") h_ignore; +%rename("hammer_sep_by") h_sepBy; +%rename("hammer_sep_by1") h_sepBy1; +%rename("hammer_epsilon") h_epsilon_p; +%rename("hammer_length_value") h_length_value; +%rename("hammer_and") h_and; +%rename("hammer_not") h_not; +%rename("hammer_indirect") h_indirect; +%rename("hammer_bind_indirect") h_bind_indirect; +%rename("hammer_compile") h_compile; +%rename("hammer_parse") h_parse; + %include "../swig/hammer.i"; %inline { @@ -158,52 +194,52 @@ return Z_LVAL_P(ret); } - HParser* action(HParser *parser, const char *name) { + HParser* hammer_action(HParser *parser, const char *name) { return h_action(parser, call_action, (void*)name); } - HParser* predicate(HParser *parser, const char *name) { + HParser* hammer_predicate(HParser *parser, const char *name) { return h_attr_bool(parser, call_predicate, (void*)name); } } %pragma(php) code=" -function ch($ch) +function hammer_ch($ch) { if (is_string($ch)) - return h_token($ch); + return hammer_token($ch); else return h_ch($ch); } -function choice() +function hammer_choice() { $arg_list = func_get_args(); $arg_list[] = NULL; return h_choice__a($arg_list); } -function sequence() +function hammer_sequence() { $arg_list = func_get_args(); $arg_list[] = NULL; return h_sequence__a($arg_list); } -function ch_range($low, $high) +function hammer_ch_range($low, $high) { - return action(h_ch_range($low, $high), \"chr\"); + return hammer_action(h_ch_range($low, $high), \"chr\"); } -function in($charset) +function hammer_in($charset) { - return action(h_in($charset), \"chr\"); + return hammer_action(h_in($charset), \"chr\"); } -function not_in($charset) +function hammer_not_in($charset) { - return action(h_not_in($charset), \"chr\"); + return hammer_action(h_not_in($charset), \"chr\"); } "