Lines Matching refs:this

137         $this->_tokens  = $tokens;
138 $this->_rules = $rules;
139 $this->_pragmas = $pragmas;
157 if (isset($this->_pragmas['parser.lookahead'])) {
158 $k = max(0, intval($this->_pragmas['parser.lookahead']));
161 $lexer = new Lexer($this->_pragmas);
162 $this->_tokenSequence = new Iterator\Buffer(
163 $lexer->lexMe($text, $this->_tokens),
166 $this->_tokenSequence->rewind();
168 $this->_errorToken = null;
169 $this->_trace = [];
170 $this->_todo = [];
172 if (false === array_key_exists($rule, $this->_rules)) {
173 $rule = $this->getRootRule();
178 $this->_todo = [$closeRule, $openRule];
181 $out = $this->unfold();
184 'EOF' === $this->_tokenSequence->current()['token']) {
188 if (false === $this->backtrack()) {
189 $token = $this->_errorToken;
191 if (null === $this->_errorToken) {
192 $token = $this->_tokenSequence->current();
236 $tree = $this->_buildTree();
245 return $this->_tree = $tree;
255 while (0 < count($this->_todo)) {
256 $rule = array_pop($this->_todo);
259 $rule->setDepth($this->_depth);
260 $this->_trace[] = $rule;
263 --$this->_depth;
268 $zeRule = $this->_rules[$ruleName];
269 $out = $this->_parse($zeRule, $next);
271 if (false === $out && false === $this->backtrack()) {
290 $name = $this->_tokenSequence->current()['token'];
296 $value = $this->_tokenSequence->current()['value'];
299 for ($skip = 0, $i = count($this->_trace) - 1; $i >= 0; --$i) {
300 $trace = $this->_trace[$i];
304 if ($trace->getDepth() <= $this->_depth) {
312 $skip += $trace->getDepth() > $this->_depth;
327 $namespace = $this->_tokenSequence->current()['namespace'];
332 if (isset($this->_tokens[$namespace][$name])) {
333 $zzeRule->setRepresentation($this->_tokens[$namespace][$name]);
335 foreach ($this->_tokens[$namespace] as $_name => $regex) {
350 array_pop($this->_todo);
351 $this->_trace[] = $zzeRule;
352 $this->_tokenSequence->next();
353 $this->_errorToken = $this->_tokenSequence->current();
358 ++$this->_depth;
361 $this->_trace[] = new Rule\Entry(
365 $this->_depth
371 $this->_todo[] = new Rule\Ekzit($nextRule, 0);
372 $this->_todo[] = new Rule\Entry($nextRule, 0);
384 ++$this->_depth;
387 $this->_trace[] = new Rule\Entry(
390 $this->_todo,
391 $this->_depth
394 $this->_todo[] = new Rule\Ekzit($nextRule, 0);
395 $this->_todo[] = new Rule\Entry($nextRule, 0);
406 ++$this->_depth;
409 $this->_trace[] = new Rule\Entry(
413 $this->_depth
415 array_pop($this->_todo);
416 $this->_todo[] = new Rule\Ekzit(
419 $this->_todo
423 $this->_todo[] = new Rule\Ekzit($nextRule, 0);
424 $this->_todo[] = new Rule\Entry($nextRule, 0);
435 $this->_todo[] = new Rule\Ekzit(
438 $this->_todo
440 $this->_todo[] = new Rule\Ekzit($nextRule, 0);
441 $this->_todo[] = new Rule\Entry($nextRule, 0);
460 $last = array_pop($this->_trace);
463 $zeRule = $this->_rules[$last->getRule()];
466 $zeRule = $this->_rules[$last->getRule()];
469 $this->_tokenSequence->previous();
471 if (false === $this->_tokenSequence->valid()) {
475 } while (0 < count($this->_trace) && false === $found);
483 $this->_depth = $last->getDepth();
484 $this->_todo = $last->getTodo();
485 $this->_todo[] = new Rule\Entry($rule, $next);
500 $max = count($this->_trace);
503 $trace = $this->_trace[$i];
507 $rule = $this->_rules[$ruleName];
509 $nextTrace = $this->_trace[$i + 1];
531 $i = $this->_buildTree($i + 1, $children);
568 true === $this->mergeTree($children, $handle, $cId)) {
573 true === $this->mergeTree($children, $handle, $cId, true)) {
636 $this->mergeTreeRecursive($last, $child);
681 $this->mergeTreeRecursive($last, $child);
694 return $this->_tree;
704 return $this->_trace;
714 return $this->_pragmas;
724 return $this->_tokens;
734 return $this->_tokenSequence;
745 if (!isset($this->_rules[$name])) {
749 return $this->_rules[$name];
759 return $this->_rules;
769 foreach ($this->_rules as $rule => $_) {