Issue #4543 has been updated by Hiroshi NAKAMURA.

Target version set to 1.9.3


----------------------------------------
Bug #4543: Ripper???"<<-eos\neos"???罩e幻??????若?鴻?с??????
http://redmine.ruby-lang.org/issues/4543

Author: Kazunori SAKAMOTO
Status: Assigned
Priority: Normal
Assignee: Nobuyoshi Nakada
Category: ext
Target version: 1.9.3
ruby -v: ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]


=begin
Ripper::SexpBuilder.new(%Q!<<-eos\neos!).parse
?????on_heredoc_end ??<?純??????????若?喝?冴???????障????????

???罎?荐惹????帥????若?吾?с??
ruby 1.9.3dev (2011-03-31 trunk 31223) [i686-linux]
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
ruby 1.9.1p431 (2011-02-18 revision 30908) [i686-linux]

???罎?荐主??鴻???????
require 'ripper'

class Parser < Ripper::SexpBuilder
  ms = Ripper::SexpBuilder.new('').methods
  defs = ms.map { |s| s.to_s }
    .select { |s| s.start_with?('on_') }
    .map { |s| %Q{
  def #{s}(*args)
    print '#{s}: '
    p args
  end
    }}.join
  eval(defs)
end

def parse(src)
  puts "****" + src.inspect + "****"
  Parser.new(src).parse
  puts
end

parse(%Q!<<-eos\neos!)
parse(%Q!<<-eos\n\neos!)


???絎?茵?腟????
****"<<-eos\neos"****
on_heredoc_beg: ["<<-eos"]
on_string_content: []
on_string_literal: [[]]
on_nl: ["\n"]
on_stmts_new: []
on_stmts_add: [[], [[]]]
on_program: [[[], [[]]]]

****"<<-eos\n\neos"****
on_heredoc_beg: ["<<-eos"]
on_string_content: []
on_tstring_content: ["\n"]
on_heredoc_end: ["eos"]
on_string_add: [[], ["\n"]]
on_string_literal: [[[], ["\n"]]]
on_nl: ["\n"]
on_stmts_new: []
on_stmts_add: [[], [[[], ["\n"]]]]
on_program: [[[], [[[], ["\n"]]]]]
=end



-- 
http://redmine.ruby-lang.org