Slide 50
Slide 50 text
Ripper.lex
$ ruby -rripper -e
'pp Ripper.lex(File.read("hello.rb"))'
[[[1, 0], :on_kw, "def", EXPR_FNAME],
[[1, 3], :on_sp, " ", EXPR_FNAME],
[[1, 4], :on_ident, "hello", EXPR_ENDFN],
[[1, 9], :on_lparen, "(", EXPR_BEG|EXPR_LABEL],
[[1, 10], :on_ident, "name", EXPR_ARG],
[[1, 14], :on_rparen, ")", EXPR_ENDFN],
[[1, 15], :on_ignored_nl, "\n", EXPR_BEG],
[[2, 0], :on_sp, " ", EXPR_BEG],
[[2, 2], :on_ident, "puts", EXPR_CMDARG],
[[2, 6], :on_sp, " ", EXPR_CMDARG],
[[2, 7], :on_tstring_beg, "\"", EXPR_CMDARG],
[[2, 8], :on_tstring_content, "hello, ", EXPR_CMDARG],