diff --git a/src/Parser/RegularParser.php b/src/Parser/RegularParser.php index 8a42422..de40d51 100644 --- a/src/Parser/RegularParser.php +++ b/src/Parser/RegularParser.php @@ -123,7 +123,8 @@ private function content(array &$names) $appendContent = function(array $token) use(&$content) { $content .= $token[1]; }; while($this->position < $this->tokensCount) { - while($this->match(array(self::TOKEN_STRING, self::TOKEN_WS), $appendContent)) { + while($this->position < $this->tokensCount && false === $this->lookahead(self::TOKEN_OPEN)) { + $this->match(null, $appendContent); continue; } diff --git a/tests/ParserTest.php b/tests/ParserTest.php index b3d1e96..e64d4cc 100644 --- a/tests/ParserTest.php +++ b/tests/ParserTest.php @@ -191,6 +191,14 @@ public function provideShortcodes() new ParsedShortcode(new Shortcode('n_am_e', array(), null), '[n_am_e]', 24), new ParsedShortcode(new Shortcode('_n_', array(), null), '[_n_]', 32), )), + array($s, '[x]/[/x] [x]"[/x] [x]=[/x] [x]][/x] [x] [/x] [x]x[/x]', array( + new ParsedShortcode(new Shortcode('x', array(), '/'), '[x]/[/x]', 0), + new ParsedShortcode(new Shortcode('x', array(), '"'), '[x]"[/x]', 9), + new ParsedShortcode(new Shortcode('x', array(), '='), '[x]=[/x]', 18), + new ParsedShortcode(new Shortcode('x', array(), ']'), '[x]][/x]', 27), + new ParsedShortcode(new Shortcode('x', array(), ' '), '[x] [/x]', 36), + new ParsedShortcode(new Shortcode('x', array(), 'x'), '[x]x[/x]', 45), + )), ); /**