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
706 B
25 lines
706 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 CompositeMatcher extends Matcher {
|
|
protected Matcher $matcher;
|
|
|
|
public function __construct(Matcher $left, string $operator, Matcher $right) {
|
|
switch ($operator) {
|
|
case '|':
|
|
$this->matcher = new OrMatcher($left, $right);
|
|
break;
|
|
case '&':
|
|
$this->matcher = new AndMatcher($left, $right);
|
|
break;
|
|
case '-':
|
|
$this->matcher = new AndMatcher($left, new NegateMatcher($right));
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|