We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 20af2f6 commit 8512ec4Copy full SHA for 8512ec4
lib/rdoc/ruby_lex.rb
@@ -483,7 +483,7 @@ def lex_init()
483
"=", "==", "===",
484
"=~", "<=>",
485
"<", "<=",
486
- ">", ">=", ">>") do
+ ">", ">=", ">>", "=>") do
487
|op, io|
488
case @lex_state
489
when :EXPR_FNAME, :EXPR_DOT
lib/rdoc/ruby_token.rb
@@ -355,6 +355,7 @@ def Token(token, value = nil)
355
[:TkNEQ, TkOp, "!="],
356
[:TkGEQ, TkOp, ">="],
357
[:TkLEQ, TkOp, "<="],
358
+ [:TkHASHROCKET, TkOp, "=>"],
359
[:TkANDOP, TkOp, "&&"],
360
[:TkOROP, TkOp, "||"],
361
[:TkMATCH, TkOp, "=~"],
test/test_rdoc_ruby_lex.rb
@@ -90,6 +90,25 @@ def test_class_tokenize_hash_symbol
90
assert_equal expected, tokens
91
end
92
93
+ def test_class_tokenize_hash_rocket
94
+ tokens = RDoc::RubyLex.tokenize '{ :class => "foo" }', nil
95
+
96
+ expected = [
97
+ @TK::TkLBRACE .new( 0, 1, 0, '{'),
98
+ @TK::TkSPACE .new( 1, 1, 1, ' '),
99
+ @TK::TkSYMBOL .new( 2, 1, 2, ':class'),
100
+ @TK::TkSPACE .new( 8, 1, 8, ' '),
101
+ @TK::TkHASHROCKET.new( 9, 1, 9, '=>'),
102
+ @TK::TkSPACE .new(11, 1, 11, ' '),
103
+ @TK::TkSTRING .new(12, 1, 12, '"foo"'),
104
+ @TK::TkSPACE .new(17, 1, 17, ' '),
105
+ @TK::TkRBRACE .new(18, 1, 18, '}'),
106
+ @TK::TkNL .new(19, 1, 19, "\n"),
107
+ ]
108
109
+ assert_equal expected, tokens
110
+ end
111
112
def test_class_tokenize_heredoc_CR_NL
113
tokens = RDoc::RubyLex.tokenize <<-RUBY, nil
114
string = <<-STRING\r
0 commit comments