class Rley::Parser::ParseEntryTracker
Helper class that keeps track of the parse entries used while a Parsing instance is constructing a parse forest.
Attributes
The index of the current entry set
The current parse entry
The already processed entries from current entry set
Public Class Methods
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 18 def initialize(aEntrySetIndex) self.entry_set_index = aEntrySetIndex end
Constructor.
Public Instance Methods
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 45 def curr_dotted_item parse_entry&.vertex.dotted_item # steep:ignore end
The dotted item for the current parse entry. @return [Rley::Base::DottedItem, nil]
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 23 def entry_set_index=(anIndex) @processed_entries = {} @entry_set_index = anIndex end
Write accessor. Sets the value of the entry set index
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 29 def parse_entry=(aParseEntry) raise StandardError, 'Nil parse entry' if aParseEntry.nil? # @type var parse_entry : Rley::Parser::ParseEntry processed_entries[parse_entry] = true @parse_entry = aParseEntry end
Write accessor. Set the given parse entry as the current one.
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 38 def select_entry(entries) a_entry = entries.find { |st| !processed_entries.include?(st) } self.parse_entry = a_entry # steep:ignore end
Take the first provided entry that wasn’t processed yet.
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 50 def symbol_on_left curr_dotted_item&.prev_symbol end
@return [Syntax::GrmSymbol, nil] Return the symbol before the dot
Source
# File lib/rley/parser/parse_entry_tracker.rb, line 55 def to_prev_entry_set self.entry_set_index = entry_set_index - 1 end
Notification that one begins with the previous entry set