TextMate-style syntax highlighting in PHP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

27 lines
717 B

<?php
/** @license MIT
* Copyright 2021 Dustin Wilson et al.
* See LICENSE file for details */
declare(strict_types=1);
namespace dW\Lit\Scope;
class GroupMatcher extends Matcher {
protected ?string $prefix;
protected Matcher $selector;
public function __construct(?string $prefix, Matcher $selector) {
$this->prefix = ($prefix !== null) ? $prefix[0] : null;
$this->selector = $selector;
}
public function matches(string ...$scopes): bool {
return $this->selector->matches(...$scopes);
}
public function getPrefix(string ...$scopes): string|null|false {
if ($this->selector->matches(...$scopes)) {
return $this->prefix;
}
}
}