Compare commits

..

No commits in common. "0f1c00d1a6ae0f1c360d52d9803a9fc067768d2b" and "d6e5c4325d1eb294e8f2df7d2761e987a504fe60" have entirely different histories.

4 changed files with 2 additions and 57 deletions

View File

@ -72,15 +72,6 @@ class Propane
end
end
# Return whether the item is "complete", meaning that the parse position
# marker is at the end of the rule.
#
# @return [Boolean]
# Whether the item is "complete".
def complete?
@position == @rule.components.size
end
# Get the following symbol for the Item.
#
# That is, the symbol which follows the parse position marker in the

View File

@ -17,8 +17,8 @@ class Propane
# Maps a following symbol to its ItemSet.
attr_reader :following_item_set
# @return [Set<ItemSet>]
# ItemSets leading to this item set.
# @return [Set]
# Item sets leading to this item set.
attr_reader :in_sets
# Build an ItemSet.
@ -81,18 +81,6 @@ class Propane
self == other
end
# Set of ItemSets that lead to this ItemSet.
#
# This set includes this ItemSet.
#
# @return [Set<ItemSet>]
# Set of all ItemSets that lead up to this ItemSet.
def leading_item_sets
@in_sets.reduce(Set[self]) do |result, item_set|
result + item_set.leading_item_sets
end
end
# Represent the ItemSet as a String.
#
# @return [String]

View File

@ -42,16 +42,6 @@ class Propane
@line_number = line_number
end
# Return whether the Rule is empty.
#
# A Rule is empty if it has no components.
#
# @return [Boolean]
# Whether the Rule is empty.
def empty?
@components.empty?
end
end
end

View File

@ -2,41 +2,17 @@ class Propane
class RuleSet
# @return [String]
# Name of the RuleSet.
attr_reader :name
# @return [Array<Rule>]
# Rules in the RuleSet.
attr_reader :rules
# Construct a RuleSet.
#
# @param name [String]
# Name of the RuleSet.
def initialize(name)
@name = name
@rules = []
@could_be_empty = false
end
# Add a Rule to the RuleSet.
#
# @param rule [Rule]
# Rule to add.
def <<(rule)
@rules << rule
if rule.empty?
@could_be_empty = true
end
end
# Return whether any Rule in the RuleSet is empty.
#
# @return [Boolean]
# Whether any rule in the RuleSet is empty.
def could_be_empty?
@could_be_empty
end
end