Skip to content

Commit

Permalink
Sync YARP gemspec (#8101)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
jemmaissroff committed Jul 20, 2023
1 parent 639aa76 commit 134d874
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/yarp/lex_compat.rb
Expand Up @@ -169,7 +169,7 @@ class LexCompat
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.
Expand Down
7 changes: 5 additions & 2 deletions lib/yarp/node.rb
Expand Up @@ -5050,10 +5050,13 @@ def keyword
# 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
Expand Down
115 changes: 115 additions & 0 deletions 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
28 changes: 28 additions & 0 deletions 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)
)]
)
)
1 change: 1 addition & 0 deletions tool/sync_default_gems.rb
Expand Up @@ -416,6 +416,7 @@ def sync_default_gems(gem)
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")

Expand Down

0 comments on commit 134d874

Please sign in to comment.