lib/rley/parser/parse_state.rb in rley-0.3.04 vs lib/rley/parser/parse_state.rb in rley-0.3.05
- old
+ new
@@ -14,15 +14,12 @@
# Equality comparison. A parse state behaves as a value object.
def ==(other)
return true if object_id == other.object_id
- if (dotted_rule == other.dotted_rule) && (origin == other.origin)
- result = true
- else
- result = false
- end
+ result = (dotted_rule == other.dotted_rule) &&
+ (origin == other.origin)
return result
end
# Returns true if the dot is at the end of the rhs of the production.
@@ -48,15 +45,15 @@
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
- if prev_position.nil?
- result = false
- else
- result = dotted_rule.position == prev_position
- end
+ result = if prev_position.nil?
+ false
+ else
+ dotted_rule.position == prev_position
+ end
return result
end
# Give a String representation of itself.
@@ -70,10 +67,10 @@
private
# Return the validated dotted item(rule)
def valid_dotted_rule(aDottedRule)
- fail StandardError, 'Dotted item cannot be nil' if aDottedRule.nil?
+ raise StandardError, 'Dotted item cannot be nil' if aDottedRule.nil?
return aDottedRule
end
end # class
end # module