Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use reverse_each instead of reverse.each #350

Merged
merged 1 commit into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/lrama/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def compute_yydefact

if state.reduces.map(&:selected_look_ahead).any? {|la| !la.empty? }
# Iterate reduces with reverse order so that first rule is used.
state.reduces.reverse.each do |reduce|
state.reduces.reverse_each do |reduce|
reduce.look_ahead.each do |term|
actions[term.number] = rule_id_to_action_number(reduce.rule.id)
end
Expand Down
4 changes: 2 additions & 2 deletions lib/lrama/counterexamples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def _derivations(paths)
current = :production
lookahead_sym = paths.last.to.item.end_of_rule? ? @conflict_symbol : nil

paths.reverse.each do |path|
paths.reverse_each do |path|
item = path.to.item

case current
Expand Down Expand Up @@ -97,7 +97,7 @@ def find_derivation_for_symbol(state_item, sym)
if next_sym == sym
derivation = nil

sis.reverse.each do |si|
sis.reverse_each do |si|
derivation = Derivation.new(si.item, derivation)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/lrama/grammar/code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def ==(other)
def translated_code
t_code = s_value.dup

references.reverse.each do |ref|
references.reverse_each do |ref|
first_column = ref.first_column
last_column = ref.last_column

Expand Down