U:RDoc::NormalClass[iI"Ripper:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[#o:RDoc::Markup::Paragraph;[I"$Ripper is a Ruby script parser.;To:RDoc::Markup::BlankLine o; ;[I"EYou can get information from the parser with event-based style. ;TI"QInformation such as abstract syntax trees or simple lexical analysis of the ;TI"Ruby program.;T@S:RDoc::Markup::Heading:
leveli: textI"
Usage;T@o; ;[I"PRipper provides an easy interface for parsing your program into a symbolic ;TI"'expression tree (or S-expression).;T@o; ;[I"JUnderstanding the output of the parser may come as a challenge, it's ;TI"@recommended you use PP to format the output for legibility.;T@o:RDoc::Markup::Verbatim;[I"require 'ripper'
;TI"require 'pp'
;TI"
;TI"@pp Ripper.sexp('def hello(world) "Hello, #{world}!"; end')
;TI" #=> [:program,
;TI" [[:def,
;TI"* [:@ident, "hello", [1, 4]],
;TI" [:paren,
;TI"X [:params, [[:@ident, "world", [1, 10]]], nil, nil, nil, nil, nil, nil]],
;TI" [:bodystmt,
;TI"" [[:string_literal,
;TI"# [:string_content,
;TI"; [:@tstring_content, "Hello, ", [1, 18]],
;TI"P [:string_embexpr, [[:var_ref, [:@ident, "world", [1, 27]]]]],
;TI"8 [:@tstring_content, "!", [1, 33]]]]],
;TI" nil,
;TI" nil,
;TI" nil]]]]
;T:@format0o; ;[I"MYou can see in the example above, the expression starts with +:program+.;T@o; ;[I"SFrom here, a method definition at +:def+, followed by the method's identifier ;TI"O:@ident
. After the method's identifier comes the parentheses ;TI"8+:paren+ and the method parameters under +:params+.;T@o; ;[I"RNext is the method body, starting at +:bodystmt+ (+stmt+ meaning statement), ;TI"6which contains the full definition of the method.;T@o; ;[I"GIn our case, we're simply returning a String, so next we have the ;TI""+:string_literal+ expression.;T@o; ;[
I"SWithin our +:string_literal+ you'll notice two @tstring_content
, ;TI"Sthis is the literal part for Hello,
and !
. Between ;TI"Nthe two @tstring_content
statements is a +:string_embexpr+, ;TI"Swhere _embexpr_ is an embedded expression. Our expression consists of a local ;TI"Rvariable, or +var_ref+, with the identifier (@ident
) of +world+.;T@S;;i;
I"Resources;T@o:RDoc::Markup::List:
@type:BULLET:@items[o:RDoc::Markup::ListItem:@label0;[o; ;[I"i{Ruby Inside}[http://www.rubyinside.com/using-ripper-to-see-how-ruby-is-parsing-your-code-5270.html];T@S;;i;
I"Requirements;T@o;;;;[o;;0;[o; ;[I"%ruby 1.9 (support CVS HEAD only);To;;0;[o; ;[I"2bison 1.28 or later (Other yaccs do not work);T@S;;i;
I"License;T@o;;[
I"Ruby License.
;TI"
;TI"? Minero Aoki
;TI"? aamine@loveruby.net
;TI"> http://i.loveruby.net;T;0:
@fileI"ext/ripper/lib/ripper.rb;T:0@omit_headings_from_table_of_contents_below0o;;[ ;I""ext/ripper/lib/ripper/core.rb;T;0o;;[ ;I"$ext/ripper/lib/ripper/filter.rb;T;0o;;[ ;I"#ext/ripper/lib/ripper/lexer.rb;T;0o;;[ ;I""ext/ripper/lib/ripper/sexp.rb;T;0o;;[ ;I"ext/ripper/ripper.c;T;0o;;[ ;I"parse.c;T;0;0;0[ [ U:RDoc::Constant[i I"PARSER_EVENTS;FI"Ripper::PARSER_EVENTS;T00o;;[o; ;[I"/This array contains name of parser events.;T;@n;0@n@cRDoc::NormalClass0U;[i I"SCANNER_EVENTS;FI"Ripper::SCANNER_EVENTS;T00o;;[o; ;[I"0This array contains name of scanner events.;T;@n;0@n@@„0U;[i I"EVENTS;FI"Ripper::EVENTS;T00o;;[o; ;[I"3This array contains name of all ripper events.;T;@n;0@n@@„0U;[i I"Version;TI"Ripper::Version;T00o;;[o; ;[I"version of Ripper;T@;@z;0@z@@„0[ [[I"
class;T[[:public[
[I"dedent_string;TI"ext/ripper/ripper.c;T[I"lex;FI"#ext/ripper/lib/ripper/lexer.rb;T[I"new;T@©[I"
parse;FI""ext/ripper/lib/ripper/core.rb;T[I" sexp;FI""ext/ripper/lib/ripper/sexp.rb;T[I"
sexp_raw;F@´[I"
slice;F@¬[I"
tokenize;F@¬[:protected[ [:private[ [I"
instance;T[[;[[I"column;T@©[I"
encoding;T@©[I"end_seen?;T@©[I"error?;T@©[I"
filename;T@©[I"lineno;T@©[I"
parse;T@©[I"yydebug;T@©[I"
yydebug=;T@©[;[ [;[[I"_dispatch_0;F@±[I"_dispatch_1;F@±[I"_dispatch_2;F@±[I"_dispatch_3;F@±[I"_dispatch_4;F@±[I"_dispatch_5;F@±[I"_dispatch_6;F@±[I"_dispatch_7;F@±[I"compile_error;F@±[I"dedent_string;T@©[I" warn;F@±[I"warning;F@±[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@k@n@q@t@w@z@}@}cRDoc::TopLevel