diff options
-rw-r--r-- | lib/rdoc/parser/ripper_state_lex.rb | 2 | ||||
-rw-r--r-- | test/rdoc/test_rdoc_parser_ruby.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/rdoc/parser/ripper_state_lex.rb b/lib/rdoc/parser/ripper_state_lex.rb index 5492f08726..27d7373270 100644 --- a/lib/rdoc/parser/ripper_state_lex.rb +++ b/lib/rdoc/parser/ripper_state_lex.rb @@ -368,7 +368,7 @@ class RDoc::Parser::RipperStateLex private def get_symbol_tk(tk) is_symbol = true symbol_tk = Token.new(tk.line_no, tk.char_no, :on_symbol) - if ":'" == tk[:text] or ':"' == tk[:text] + if ":'" == tk[:text] or ':"' == tk[:text] or tk[:text].start_with?('%s') tk1 = get_string_tk(tk) symbol_tk[:text] = tk1[:text] symbol_tk[:state] = tk1[:state] diff --git a/test/rdoc/test_rdoc_parser_ruby.rb b/test/rdoc/test_rdoc_parser_ruby.rb index aea923765c..1f75ba7c6e 100644 --- a/test/rdoc/test_rdoc_parser_ruby.rb +++ b/test/rdoc/test_rdoc_parser_ruby.rb @@ -3205,6 +3205,14 @@ RUBY assert_nil @parser.parse_symbol_in_arg end + def test_parse_percent_symbol + content = '%s[foo bar]' + util_parser content + tk = @parser.get_tk + assert_equal :on_symbol, tk[:kind] + assert_equal content, tk[:text] + end + def test_parse_statements_alias_method content = <<-CONTENT class A |