Project

General

Profile

Bug #3764

Ripper incorrectly handle literal keywords (as symbol, eg. :class)

Added by ngtzeyang (TzeYang Ng) about 9 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
1.9.3
Backport:
[:]

Description

=begin
Given the following use case of ripper:

pp Ripper.lex(':class')

I'm gettting:

[[[1, 0], :on_symbeg, ":"], [[1, 1], :on_kw, "class"]]

I'm thinking the output should be:

[[[1, 0], :on_symbeg, ":"], [[1, 1], :on_ident, "class"]]

Seems like a bug ?
=end

History

#1

Updated by ngtzeyang (TzeYang Ng) about 9 years ago

=begin
ruby -v
# >> ruby 1.9.1p376 (2009-12-07 revision 26041) [x86_64-linux]
=end

#2

Updated by eitoball (Eito Katagiri) about 9 years ago

=begin
No, I don't think that it is a bug.

It doesn't have to be an identifier after colon for a symbol.
":$0", ":VERSION", and ":>" are valid symbols. You might want
to take a look at parse.y in Ruby source code to see what can
be after colon for a symbol.
=end

#3

Updated by naruse (Yui NARUSE) about 9 years ago

  • Status changed from Open to Rejected
  • ruby -v set to 1.9.3

=begin
It can be a trap, but it is spec.
=end

Also available in: Atom PDF