diff options
-rw-r--r-- | src/ste/Parser.php | 2 | ||||
-rw-r--r-- | tests/test_tagname/.gitignore | 3 | ||||
-rw-r--r-- | tests/test_tagname/code.php | 20 | ||||
-rw-r--r-- | tests/test_tagname/test.tpl | 4 | ||||
-rw-r--r-- | tests/test_tagname/want | 4 |
5 files changed, 32 insertions, 1 deletions
diff --git a/src/ste/Parser.php b/src/ste/Parser.php index 5e5ef0a..7226c60 100644 --- a/src/ste/Parser.php +++ b/src/ste/Parser.php @@ -89,7 +89,7 @@ class Parser { private function take_while($cb) { $s = ""; - while($c = $this->next()) { + while(($c = $this->next()) !== "") { if(!call_user_func($cb, $c)) { $this->back(); return $s; diff --git a/tests/test_tagname/.gitignore b/tests/test_tagname/.gitignore new file mode 100644 index 0000000..de2a41b --- /dev/null +++ b/tests/test_tagname/.gitignore @@ -0,0 +1,3 @@ +have +*.ast +*.transc.php diff --git a/tests/test_tagname/code.php b/tests/test_tagname/code.php new file mode 100644 index 0000000..6001358 --- /dev/null +++ b/tests/test_tagname/code.php @@ -0,0 +1,20 @@ +<?php + +use kch42\ste\STECore; + +function test_func(STECore $ste) { + $names = array( + "foo", + "ab_cd", + "foo123baz", + "x0123", + ); + + foreach ($names as $name) { + $ste->register_tag( + $name, + function ($ste, $params, $sub) use ($name) { return $name; } + ); + } + +} diff --git a/tests/test_tagname/test.tpl b/tests/test_tagname/test.tpl new file mode 100644 index 0000000..30ca889 --- /dev/null +++ b/tests/test_tagname/test.tpl @@ -0,0 +1,4 @@ +<ste:foo /> +<ste:ab_cd /> +<ste:foo123baz /> +<ste:x0123 />
\ No newline at end of file diff --git a/tests/test_tagname/want b/tests/test_tagname/want new file mode 100644 index 0000000..3233294 --- /dev/null +++ b/tests/test_tagname/want @@ -0,0 +1,4 @@ +foo +ab_cd +foo123baz +x0123 |