Skip to content

Commit

Permalink
Use rule_id instead of rule.id
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Jan 24, 2024
1 parent 87f6414 commit bfa0a63
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/lrama/states/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class States
class Item < Struct.new(:rule, :position, keyword_init: true)
# Optimization for States#setup_state
def hash
[rule.id, position].hash
[rule_id, position].hash
end

def rule_id
Expand Down Expand Up @@ -66,13 +66,13 @@ def to_s

def display_name
r = rule.rhs.map(&:display_name).insert(position, "•").join(" ")
"#{r} (rule #{rule.id})"
"#{r} (rule #{rule_id})"
end

# Right after position
def display_rest
r = rule.rhs[position..-1].map(&:display_name).join(" ")
". #{r} (rule #{rule.id})"
". #{r} (rule #{rule_id})"
end
end
end
Expand Down

0 comments on commit bfa0a63

Please sign in to comment.