Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: 'Psalm'
run: |
composer remove --dev -W 'phpunit/phpunit'
composer require --dev -W 'vimeo/psalm=>=5.0' 'nikic/php-parser=>=4.0'
composer require --dev -W 'vimeo/psalm=>=5.0 <7.0' 'nikic/php-parser=>=4.0'
php vendor/bin/psalm --shepherd --php-version=${{ matrix.php }}
continue-on-error: '${{ matrix.failure }}'

Expand Down
2 changes: 1 addition & 1 deletion src/Utility/RegexBuilderUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private static function createShortcodeRegexContent(SyntaxInterface $syntax)
// lookahead test for space, closing tag, self-closing tag or end of string
$empty = '(?=\s|'.$close.'|'.$slash.$space.$close.'|$)';
// equals sign and alphanumeric value
$simple = '((?:(?!=\s*|'.$close.'|'.$slash.$close.')[^\s])+)';
$simple = '((?:(?!'.$equals.'\s*|'.$close.'|'.$slash.$close.')[^\s])+)';
// equals sign and value without unescaped string delimiters enclosed in them
$complex = $string.'(?:[^'.$string.'\\\\]*(?:\\\\.[^'.$string.'\\\\]*)*)'.$string;
// complete parameters matching regex
Expand Down
10 changes: 10 additions & 0 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ public function testParser(ParserInterface $parser, $code, array $expected)
$this->assertShortcodes($parser->parse($code), $expected);
}

public function testParsersEndValuesAtSyntaxSeparator()
{
$syntax = new Syntax('@', '#', '!', '&', '~');
foreach(array(new RegexParser($syntax), new RegularParser($syntax), new StackParser($syntax), new HybridParser($syntax)) as $parser) {
$this->assertShortcodes($parser->parse('@a&c=d b&e=f#x@!a# @b x&y&z#'), array(
new ParsedShortcode(new Shortcode('a', array('b' => 'e=f'), 'x', 'c=d'), '@a&c=d b&e=f#x@!a#', 0),
));
}
}

private function assertShortcodes(array $actual, array $expected)
{
$count = count($actual);
Expand Down
Loading