Skip to content

Commit 6c37045

Browse files
committed
Fix handling hash rocket token after symbol
The method what creates TkIDENTIFIER, identify_identifier, it takes continuing `=` for method name as symbol because `RDoc::RubyLex` handles some symbols via TkSYMBEG and TkIDENTIFIER. But it is sometimes broken for hash literal, like below: { :method_name => :value } # keys is :method_name, success { :method_name= => :value } # key is :method_name=, success { :method_name=> :value } # key is :method_name, failure This commit fixes the behaviour.
1 parent 0c47b30 commit 6c37045

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/rdoc/ruby_lex.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ def identify_identifier
966966

967967
if @lex_state == :EXPR_FNAME
968968
@lex_state = :EXPR_END
969-
if peek(0) == '='
969+
if peek(0) == '=' and peek(1) != '>'
970970
token.concat getc
971971
end
972972
elsif @lex_state == :EXPR_BEG || @lex_state == :EXPR_DOT ||

0 commit comments

Comments
 (0)