Slide 49
Slide 49 text
WHAT IS RIPPER?
• A Ruby script parser
• Ripper.sexp create S-exp tree including
position information
# assert { [0, 1, 2].find {|i| i.odd? } == 3 }
[:program,
[[:method_add_block,
[:method_add_arg, [:fcall, [:@ident, "assert", [1, 0]]], []],
[:brace_block, nil,
[[:binary,
[:method_add_block,
[:call,
[:array,ɹ[[:@int, "0", [1, 10]], [:@int, "1", [1, 13]], [:@int, "2", [1, 16]]]], :".",
[:@ident, "find", [1, 19]]],
[:brace_block,
[:block_var, [:params, [[:@ident, "i", [1, 26]]], nil, nil, nil, nil, nil, nil], false],
[[:call, [:var_ref, [:@ident, "i", [1, 29]]], :”.", [:@ident, "odd?", [1, 31]]]]]],
:==,
[:@int, "3", [1, 41]]]]]]]]