lib/rley/parser/parse_state.rb in rley-0.7.00 vs lib/rley/parser/parse_state.rb in rley-0.7.01
- old
+ new
@@ -14,11 +14,11 @@
# Equality comparison. A parse state behaves as a value object.
def ==(other)
return true if object_id == other.object_id
- result = (dotted_rule == other.dotted_rule) &&
+ result = (dotted_rule == other.dotted_rule) &&
(origin == other.origin)
return result
end
@@ -41,9 +41,10 @@
# Does this parse state have the 'other' as successor?
def precedes?(other)
return false if other == self
return false unless origin == other.origin
+
other_production = other.dotted_rule.production
return false unless dotted_rule.production == other_production
prev_position = other.dotted_rule.prev_position
result = if prev_position.nil?