diff options
author | Jemma Issroff <jemmaissroff@gmail.com> | 2023-07-20 14:51:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-20 14:51:17 -0400 |
commit | 134d8741731101b4b115e3d92ac008f6cecee1d8 (patch) | |
tree | 09c4235bf18d9bc6f6be7adf5edeec7cb3091c5c | |
parent | 639aa76e820480d707b90028972a52fd2a30957a (diff) | |
download | ruby-134d8741731101b4b115e3d92ac008f6cecee1d8.tar.gz |
Sync YARP gemspec (#8101)
* Sync YARP gemspec
We were previously not syncing the YARP gemspec over which meant
that the Ruby YARP gem was out of sync.
* Sync YARP node / lex_compat files
-rw-r--r-- | lib/yarp/lex_compat.rb | 2 | ||||
-rw-r--r-- | lib/yarp/node.rb | 7 | ||||
-rw-r--r-- | lib/yarp/yarp.gemspec | 115 | ||||
-rw-r--r-- | test/yarp/snapshots/seattlerb/pct_w_heredoc_interp_nested.txt | 28 | ||||
-rwxr-xr-x | tool/sync_default_gems.rb | 1 |
5 files changed, 150 insertions, 3 deletions
diff --git a/lib/yarp/lex_compat.rb b/lib/yarp/lex_compat.rb index 053b012270..e15f26ec95 100644 --- a/lib/yarp/lex_compat.rb +++ b/lib/yarp/lex_compat.rb @@ -169,7 +169,7 @@ module YARP USTAR: :on_op, USTAR_STAR: :on_op, WORDS_SEP: :on_words_sep, - __END__: :on___end__ + "__END__": :on___end__ }.freeze # When we produce tokens, we produce the same arrays that Ripper does. diff --git a/lib/yarp/node.rb b/lib/yarp/node.rb index d2f8863091..e3d347b05c 100644 --- a/lib/yarp/node.rb +++ b/lib/yarp/node.rb @@ -5050,10 +5050,13 @@ module YARP # Represents a rescue statement. # # begin - # rescue - # foo + # rescue Foo, *splat, Bar => ex # ^^^^^^ + # foo # end + # + # `Foo, *splat, Bar` are in the `exceptions` field. + # `ex` is in the `exception` field. class RescueNode < Node # attr_reader keyword_loc: Location attr_reader :keyword_loc diff --git a/lib/yarp/yarp.gemspec b/lib/yarp/yarp.gemspec new file mode 100644 index 0000000000..c80d37b4f9 --- /dev/null +++ b/lib/yarp/yarp.gemspec @@ -0,0 +1,115 @@ +# frozen_string_literal: true + +Gem::Specification.new do |spec| + spec.name = "yarp" + spec.version = "0.4.0" + spec.authors = ["Shopify"] + spec.email = ["ruby@shopify.com"] + + spec.summary = "Yet Another Ruby Parser" + spec.homepage = "https://github.com/ruby/yarp" + spec.license = "MIT" + + spec.require_paths = ["lib"] + spec.files = [ + "CODE_OF_CONDUCT.md", + "CONTRIBUTING.md", + "LICENSE.md", + "Makefile.in", + "README.md", + "config.h.in", + "config.yml", + "configure", + "docs/configuration.md", + "docs/design.md", + "docs/encoding.md", + "docs/extension.md", + "docs/fuzzing.md", + "docs/heredocs.md", + "docs/mapping.md", + "docs/ripper.md", + "docs/serialization.md", + "docs/testing.md", + "ext/yarp/api_node.c", + "ext/yarp/api_pack.c", + "ext/yarp/extension.c", + "ext/yarp/extension.h", + "include/yarp.h", + "include/yarp/ast.h", + "include/yarp/defines.h", + "include/yarp/diagnostic.h", + "include/yarp/enc/yp_encoding.h", + "include/yarp/node.h", + "include/yarp/pack.h", + "include/yarp/parser.h", + "include/yarp/regexp.h", + "include/yarp/unescape.h", + "include/yarp/util/yp_buffer.h", + "include/yarp/util/yp_char.h", + "include/yarp/util/yp_constant_pool.h", + "include/yarp/util/yp_list.h", + "include/yarp/util/yp_memchr.h", + "include/yarp/util/yp_newline_list.h", + "include/yarp/util/yp_state_stack.h", + "include/yarp/util/yp_string.h", + "include/yarp/util/yp_string_list.h", + "include/yarp/util/yp_strpbrk.h", + "include/yarp/version.h", + "lib/yarp.rb", + "lib/yarp/lex_compat.rb", + "lib/yarp/node.rb", + "lib/yarp/pack.rb", + "lib/yarp/ripper_compat.rb", + "lib/yarp/serialize.rb", + "src/diagnostic.c", + "src/enc/ascii.c", + "src/enc/big5.c", + "src/enc/euc_jp.c", + "src/enc/gbk.c", + "src/enc/iso_8859_1.c", + "src/enc/iso_8859_10.c", + "src/enc/iso_8859_11.c", + "src/enc/iso_8859_13.c", + "src/enc/iso_8859_14.c", + "src/enc/iso_8859_15.c", + "src/enc/iso_8859_16.c", + "src/enc/iso_8859_2.c", + "src/enc/iso_8859_3.c", + "src/enc/iso_8859_4.c", + "src/enc/iso_8859_5.c", + "src/enc/iso_8859_6.c", + "src/enc/iso_8859_7.c", + "src/enc/iso_8859_8.c", + "src/enc/iso_8859_9.c", + "src/enc/koi8_r.c", + "src/enc/shared.c", + "src/enc/shift_jis.c", + "src/enc/unicode.c", + "src/enc/windows_1251.c", + "src/enc/windows_1252.c", + "src/enc/windows_31j.c", + "src/node.c", + "src/pack.c", + "src/prettyprint.c", + "src/regexp.c", + "src/serialize.c", + "src/token_type.c", + "src/unescape.c", + "src/util/yp_buffer.c", + "src/util/yp_char.c", + "src/util/yp_constant_pool.c", + "src/util/yp_list.c", + "src/util/yp_memchr.c", + "src/util/yp_newline_list.c", + "src/util/yp_state_stack.c", + "src/util/yp_string.c", + "src/util/yp_string_list.c", + "src/util/yp_strncasecmp.c", + "src/util/yp_strpbrk.c", + "src/yarp.c", + "yarp.gemspec", + ] + + spec.extensions = ["ext/yarp/extconf.rb"] + spec.metadata["allowed_push_host"] = "https://rubygems.org" +end diff --git a/test/yarp/snapshots/seattlerb/pct_w_heredoc_interp_nested.txt b/test/yarp/snapshots/seattlerb/pct_w_heredoc_interp_nested.txt new file mode 100644 index 0000000000..89ce74ce19 --- /dev/null +++ b/test/yarp/snapshots/seattlerb/pct_w_heredoc_interp_nested.txt @@ -0,0 +1,28 @@ +ProgramNode(0...30)( + [], + StatementsNode(0...30)( + [ArrayNode(0...30)( + [StringNode(4...5)(nil, (4...5), nil, "1"), + InterpolatedStringNode(0...12)( + nil, + [EmbeddedStatementsNode(6...12)( + (6...8), + StatementsNode(8...19)( + [InterpolatedStringNode(8...19)( + (8...11), + [StringNode(15...17)(nil, (15...17), nil, "2\n")], + (17...19) + )] + ), + (11...12) + )], + nil + ), + StringNode(13...14)(nil, (13...14), nil, "3"), + StringNode(25...26)(nil, (25...26), nil, "4"), + StringNode(27...28)(nil, (27...28), nil, "5")], + (0...3), + (29...30) + )] + ) +) diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index e5dec18222..15a7ca7b6b 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -416,6 +416,7 @@ module SyncDefaultGems mv "yarp/enc/#{f}", "yarp/enc/yp_#{f}" end + cp_r("#{upstream}/yarp.gemspec", "lib/yarp") cp_r("#{upstream}/include/yarp/.", "yarp") cp_r("#{upstream}/include/yarp.h", "yarp") |