Skip to content

Commit 4fcbe6b

Browse files
committed
Fix JSON-style Hash literal for args of method
A value of JSON-style Hash literal needs EXPR_ARG for @lex_state, so a key of JSON-style Hash literal set it.
1 parent fe44516 commit 4fcbe6b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/rdoc/ruby_lex.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,16 +1380,18 @@ def identify_string(ltype, quoted = ltype, type = nil)
13801380

13811381
if peek(0) == ':' and !peek_match?(/^::/) and :EXPR_BEG == @lex_state and !@after_question
13821382
str.concat getc
1383-
return Token(TkSYMBOL, str)
1383+
@lex_state = :EXPR_ARG if peek_match?(/\s*:/)
1384+
Token(TkSYMBOL, str)
13841385
elsif subtype
1386+
@lex_state = :EXPR_END
13851387
Token(DLtype2Token[ltype], str)
13861388
else
1389+
@lex_state = :EXPR_END
13871390
Token(Ltype2Token[ltype], str)
13881391
end
13891392
ensure
13901393
@ltype = nil
13911394
@quoted = nil
1392-
@lex_state = :EXPR_END
13931395
end
13941396
end
13951397

0 commit comments

Comments
 (0)