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.
 
 

25 lines
693 B

<?php
/** @license MIT
* Copyright 2021 Dustin Wilson et al.
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace dW\Highlighter\Scope;
class OrMatcher extends Matcher {
protected Matcher $left;
protected Matcher $right;
public function __construct(Matcher $left, Matcher $right) {
$this->left = $left;
$this->right = $right;
}
public function matches(array $scopes): bool {
return ($this->left->matches($scopes) || $this->right->matches($scopes));
}
public function getPrefix(array $scopes): string|null|false {
return $this->left->getPrefix($scopes) || $this->right->getPrefix($scopes);
}
}