Actions
Bug #19788
closedRipper returns a symbol instead of a token as operator for "::"
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt]
Backport:
Description
require 'ripper'
class BasicParser < Ripper
EVENTS.each do |event|
module_eval(<<~RUBY, __FILE__, __LINE__ + 1)
def on_#{event}(*args)
puts "#{event}(\#{args.inspect})"
args.unshift :#{event}
args
end
RUBY
end
end
require 'pp'
BasicParser.new('a&.b').parse
# in stdout:
# ident(["a"])
# op(["&."])
# vcall([[:ident, "a"]])
# ident(["b"])
# call([[:vcall, [:ident, "a"]], [:op, "&."], [:ident, "b"]])
BasicParser.new('a::b').parse
# in stdout:
# ident(["a"])
# op(["::"])
# vcall([[:ident, "a"]])
# ident(["b"])
# call([[:vcall, [:ident, "a"]], :"::", [:ident, "b"]])
On the last line, consistent with &.
, I would have expected:
# call([[:vcall, [:ident, "a"]], [:op, "::"], [:ident, "b"]])
This is true for the "operator" argument of call
, command_call
and field
.
Is it intended?
Updated by nobu (Nobuyoshi Nakada) over 1 year ago
- Backport changed from 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN to 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED
Updated by nobu (Nobuyoshi Nakada) over 1 year ago
- Status changed from Open to Closed
Applied in changeset git|382678d4112f4afc6272244c22924d2b004274b1.
[Bug #19788] Use the result of tCOLON2
event
Updated by usa (Usaku NAKAMURA) about 1 year ago
- Backport changed from 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: DONE, 3.2: REQUIRED
ruby_3_1 25cf111f0ab426cbf1539ba8da55c880117edba9 merged revision(s) 382678d4112f4afc6272244c22924d2b004274b1.
Updated by nagachika (Tomoyuki Chikanaga) about 1 year ago
- Backport changed from 3.0: REQUIRED, 3.1: DONE, 3.2: REQUIRED to 3.0: REQUIRED, 3.1: DONE, 3.2: DONE
ruby_3_2 bb877e5b4fe81965af60a0d86daeb8ed477e8e87 merged revision(s) 382678d4112f4afc6272244c22924d2b004274b1.
Actions
Like0
Like0Like0Like0Like0