Commit graph

14659 commits

Author SHA1 Message Date
tomoya ishida
ea2fb7460e [ruby/irb] Remove useless loaded file check
(https://github.com/ruby/irb/pull/885)

f6d489658e
2024-02-23 13:11:20 +00:00
Nobuyoshi Nakada
7da3f8dcd3 [ruby/optparse] [DOC] About return value of OptionParser#new
59b9fd7ddc
2024-02-23 12:50:08 +00:00
tomoya ishida
f0172fc7ee [ruby/irb] Remove workaround for empty lines in dynamic_prompt
(https://github.com/ruby/irb/pull/884)

820b9e8dd6
2024-02-23 12:32:59 +00:00
tomoya ishida
598b03648f [ruby/irb] Remove remaining frozen_string_literal: false in lib/
(https://github.com/ruby/irb/pull/883)

4bfdb23ae6
2024-02-23 12:32:50 +00:00
Nobuyoshi Nakada
41c0fb6991 [ruby/optparse] Add exact: keyword argument
07e83673a8
2024-02-23 21:16:59 +09:00
Stan Lo
4831bb5bab [ruby/irb] Turn on frozen literal in files
(https://github.com/ruby/irb/pull/881)

83d90550c2
2024-02-23 10:53:53 +00:00
Stan Lo
37dde6e2f8 [ruby/irb] Unroll extension method generation
(https://github.com/ruby/irb/pull/882)

* Unroll extension method generation

Given we only have 2 remaining extension setter methods, both of which
only take 1 argument and don't have any alias, the current method generation
logic is overly complicated.

This commit simplifies the method generation logic by simply defining
the methods directly in the `IRB::Context` class.

* Fix use_loader extension

67eba5401b
2024-02-23 10:02:19 +00:00
Kevin Newton
5e0589cf52 [ruby/prism] Parse float values
9137226a52
2024-02-22 22:42:44 -05:00
Kevin Newton
3b3def5db7 [ruby/prism] Regenerate snapshots using integer values 2024-02-22 22:42:44 -05:00
Kevin Newton
af0a6ea1d5 [ruby/prism] Add an IntegerField for parsing integer values
120d8c0479
2024-02-22 22:42:44 -05:00
Philip Mueller
3c61222d68 [ruby/prism] all constant nodes should have full_name and full_name_parts methods
792265ae0b
2024-02-22 21:43:02 +00:00
tomoya ishida
88431c47ba [ruby/irb] Delete IRB::NotImplementedError
(https://github.com/ruby/irb/pull/878)

6751778948
2024-02-22 13:16:46 +00:00
Noah Gibbs
551f64745f [ruby/prism] Allow skipping warnings as needed, and pass a reason through to Parser::Diagnostic
6a84a3c9fb
2024-02-21 22:38:48 +00:00
Noah Gibbs
45ae69e37e [ruby/prism] Update lib/prism/translation/parser.rb
c3cc282343

Co-authored-by: Kevin Newton <kddnewton@gmail.com>
2024-02-21 22:38:48 +00:00
Noah Gibbs
e3b9eec349 [ruby/prism] Translation::Parser should process warnings, not just errors
ea7e400f85
2024-02-21 22:38:47 +00:00
Samuel Giddins
997470b7b6 [rubygems/rubygems] Commit missing new method
5265b4ce3d
2024-02-21 17:45:00 +00:00
Samuel Giddins
5dcc7a0326 [rubygems/rubygems] Use a writer method on the module instead of a constant
240d84eea3
2024-02-21 17:45:00 +00:00
Samuel Giddins
c2812fb616 [rubygems/rubygems] Control whether YAML aliases are enabled in Gem::SafeYAML.safe_load via a constant
6bedb1cb79
2024-02-21 17:44:59 +00:00
Nobuyoshi Nakada
5ab6b3181f [ruby/fileutils] [DOC] FileUtils::VERSION
48742e2921
2024-02-21 16:57:30 +00:00
Nobuyoshi Nakada
2edc14be69 [ruby/fileutils] [DOC] nodoc for private methods and module
75c6010aab
2024-02-21 16:57:30 +00:00
Nobuyoshi Nakada
6e704311bb [ruby/pp] Extract pp_hash_pair
The method which prints single pair of a hash, to make extending
pretty printing Hash easier, apart from Hash construct itself.

3fcf2d1142
2024-02-21 16:45:01 +00:00
Nobuyoshi Nakada
37b8fc7477 [ruby/pp] Get rid of hardcoded class name
So that the `pp` method can work in inherited classes with that
class.

f204df3aad
2024-02-21 16:45:00 +00:00
Kevin Newton
82a4c3af16 Add error for iseqs compiled by prism 2024-02-21 11:44:40 -05:00
Hiroshi SHIBATA
fc1a7a46dc [rubygems/rubygems] Use Hash#compact
9d4ff6ff30

Co-authored-by: Samuel Giddins <segiddins@segiddins.me>
2024-02-21 06:39:37 +00:00
Nobuyoshi Nakada
c8fb4f308b [rubygems/rubygems] Skip nil-value keys to make metadata reproducible
Nil-value keys in a mapping end with a space or not depending on
libyaml versions, and result metadata are different per platforms.
This commit makes to skip such keys to make metadata reproducible
accross platforms.

74b4db8d30
2024-02-21 06:39:36 +00:00
Hiroshi SHIBATA
d0786cde3f [rubygems/rubygems] rake man:build
e0ef515732
2024-02-21 03:30:23 +00:00
Hiroshi SHIBATA
08753f2037 [rubygems/rubygems] Use https instead of http
bcbe6f7b7a
2024-02-21 03:30:22 +00:00
Hiroshi SHIBATA
fa3d6aafb7 [ruby/uri] Use https instead of http
ad2591f0d1
2024-02-20 10:13:30 +00:00
Hiroshi SHIBATA
f75b9dbf7d [rubygems/rubygems] Keep Gem.install_extension_in_lib for compatibility
b2bf239147
2024-02-20 05:33:16 +00:00
Hiroshi SHIBATA
a551d93655 [rubygems/rubygems] Now install extension in lib is true
bbcad80772
2024-02-20 05:33:15 +00:00
Hiroshi SHIBATA
94dd4dc3b2 [rubygems/rubygems] Gem.install_extension_in_lib is now under the Gem.configuration
c394375b28
2024-02-20 05:33:14 +00:00
Hiroshi SHIBATA
83148f8342 [rubygems/rubygems] Allow to set install_extension_in_lib as Gem configuration
c59d40f425
2024-02-20 05:33:13 +00:00
Kevin Newton
ae3e82a525 [ruby/prism] Fix up comment state
c6561becf0
2024-02-19 19:50:46 +00:00
Douglas Eichelberger
b4be283485 [rubygems/rubygems] Remove redundant rubocop configs
a3f60240bf
2024-02-19 04:48:42 +00:00
Stan Lo
7e577e150a [ruby/irb] Fix irb:rdbg for ruby head
(https://github.com/ruby/irb/pull/876)

* Update binding.irb check for Ruby head

With https://github.com/ruby/ruby/pull/9605, backtrace in Ruby head
now has a new format. This commit updates the check for binding.irb
to work with Ruby head.

* Do not include a backtick in error messages and backtraces

[Feature #16495]

---------

ebffd3d976

Co-authored-by: Yusuke Endoh <mame@ruby-lang.org>
2024-02-19 11:01:30 +09:00
Kevin Newton
ea529dd409 [ruby/prism] Lazy methods for start and end offset on node
4510e2746d
2024-02-18 21:37:13 +00:00
Kevin Newton
792804e32f [ruby/prism] Split up comments between leading and trailing
Also make them lazy to allocate the array, and also expose ParseResult#encoding.

08ec7683ae
2024-02-18 20:57:13 +00:00
Stan Lo
07c774e85c [ruby/irb] Revamp help command
(https://github.com/ruby/irb/pull/877)

* Make help command display help for individual commands

Usage: `help [command]`

If the command is not specified, it will display a list of all available commands.

If the command is specified, it will display the banner OR description of the command.

If the command is not found, it will display a message saying that the command is not found.

* Rename test/irb/cmd to test/irb/command

* Add banner to edit and ls commands

* Promote help command in the help message

1. Make `show_cmds` an alias of `help` so it's not displayed in the help message
2. Update description of the help command to reflect `help <command>` syntax

* Rename banner to help_message

43a2c99f3f
2024-02-18 18:21:08 +00:00
Kevin Newton
13301587cf [ruby/prism] Fix block_pass for []=
bf79206220
2024-02-16 20:41:52 +00:00
Noah Gibbs
e801ccb343 [ruby/prism] More rescue and ensure; constant handling
207f579e70
2024-02-16 17:50:17 +00:00
Noah Gibbs
7d3e889bbb [ruby/prism] Move visit methods into a Ripper Compiler
44c4dc5268
2024-02-16 17:50:17 +00:00
Stan Lo
f5801e2bf4 [ruby/irb] Standardize command related names
(https://github.com/ruby/irb/pull/873)

* Replace ExtendCommand with Command and standardize command related names

1. Rename lib/irb/extend-command.rb to lib/irb/command.rb
2. Rename lib/irb/cmd/*.rb to lib/irb/command/*.rb
3. Rename test/irb/test_cmd.rb to test/irb/test_command.rb
4. Rename ExtendCommand to Command

* Alias ExtendCommand to Command and deprecate it

* Rename Command::Nop to Command::Base

* Not deprecate old constants just yet

* Add lib/irb/cmd/nop.rb back

462c1284af
2024-02-16 16:47:36 +00:00
Stan Lo
b315826377 [ruby/irb] Support repeating debugger input by passing empty input
to it
(https://github.com/ruby/irb/pull/856)

* Test IRB's behaviour with empty input

* Handle empty input and pass it to debugger

Since `rdbg` accepts empty input to repeat the previous command, IRB
should take empty input in `irb:rdbg` sessions and pass them to the
debugger.

Currently, IRB simply ignores empty input and does nothing. This commit
creates `EmptyInput` to represent empty input so it can fit into the
current IRB's input processing flow in `Irb#eval_input`.

0e9db419be
2024-02-16 16:12:54 +00:00
Max Prokopiev
f012ce0d18 [ruby/prism] Fix lexing of foo! when it's a first thing to parse
7597aca76a
2024-02-16 14:08:56 +00:00
Jason Garber
6f224d66a5 [rubygems/rubygems] Add gitlab: Git source shorthand
This new shorthand, similar to the existing `github:` shorthand, adds
support for Gitlab repositories with a notable difference. Gitlab
projects may be organized into projects and subprojects. An example
Ruby gem exists at:

https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb

With the new shorthand, a user may install this gem from its repository
by adding:

```ruby
gem "gitlab-sdk", gitlab: "gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb"
```

As with the `github:` shorthand, a supplied string with no `/` will be
interpreted as `example/example`.

Also in keeping with the utility of the `github:` shorthand, the new
`gitlab:` shorthand also supports Merge Request URLs.

```ruby
gem "gitlab-sdk", gitlab: "https://gitlab.com/gitlab-org/analytics-section/product-analytics/gl-application-sdk-rb/-/merge_requests/27"
```

The `gitlab:` gem source shortcut is modeled on the existing `github:`
shortcut, so the new specs mimic the existing examples.

f4399018c0
2024-02-16 04:53:14 +00:00
Benoit Daloze
1b9b960963 [ruby/prism] Make location methods thread-safe
* Before it could result in NoMethodError if multiple threads were
  calling location methods: https://gist.github.com/eregon/b78b7f266d7ee0a278a389cfd1782232

ff762dcccd
2024-02-15 23:04:38 +00:00
Kevin Newton
e7f7a85285
[PRISM] Sync prism version bump 2024-02-15 15:50:04 -05:00
Kevin Newton
14a7277da1 [ruby/prism] Speed up creating Ruby AST
When creating the Ruby AST, we were previously allocating Location
objects for every node and every inner location. Instead, this
commit changes it to pack both the start offset and length into a
single u64 and pass that into the nodes. Then, when the locations
are requested via a reader method, we lazily allocate the Location
objects.

de203dca83

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
2024-02-15 20:39:50 +00:00
Kevin Newton
87cc2fd015 [ruby/prism] Fix up invalid syntax
8e3aad9e27
2024-02-15 20:36:48 +00:00
Noah Gibbs
a5cee8fa79 [ruby/prism] Handle more aliases. Better testing of prism ripper CLI and a test for it.
cfd4f28cb3
2024-02-15 20:26:31 +00:00