Class: Parslet::Atoms::Rule::Position::LR
- Inherits:
-
Struct
- Object
- Struct
- Parslet::Atoms::Rule::Position::LR
- Defined in:
- lib/parslet/atoms/rule/position.rb
Overview
A LR is info holder for left recursion
seed: the last left recursion exp parse result
rule: the rule starting left recursion
head: when left recursion detected, head holds info to re-eval involved rules
Defined Under Namespace
Classes: Head
Instance Attribute Summary collapse
-
#head ⇒ Object
Returns the value of attribute head.
-
#pos ⇒ Object
Returns the value of attribute pos.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#seed ⇒ Object
(also: #answer)
Returns the value of attribute seed.
Instance Method Summary collapse
Instance Attribute Details
#head ⇒ Object
Returns the value of attribute head
11 12 13 |
# File 'lib/parslet/atoms/rule/position.rb', line 11 def head @head end |
#pos ⇒ Object
Returns the value of attribute pos
11 12 13 |
# File 'lib/parslet/atoms/rule/position.rb', line 11 def pos @pos end |
#rule ⇒ Object
Returns the value of attribute rule
11 12 13 |
# File 'lib/parslet/atoms/rule/position.rb', line 11 def rule @rule end |
#seed ⇒ Object Also known as: answer
Returns the value of attribute seed
11 12 13 |
# File 'lib/parslet/atoms/rule/position.rb', line 11 def seed @seed end |
Instance Method Details
#detected? ⇒ Boolean
32 33 34 |
# File 'lib/parslet/atoms/rule/position.rb', line 32 def detected? self.head != nil end |
#setup_for_re_eval_involved_rules(lr_stack) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/parslet/atoms/rule/position.rb', line 36 def setup_for_re_eval_involved_rules(lr_stack) self.head ||= Head.new(rule, [], []) lr_stack.top_down do |lr| return if lr.head == self.head lr.head = self.head self.head.involved_rules.push lr.rule end end |