Class: Rley::Parser::ParseEntryTracker
- Inherits:
-
Object
- Object
- Rley::Parser::ParseEntryTracker
- Defined in:
- lib/rley/parser/parse_entry_tracker.rb
Overview
Helper class that keeps track of the parse entries used while a Parsing instance is constructing a parse forest.
Instance Attribute Summary collapse
-
#entry_set_index ⇒ Object
The index of the current entry set.
-
#parse_entry ⇒ Object
The current parse entry.
-
#processed_entries ⇒ Object
readonly
The already processed entries from current entry set.
Instance Method Summary collapse
-
#curr_dotted_item ⇒ Object
The dotted item for the current parse entry.
-
#initialize(aEntrySetIndex) ⇒ ParseEntryTracker
constructor
Constructor.
-
#select_entry(theEntrys) ⇒ Object
Take the first provided entry that wasn't processed yet.
- #symbol_on_left ⇒ Object
-
#to_prev_entry_set ⇒ Object
Notification that one begins with the previous entry set.
Constructor Details
#initialize(aEntrySetIndex) ⇒ ParseEntryTracker
Constructor.
18 19 20 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 18 def initialize(aEntrySetIndex) self.entry_set_index = aEntrySetIndex end |
Instance Attribute Details
#entry_set_index ⇒ Object
The index of the current entry set
9 10 11 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 9 def entry_set_index @entry_set_index end |
#parse_entry ⇒ Object
The current parse entry
12 13 14 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 12 def parse_entry @parse_entry end |
#processed_entries ⇒ Object (readonly)
The already processed entries from current entry set
15 16 17 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 15 def processed_entries @processed_entries end |
Instance Method Details
#curr_dotted_item ⇒ Object
The dotted item for the current parse entry.
43 44 45 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 43 def curr_dotted_item parse_entry.dotted_rule end |
#select_entry(theEntrys) ⇒ Object
Take the first provided entry that wasn't processed yet.
37 38 39 40 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 37 def select_entry(theEntrys) a_entry = theEntrys.find { |st| !processed_entries.include?(st) } self.parse_entry = a_entry end |
#symbol_on_left ⇒ Object
47 48 49 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 47 def symbol_on_left curr_dotted_item.prev_symbol end |
#to_prev_entry_set ⇒ Object
Notification that one begins with the previous entry set
52 53 54 |
# File 'lib/rley/parser/parse_entry_tracker.rb', line 52 def to_prev_entry_set self.entry_set_index = entry_set_index - 1 end |