diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2020-11-09 19:49:04 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-11-10 07:49:19 +0900 |
commit | 2fed5f0ad806869139d0e0b1ffc30c517e6baf20 (patch) | |
tree | 63ba13c0e53751040b8a58c89691d988857f954d /lib/racc | |
parent | d7581370fd7cef8743c317a1a119215cf064bb73 (diff) |
lib/racc/statetransitiontable.rb: Make the racc output stable
Racc calls `Array#sort!` to build a state transition table. As
`Array#sort!` is not a stable sort, the output may differ depending upon
the environment.
This changeset makes the sort stable manually, and updates all
expectation files.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3749
Diffstat (limited to 'lib/racc')
-rw-r--r-- | lib/racc/statetransitiontable.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/racc/statetransitiontable.rb b/lib/racc/statetransitiontable.rb index 5d1288ca58..78b6da9086 100644 --- a/lib/racc/statetransitiontable.rb +++ b/lib/racc/statetransitiontable.rb @@ -231,7 +231,7 @@ module Racc map = '-' * 10240 # sort long to short - entries.sort! {|a,b| b[0].size <=> a[0].size } + entries.sort_by!.with_index {|a,i| [-a[0].size, i] } entries.each do |arr, chkval, expr, min, ptri| if upper + arr.size > map.size |