@ -6,8 +6,4 @@
declare(strict_types=1);
namespace dW\Highlighter\Scope;
abstract class Matcher {
public function getPrefix(string $scope): string|null|false {
return null;
}
abstract class Matcher {}
@ -16,7 +16,7 @@ class GroupMatcher extends Matcher {
public function matches(array $scopes): bool {
return $this->selector->matches($scope);
return $this->selector->matches($scopes);
public function getPrefix(array $scopes): string|null|false {
@ -17,7 +17,7 @@ class NegateMatcher extends Matcher {
return !($this->matcher->matches($scopes));
public function getPrefix(array $scopes): null {
public function getPrefix(array $scopes) {
@ -17,7 +17,7 @@ class ScopeMatcher extends Matcher {
$lastDotIndex = 0;
$scopeLen = strlen($scope);
foreach ($this->segments as $index => $segment) {
if ($lastIndex > $scopeLen) {
if ($lastDotIndex > $scopeLen) {
break;
@ -16,4 +16,8 @@ class SegmentMatcher extends Matcher {
public function matches(string $scope): bool {
return ($scope === $this->segment);
@ -16,4 +16,8 @@ class TrueMatcher extends Matcher {
return true;
@ -131,6 +131,7 @@ class Parser {
$result = false;
$prefix = null;
$position = self::$instance->data->position;
$s2 = self::$instance->data->consumeIf('LRB');
if ($s2 === '' || $s2 === false) {
@ -167,6 +168,10 @@ class Parser {
self::fail('(');
if ($result === false) {
self::$instance->data->unconsumeTo($position);
if (self::$debug === true) {
self::debugResult($result);