Lines Matching refs:mode
53 * @param string $mode Should only apply this
57 public function addPattern($pattern, $mode = "accept") argument
59 if (! isset($this->regexes[$mode])) {
60 $this->regexes[$mode] = new ParallelRegex($this->case);
62 $this->regexes[$mode]->addPattern($pattern);
71 … * @param string $mode Should only apply this pattern when dealing with this type of input.
74 public function addEntryPattern($pattern, $mode, $new_mode) argument
76 if (! isset($this->regexes[$mode])) {
77 $this->regexes[$mode] = new ParallelRegex($this->case);
79 $this->regexes[$mode]->addPattern($pattern, $new_mode);
86 * @param string $mode Mode to leave.
88 public function addExitPattern($pattern, $mode) argument
90 if (! isset($this->regexes[$mode])) {
91 $this->regexes[$mode] = new ParallelRegex($this->case);
93 $this->regexes[$mode]->addPattern($pattern, "__exit");
103 … * @param string $mode Should only apply this pattern when dealing with this type of input.
106 public function addSpecialPattern($pattern, $mode, $special) argument
108 if (! isset($this->regexes[$mode])) {
109 $this->regexes[$mode] = new ParallelRegex($this->case);
111 $this->regexes[$mode]->addPattern($pattern, "_$special");
117 * @param string $mode Mode to be remapped.
120 public function mapHandler($mode, $handler) argument
122 $this->mode_handlers[$mode] = $handler;
143 [$unmatched, $matched, $mode] = $parsed;
146 if (! $this->dispatchTokens($unmatched, $matched, $mode, $pos, $matchPos)) {
178 * @param bool|string $mode Mode after match. A boolean false mode causes no change.
183 protected function dispatchTokens($unmatched, $matched, $mode, $initialPos, $matchPos) argument
188 if ($this->isModeEnd($mode)) {
194 if ($this->isSpecialMode($mode)) {
195 $this->modeStack->enter($this->decodeSpecial($mode));
201 if (is_string($mode)) {
202 $this->modeStack->enter($mode);
212 * @param string $mode Mode to test.
215 protected function isModeEnd($mode) argument
217 return ($mode === "__exit");
224 * @param string $mode Mode to test.
227 protected function isSpecialMode($mode) argument
229 return str_starts_with($mode, '_');
235 * @param string $mode Mode to decode.
238 protected function decodeSpecial($mode) argument
240 return substr($mode, 1);