1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/ripper/lib/ripper/sexp.rb: fix rdoc arround sexp.

patched by Sho Hashimoto. fixes #4599

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2011-04-25 02:28:49 +00:00
parent b5909efd13
commit 7c885222ca
2 changed files with 25 additions and 5 deletions

View file

@ -1,3 +1,8 @@
Mon Apr 25 11:02:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/ripper/lib/ripper/sexp.rb: fix rdoc arround sexp.
patched by Sho Hashimoto. fixes #4599
Mon Apr 25 08:24:04 2011 Shota Fukumori <sorah@tubusu.net>
* random.c (rb_f_rand, random_s_rand): RDocs for them.

View file

@ -14,13 +14,32 @@ class Ripper
# [EXPERIMENTAL]
# Parses +src+ and create S-exp tree.
# Returns more readable tree rather than Ripper.sexp_raw.
# This method is for mainly developper use.
#
# require 'ripper'
# require 'pp
# require 'pp'
#
# pp Ripper.sexp("def m(a) nil end")
# #=> [:program,
# [[:def,
# [:@ident, "m", [1, 4]],
# [:paren, [:params, [[:@ident, "a", [1, 6]]], nil, nil, nil, nil]],
# [:bodystmt, [[:var_ref, [:@kw, "nil", [1, 9]]]], nil, nil, nil]]]]
#
def Ripper.sexp(src, filename = '-', lineno = 1)
SexpBuilderPP.new(src, filename, lineno).parse
end
# [EXPERIMENTAL]
# Parses +src+ and create S-exp tree.
# This method is for mainly developper use.
#
# require 'ripper'
# require 'pp'
#
# pp Ripper.sexp_raw("def m(a) nil end")
# #=> [:program,
# [:stmts_add,
# [:stmts_new],
# [:def,
@ -32,10 +51,6 @@ class Ripper
# nil,
# nil]]]]
#
def Ripper.sexp(src, filename = '-', lineno = 1)
SexpBuilderPP.new(src, filename, lineno).parse
end
def Ripper.sexp_raw(src, filename = '-', lineno = 1)
SexpBuilder.new(src, filename, lineno).parse
end