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

Update comment of Ripper.lex

This is follow up of 1f7cb4bee9.
This commit is contained in:
Yuichiro Kaneko 2019-11-13 09:50:58 +09:00
parent 4bbfe1f7c4
commit ae33f93836

View file

@ -30,16 +30,16 @@ class Ripper
# require 'pp'
#
# pp Ripper.lex("def m(a) nil end")
# #=> [[[1, 0], :on_kw, "def", Ripper::EXPR_FNAME ],
# [[1, 3], :on_sp, " ", Ripper::EXPR_FNAME ],
# [[1, 4], :on_ident, "m", Ripper::EXPR_ENDFN ],
# [[1, 5], :on_lparen, "(", Ripper::EXPR_LABEL | Ripper::EXPR_BEG],
# [[1, 6], :on_ident, "a", Ripper::EXPR_ARG ],
# [[1, 7], :on_rparen, ")", Ripper::EXPR_ENDFN ],
# [[1, 8], :on_sp, " ", Ripper::EXPR_BEG ],
# [[1, 9], :on_kw, "nil", Ripper::EXPR_END ],
# [[1, 12], :on_sp, " ", Ripper::EXPR_END ],
# [[1, 13], :on_kw, "end", Ripper::EXPR_END ]]
# #=> [[[1, 0], :on_kw, "def", FNAME ],
# [[1, 3], :on_sp, " ", FNAME ],
# [[1, 4], :on_ident, "m", ENDFN ],
# [[1, 5], :on_lparen, "(", BEG|LABEL],
# [[1, 6], :on_ident, "a", ARG ],
# [[1, 7], :on_rparen, ")", ENDFN ],
# [[1, 8], :on_sp, " ", BEG ],
# [[1, 9], :on_kw, "nil", END ],
# [[1, 12], :on_sp, " ", END ],
# [[1, 13], :on_kw, "end", END ]]
#
def Ripper.lex(src, filename = '-', lineno = 1)
Lexer.new(src, filename, lineno).lex