Lines Matching refs:mode

60      * @param string $mode         Should only apply this
64 public function addPattern($pattern, $mode = "accept") argument
66 if (! isset($this->regexes[$mode])) {
67 $this->regexes[$mode] = new ParallelRegex($this->case);
69 $this->regexes[$mode]->addPattern($pattern);
78 … * @param string $mode Should only apply this pattern when dealing with this type of input.
81 public function addEntryPattern($pattern, $mode, $new_mode) argument
83 if (! isset($this->regexes[$mode])) {
84 $this->regexes[$mode] = new ParallelRegex($this->case);
86 $this->regexes[$mode]->addPattern($pattern, $new_mode);
93 * @param string $mode Mode to leave.
95 public function addExitPattern($pattern, $mode) argument
97 if (! isset($this->regexes[$mode])) {
98 $this->regexes[$mode] = new ParallelRegex($this->case);
100 $this->regexes[$mode]->addPattern($pattern, self::MODE_EXIT);
110 … * @param string $mode Should only apply this pattern when dealing with this type of input.
113 public function addSpecialPattern($pattern, $mode, $special) argument
115 if (! isset($this->regexes[$mode])) {
116 $this->regexes[$mode] = new ParallelRegex($this->case);
118 $this->regexes[$mode]->addPattern($pattern, self::MODE_SPECIAL_PREFIX . $special);
124 * @param string $mode Mode to be remapped.
127 public function mapHandler($mode, $handler) argument
129 $this->mode_handlers[$mode] = $handler;
148 [$unmatched, $matched, $mode] = $parsed;
150 if (! $this->dispatchTokens($unmatched, $matched, $mode, $offset, $matchPos)) {
182 * @param bool|string $mode Mode after match. A boolean false mode causes no change.
187 protected function dispatchTokens($unmatched, $matched, $mode, $initialPos, $matchPos) argument
192 if ($this->isModeEnd($mode)) {
198 if ($this->isSpecialMode($mode)) {
199 $this->modeStack->enter($this->decodeSpecial($mode));
205 if (is_string($mode)) {
206 $this->modeStack->enter($mode);
216 * @param string $mode Mode to test.
219 protected function isModeEnd($mode) argument
221 return ($mode === self::MODE_EXIT);
228 * @param string $mode Mode to test.
231 protected function isSpecialMode($mode) argument
233 return str_starts_with($mode, self::MODE_SPECIAL_PREFIX);
239 * @param string $mode Mode to decode.
242 protected function decodeSpecial($mode) argument
244 return substr($mode, strlen(self::MODE_SPECIAL_PREFIX));