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

Backport ruby core #143

Merged
merged 8 commits into from
Nov 10, 2020
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 .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ 2.7, 2.6, 2.5, 2.4, head, jruby-9.2.11.0, jruby-head ]
ruby: [ 2.7, 2.6, 2.5, 2.4, head, jruby-9.2.13.0, jruby-head ]
steps:
- uses: actions/checkout@master
- name: Set up Ruby
Expand Down
30 changes: 14 additions & 16 deletions ext/racc/cparse/cparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,12 @@ reduce0(RB_BLOCK_CALL_FUNC_ARGLIST(_, data))
void
Init_cparse(void)
{
#undef rb_intern
#define rb_intern(str) rb_intern_const(str)
VALUE Racc, Parser;
ID id_racc = rb_intern("Racc");
ID id_racc = rb_intern_const("Racc");

if (rb_const_defined(rb_cObject, id_racc)) {
Racc = rb_const_get(rb_cObject, id_racc);
Parser = rb_const_get_at(Racc, rb_intern("Parser"));
Parser = rb_const_get_at(Racc, rb_intern_const("Parser"));
}
else {
Racc = rb_define_module("Racc");
Expand All @@ -846,16 +844,16 @@ Init_cparse(void)

RaccBug = rb_eRuntimeError;

id_yydebug = rb_intern("@yydebug");
id_nexttoken = rb_intern("next_token");
id_onerror = rb_intern("on_error");
id_noreduce = rb_intern("_reduce_none");
id_errstatus = rb_intern("@racc_error_status");

id_d_shift = rb_intern("racc_shift");
id_d_reduce = rb_intern("racc_reduce");
id_d_accept = rb_intern("racc_accept");
id_d_read_token = rb_intern("racc_read_token");
id_d_next_state = rb_intern("racc_next_state");
id_d_e_pop = rb_intern("racc_e_pop");
id_yydebug = rb_intern_const("@yydebug");
id_nexttoken = rb_intern_const("next_token");
id_onerror = rb_intern_const("on_error");
id_noreduce = rb_intern_const("_reduce_none");
id_errstatus = rb_intern_const("@racc_error_status");

id_d_shift = rb_intern_const("racc_shift");
id_d_reduce = rb_intern_const("racc_reduce");
id_d_accept = rb_intern_const("racc_accept");
id_d_read_token = rb_intern_const("racc_read_token");
id_d_next_state = rb_intern_const("racc_next_state");
id_d_e_pop = rb_intern_const("racc_e_pop");
}
2 changes: 1 addition & 1 deletion lib/racc/grammarfileparser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def canonical_label(src)
end

def add_user_code(label, src)
@result.params.send(USER_CODE_LABELS[label]).push src
@result.params.public_send(USER_CODE_LABELS[label]).push src
end

end
Expand Down
1 change: 0 additions & 1 deletion lib/racc/parserfilegenerator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#
#++

require 'enumerator'
require 'racc/compat'
require 'racc/sourcetext'
require 'racc/parser-text'
Expand Down
2 changes: 1 addition & 1 deletion lib/racc/statetransitiontable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def set_table(entries, dummy, tbl, chk, ptr)
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
Expand Down
6 changes: 3 additions & 3 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ def strip_version(source)
end

def assert_output_unchanged(asset)
# racc generates the difference results in GitHub Actions
omit unless RUBY_PLATFORM =~ /darwin/

file = File.basename(asset, '.y')

# Code to re-generate the expectation files
# File.write("#{REGRESS_DIR}/#{file}", File.read("#{@TAB_DIR}/#{file}"))

expected = File.read("#{REGRESS_DIR}/#{file}")
actual = File.read("#{@TAB_DIR}/#{file}")
result = (strip_version(expected) == strip_version(actual))
Expand Down
190 changes: 95 additions & 95 deletions test/regress/cadenza
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# DO NOT MODIFY!!!!
# This file is automatically generated by Racc 1.4.16
# This file is automatically generated by Racc 1.5.0
# from Racc grammar file "".
#

Expand All @@ -17,81 +17,81 @@ module_eval(<<'...end cadenza.y/module_eval...', 'cadenza.y', 171)
##### State transition tables begin ###

racc_action_table = [
37, 89, 90, 20, 21, 22, 23, 24, 121, 3,
89, 4, 72, 37, 71, 3, 68, 39, 3, 29,
43, 37, 65, 66, 33, 9, 34, 110, 74, 50,
35, 9, 37, 36, 9, 122, 38, 33, 128, 34,
77, 78, 79, 35, 89, 33, 36, 34, 37, 38,
3, 35, 46, 17, 36, 85, 33, 38, 34, 37,
76, 103, 35, 75, 83, 36, 9, 131, 38, 54,
55, 3, 33, 4, 34, 124, 78, 79, 35, 65,
66, 36, 67, 33, 38, 34, 125, 9, 109, 35,
56, 57, 36, 54, 55, 38, 20, 21, 22, 23,
24, 20, 21, 22, 23, 24, 20, 21, 22, 23,
24, 108, 29, 65, 66, 54, 55, 29, 56, 57,
111, 107, 29, 20, 21, 22, 23, 24, 20, 21,
22, 23, 24, 20, 21, 22, 23, 24, 112, 29,
3, 113, 116, 114, 29, 115, 3, 103, 39, 29,
20, 21, 22, 23, 24, 120, 9, 20, 21, 22,
23, 24, 9, 3, nil, 4, 29, 3, 3, 43,
46, nil, 3, 29, 87, 3, 3, 4, 116, 9,
56, 57, nil, 9, 9, 56, 57, 3, 9, 116,
nil, 9, 9, 20, 21, 22, 23, 24, 20, 21,
22, 23, 24, 9, 65, 66, 56, 57, nil, 29,
56, 57, 106, nil, 29, 58, 59, 60, 61, 62,
63, 58, 59, 60, 61, 62, 63, 20, 21, 22,
23, 24, 20, 21, 22, 23, 24, 20, 21, 22,
23, 24, 20, 21, 22, 23, 24, 20, 21, 22,
23, 24, 20, 21, 22, 23, 24, 20, 21, 22,
23, 24, 20, 21, 22, 23, 24, 20, 21, 22,
23, 24, 20, 21, 22, 23, 24, 20, 21, 22,
23, 24, 56, 57, 65, 66 ]
37, 89, 65, 66, 20, 21, 22, 23, 24, 17,
106, 37, 3, 76, 4, 3, 75, 4, 50, 37,
29, 68, 65, 66, 33, 67, 34, 110, 9, 74,
35, 9, 37, 36, 71, 33, 38, 34, 77, 78,
79, 35, 72, 33, 36, 34, 37, 38, 3, 35,
39, 83, 36, 54, 55, 38, 33, 89, 34, 37,
90, 3, 35, 43, 9, 36, 85, 103, 38, 108,
33, 109, 34, 56, 57, 111, 35, 9, 3, 36,
46, 122, 38, 33, 112, 34, 113, 78, 79, 35,
114, 3, 36, 4, 9, 38, 20, 21, 22, 23,
24, 20, 21, 22, 23, 24, 115, 9, 65, 66,
65, 66, 29, 54, 55, 120, 107, 29, 20, 21,
22, 23, 24, 20, 21, 22, 23, 24, 20, 21,
22, 23, 24, 3, 29, 39, 3, 121, 4, 29,
3, 3, 43, 46, 29, 3, 124, 87, 125, 9,
54, 55, 9, 56, 57, 128, 9, 9, 3, 103,
116, 9, 20, 21, 22, 23, 24, 20, 21, 22,
23, 24, 131, 3, 9, 116, 56, 57, 29, 3,
89, 116, nil, 29, 20, 21, 22, 23, 24, 9,
20, 21, 22, 23, 24, 9, 56, 57, 56, 57,
29, 20, 21, 22, 23, 24, 29, 58, 59, 60,
61, 62, 63, 56, 57, 56, 57, 29, 58, 59,
60, 61, 62, 63, 20, 21, 22, 23, 24, 20,
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
21, 22, 23, 24, 20, 21, 22, 23, 24, 65,
66 ]

racc_action_check = [
87, 73, 53, 37, 37, 37, 37, 37, 85, 2,
52, 2, 36, 39, 35, 5, 32, 5, 6, 37,
6, 46, 51, 51, 87, 2, 87, 73, 37, 17,
87, 5, 43, 87, 6, 87, 87, 39, 122, 39,
39, 39, 39, 39, 129, 46, 39, 46, 116, 39,
7, 46, 7, 1, 46, 46, 43, 46, 43, 4,
38, 125, 43, 38, 43, 43, 7, 126, 43, 26,
26, 8, 116, 8, 116, 103, 116, 116, 116, 31,
31, 116, 31, 4, 116, 4, 105, 8, 72, 4,
27, 27, 4, 93, 93, 4, 24, 24, 24, 24,
24, 33, 33, 33, 33, 33, 34, 34, 34, 34,
34, 71, 24, 70, 70, 94, 94, 33, 95, 95,
75, 70, 34, 108, 108, 108, 108, 108, 89, 89,
89, 89, 89, 124, 124, 124, 124, 124, 76, 108,
118, 77, 118, 78, 89, 79, 41, 67, 41, 124,
3, 3, 3, 3, 3, 83, 118, 20, 20, 20,
20, 20, 41, 42, nil, 42, 3, 45, 48, 45,
48, nil, 49, 20, 49, 0, 82, 0, 82, 42,
96, 96, nil, 45, 48, 97, 97, 81, 49, 81,
nil, 0, 82, 65, 65, 65, 65, 65, 66, 66,
66, 66, 66, 81, 69, 69, 98, 98, nil, 65,
99, 99, 69, nil, 66, 28, 28, 28, 28, 28,
28, 64, 64, 64, 64, 64, 64, 57, 57, 57,
57, 57, 29, 29, 29, 29, 29, 58, 58, 58,
58, 58, 59, 59, 59, 59, 59, 63, 63, 63,
63, 63, 54, 54, 54, 54, 54, 55, 55, 55,
55, 55, 56, 56, 56, 56, 56, 61, 61, 61,
61, 61, 62, 62, 62, 62, 62, 60, 60, 60,
60, 60, 100, 100, 123, 123 ]
4, 73, 69, 69, 37, 37, 37, 37, 37, 1,
69, 39, 0, 38, 0, 2, 38, 2, 17, 43,
37, 32, 31, 31, 4, 31, 4, 73, 0, 37,
4, 2, 46, 4, 35, 39, 4, 39, 39, 39,
39, 39, 36, 43, 39, 43, 87, 39, 5, 43,
5, 43, 43, 26, 26, 43, 46, 52, 46, 116,
53, 6, 46, 6, 5, 46, 46, 67, 46, 71,
87, 72, 87, 27, 27, 75, 87, 6, 7, 87,
7, 87, 87, 116, 76, 116, 77, 116, 116, 116,
78, 8, 116, 8, 7, 116, 3, 3, 3, 3,
3, 20, 20, 20, 20, 20, 79, 8, 70, 70,
51, 51, 3, 93, 93, 83, 70, 20, 24, 24,
24, 24, 24, 33, 33, 33, 33, 33, 34, 34,
34, 34, 34, 41, 24, 41, 42, 85, 42, 33,
45, 48, 45, 48, 34, 49, 103, 49, 105, 41,
94, 94, 42, 95, 95, 122, 45, 48, 81, 125,
81, 49, 65, 65, 65, 65, 65, 66, 66, 66,
66, 66, 126, 82, 81, 82, 96, 96, 65, 118,
129, 118, nil, 66, 89, 89, 89, 89, 89, 82,
108, 108, 108, 108, 108, 118, 97, 97, 98, 98,
89, 124, 124, 124, 124, 124, 108, 28, 28, 28,
28, 28, 28, 99, 99, 100, 100, 124, 64, 64,
64, 64, 64, 64, 29, 29, 29, 29, 29, 54,
54, 54, 54, 54, 55, 55, 55, 55, 55, 56,
56, 56, 56, 56, 57, 57, 57, 57, 57, 58,
58, 58, 58, 58, 59, 59, 59, 59, 59, 60,
60, 60, 60, 60, 61, 61, 61, 61, 61, 62,
62, 62, 62, 62, 63, 63, 63, 63, 63, 123,
123 ]

racc_action_pointer = [
151, 53, -15, 147, 56, -9, -6, 26, 47, nil,
nil, nil, nil, nil, nil, nil, nil, 29, nil, nil,
154, nil, nil, nil, 93, nil, 60, 79, 202, 229,
nil, 59, -9, 98, 103, 11, 9, 0, 57, 10,
nil, 122, 139, 29, nil, 143, 18, nil, 144, 148,
nil, 2, 8, -6, 249, 254, 259, 224, 234, 239,
274, 264, 269, 244, 208, 190, 195, 144, nil, 184,
93, 77, 60, -1, nil, 92, 110, 113, 115, 117,
nil, 163, 152, 127, nil, -20, nil, -3, nil, 125,
nil, nil, nil, 84, 106, 107, 169, 174, 195, 199,
271, nil, nil, 53, nil, 63, nil, nil, 120, nil,
nil, nil, nil, nil, nil, nil, 45, nil, 116, nil,
nil, nil, 10, 264, 130, 58, 39, nil, nil, 42,
-12, 9, -9, 93, -3, 24, 37, 54, 67, nil,
nil, nil, nil, nil, nil, nil, nil, 18, nil, nil,
98, nil, nil, nil, 115, nil, 44, 62, 194, 221,
nil, 2, -4, 120, 125, 31, 39, 1, 10, 8,
nil, 109, 112, 16, nil, 116, 29, nil, 117, 121,
nil, 90, 55, 52, 226, 231, 236, 241, 246, 251,
256, 261, 266, 271, 205, 159, 164, 64, nil, -18,
88, 35, 43, -1, nil, 47, 56, 58, 62, 78,
nil, 134, 149, 87, nil, 109, nil, 43, nil, 181,
nil, nil, nil, 104, 141, 142, 165, 185, 187, 202,
204, nil, nil, 124, nil, 125, nil, nil, 187, nil,
nil, nil, nil, nil, nil, nil, 56, nil, 155, nil,
nil, nil, 127, 259, 198, 156, 144, nil, nil, 178,
nil, nil ]

racc_action_default = [
Expand All @@ -111,37 +111,37 @@ racc_action_default = [
-32, -46 ]

racc_goto_table = [
18, 40, 19, 32, 104, 51, 52, 105, 2, 88,
47, 101, 102, 41, 45, 48, 49, 44, 69, 70,
1, 42, 51, 73, 53, 95, 96, 97, 98, 99,
100, 91, 92, 93, 94, 64, nil, 80, nil, 18,
nil, 19, nil, 18, nil, 19, 18, 18, 19, 19,
82, 86, nil, nil, nil, nil, 84, 81, nil, nil,
19, 40, 18, 32, 104, 52, 51, 1, 2, 64,
47, 91, 92, 41, 45, 48, 49, 44, 42, 69,
70, 105, 73, 51, 53, 95, 96, 97, 98, 99,
100, 93, 94, 101, 102, 88, nil, 80, nil, 19,
nil, 18, nil, 19, nil, 18, 19, 19, 18, 18,
82, 86, nil, nil, 81, nil, 84, nil, nil, nil,
nil, nil, 130, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, 123, nil, nil, 117, 119, nil,
18, nil, 19, nil, nil, nil, nil, nil, nil, 118,
nil, nil, nil, nil, nil, 123, nil, 117, 119, nil,
19, nil, 18, nil, nil, nil, nil, nil, nil, 118,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, 126, 51,
129, nil, nil, nil, 127, nil, 18, nil, 19 ]
nil, nil, nil, nil, nil, nil, nil, nil, 126, 129,
51, nil, nil, nil, 127, nil, 19, nil, 18 ]

racc_goto_check = [
28, 16, 27, 6, 11, 4, 3, 12, 2, 25,
22, 10, 10, 2, 2, 2, 2, 19, 4, 4,
1, 15, 4, 3, 6, 8, 8, 8, 8, 8,
8, 5, 5, 7, 7, 9, nil, 16, nil, 28,
nil, 27, nil, 28, nil, 27, 28, 28, 27, 27,
2, 22, nil, nil, nil, nil, 19, 15, nil, nil,
27, 16, 28, 6, 11, 3, 4, 1, 2, 9,
22, 5, 5, 2, 2, 2, 2, 19, 15, 4,
4, 12, 3, 4, 6, 8, 8, 8, 8, 8,
8, 7, 7, 10, 10, 25, nil, 16, nil, 27,
nil, 28, nil, 27, nil, 28, 27, 27, 28, 28,
2, 22, nil, nil, 15, nil, 19, nil, nil, nil,
nil, nil, 11, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, 4, nil, nil, 16, 16, nil,
28, nil, 27, nil, nil, nil, nil, nil, nil, 2,
nil, nil, nil, nil, nil, 4, nil, 16, 16, nil,
27, nil, 28, nil, nil, nil, nil, nil, nil, 2,
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
nil, nil, nil, nil, nil, nil, nil, nil, 6, 4,
3, nil, nil, nil, 16, nil, 28, nil, 27 ]
nil, nil, nil, nil, nil, nil, nil, nil, 6, 3,
4, nil, nil, nil, 16, nil, 27, nil, 28 ]

racc_goto_pointer = [
nil, 20, 8, -14, -15, -23, 0, -23, -33, 6,
-54, -63, -60, nil, nil, 16, -4, nil, nil, 11,
nil, nil, 3, nil, nil, -40, nil, 0, -2 ]
nil, 7, 8, -15, -14, -43, 0, -25, -33, -20,
-32, -63, -46, nil, nil, 13, -4, nil, nil, 11,
nil, nil, 3, nil, nil, -14, nil, -2, 0 ]

racc_goto_default = [
nil, nil, nil, nil, 31, 25, nil, 26, 27, 28,
Expand Down
Loading