From b9ce12f3b61a67e8eaef01af0828b9103ff2194a Mon Sep 17 00:00:00 2001 From: "Meredith L. Patterson" <mlp@thesmartpolitenerd.com> Date: Wed, 18 Dec 2013 00:32:56 +0100 Subject: [PATCH] Great PHP Symbol Renaming; debug build works, optimised build segfaults. is it gcc? fuck it all and let travis sort it out --- src/bindings/php/Tests/ActionTest.php | 10 ++-- src/bindings/php/Tests/AndTest.php | 12 ++--- src/bindings/php/Tests/ButNotTest.php | 12 ++--- src/bindings/php/Tests/ChRangeTest.php | 6 +-- src/bindings/php/Tests/ChTest.php | 6 +-- src/bindings/php/Tests/ChoiceTest.php | 8 +-- src/bindings/php/Tests/DifferenceTest.php | 6 +-- src/bindings/php/Tests/EndTest.php | 6 +-- src/bindings/php/Tests/EpsilonPTest.php | 12 ++--- src/bindings/php/Tests/IgnoreTest.php | 6 +-- src/bindings/php/Tests/InTest.php | 6 +-- src/bindings/php/Tests/Int16Test.php | 10 ++-- src/bindings/php/Tests/Int32Test.php | 10 ++-- src/bindings/php/Tests/Int64Test.php | 6 +-- src/bindings/php/Tests/Int8Test.php | 6 +-- src/bindings/php/Tests/IntRangeTest.php | 6 +-- src/bindings/php/Tests/LeftTest.php | 10 ++-- src/bindings/php/Tests/LeftrecTest.php | 10 ++-- src/bindings/php/Tests/Many1Test.php | 12 ++--- src/bindings/php/Tests/ManyTest.php | 10 ++-- src/bindings/php/Tests/MiddleTest.php | 18 +++---- src/bindings/php/Tests/NotInTest.php | 6 +-- src/bindings/php/Tests/NotTest.php | 12 ++--- src/bindings/php/Tests/NothingTest.php | 4 +- src/bindings/php/Tests/OptionalTest.php | 14 +++--- src/bindings/php/Tests/PredicateTest.php | 8 +-- src/bindings/php/Tests/RepeatNTest.php | 8 +-- src/bindings/php/Tests/RightTest.php | 10 ++-- src/bindings/php/Tests/RightrecTest.php | 10 ++-- src/bindings/php/Tests/SepBy1Test.php | 12 ++--- src/bindings/php/Tests/SepByTest.php | 12 ++--- src/bindings/php/Tests/SequenceTest.php | 16 +++--- src/bindings/php/Tests/TokenTest.php | 6 +-- src/bindings/php/Tests/Uint16Test.php | 6 +-- src/bindings/php/Tests/Uint32Test.php | 6 +-- src/bindings/php/Tests/Uint64Test.php | 6 +-- src/bindings/php/Tests/Uint8Test.php | 6 +-- src/bindings/php/Tests/WhitespaceTest.php | 20 ++++---- src/bindings/php/Tests/XorTest.php | 10 ++-- src/bindings/php/hammer.i | 60 ++++++++++++++++++----- 40 files changed, 228 insertions(+), 192 deletions(-) diff --git a/src/bindings/php/Tests/ActionTest.php b/src/bindings/php/Tests/ActionTest.php index 2912533a..f4e6a563 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 03f92582..91cb1156 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 9f8117a3..f1af3dd7 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 433c2cea..52f3732e 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 e05ad244..a38c6556 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 42bb0a90..cd9e4138 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 88c1903d..297aa42a 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 773bc360..d6af2af8 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 432afef4..41100ccc 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 82ef554b..805ae08c 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 cdc1e930..e209f1fc 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 4b170cc3..f9f10cb0 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 c538aa25..5798195a 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 4c0faa22..631a39f6 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 164d7737..b0769ecd 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 ce56fce2..4d300e3a 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 c671a808..e0ef01e4 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 52ed931a..e578a315 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 cf5071ce..50a6c416 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 6d249a09..b2abee29 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 1ccb9da4..93b6c48b 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 f06e53f7..c5a2fdfd 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 a2c76aa7..15eb77a1 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 fa31b55a..f827e475 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 22b15dfe..e150415f 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 1df45e27..cc891d67 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 e6db964e..5441ef64 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 3c5b06e2..215aacec 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 9580fdec..ed21b353 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 a5a36cc3..57a5affb 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 fdf4ed49..17c8e165 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 67ae1f05..bafb4f1c 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 492c17fb..90c278d7 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 46393896..31c99cda 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 f9b0f0bb..593de660 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 99109164..e61edb63 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 67979495..6ebfa28b 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 96c2f380..c5f6e900 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 c9a25f0a..1d20d1e9 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 c9753609..63038ccf 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\"); } " -- GitLab