This is a documented list of events from Ruby's Ripper parser.
They can be handled in subclasses of Ripper
, using `on_*`
methods
of varying arity. (View this page's source code.)
Coverage: 30 / 183 (16%)
:BEGIN
:CHAR
:END
:__end__
:alias
:alias_error
:aref
:aref_field
:arg_ambiguous
:arg_paren
:args_add
:args_add_block
:args_add_star
:args_new
:array
:assign
:assign_error
:assoc_new
:assoc_splat
:assoclist_from_args
:backref
:backtick
:bare_assoc_hash
:begin
:binary
:block_var
:block_var_add_block
:block_var_add_star
:blockarg
:bodystmt
:brace_block
:break
:call
:case
:class
:class_name_error
:comma
:command
:command_call
:comment
:const
:const_path_field
:const_path_ref
:const_ref
:cvar
:def
:defined
:defs
:do_block
:dot2
:dot3
:dyna_symbol
:else
:elsif
:embdoc
:embdoc_beg
:embdoc_end
:embexpr_beg
:embexpr_end
:embvar
:ensure
:excessed_comma
:fcall
:field
:float
:for
:gvar
:hash
:heredoc_beg
:heredoc_dedent
:heredoc_end
:ident
:if
:if_mod
:ifop
:ignored_nl
:imaginary
:int
:ivar
:kw
:label
:label_end
:lambda
:lbrace
:lbracket
:lparen
:magic_comment
:massign
:method_add_arg
:method_add_block
:mlhs_add
:mlhs_add_star
:mlhs_new
:mlhs_paren
:module
:mrhs_add
:mrhs_add_star
:mrhs_new
:mrhs_new_from_args
:next
:nl
:op
:opassign
:operator_ambiguous
:param_error
:params
:paren
:parse_error
:period
:program
:qsymbols_add
:qsymbols_beg
:qsymbols_new
:qwords_add
:qwords_beg
:qwords_new
:rational
:rbrace
:rbracket
:redo
:regexp_add
:regexp_beg
:regexp_end
:regexp_literal
:regexp_new
:rescue
:rescue_mod
:rest_param
:retry
:return
:return0
:rparen
:sclass
:semicolon
:sp
:stmts_add
:stmts_new
:string_add
:string_concat
:string_content
:string_dvar
:string_embexpr
:string_literal
:super
:symbeg
:symbol
:symbol_literal
:symbols_add
:symbols_beg
:symbols_new
:tlambda
:tlambeg
:top_const_field
:top_const_ref
:tstring_beg
:tstring_content
:tstring_end
:unary
:undef
:unless
:unless_mod
:until
:until_mod
:var_alias
:var_field
:var_ref
:vcall
:void_stmt
:when
:while
:while_mod
:word_add
:word_new
:words_add
:words_beg
:words_new
:words_sep
:xstring_add
:xstring_literal
:xstring_new
:yield
:yield0
:zsuper
#
on_BEGIN(block)
(:BEGIN
,
in Ripper::PARSER_EVENTS
)
Adds a global initialization hook, always with curly braces.
Ripper.sexp_raw("BEGIN { do_stuff }") # [:program, # [:stmts_add, # [:stmts_new], # [:BEGIN, # [:stmts_add, # [:stmts_new], # [:vcall, # [:@ident, "do_stuff", [1, 8]]]]]]]
#
on_CHAR(string, position)
(:CHAR
,
in Ripper::SCANNER_EVENTS
)
#
on_END(block)
(:END
,
in Ripper::PARSER_EVENTS
)
Adds a global shutdown hook, always with curly braces
Ripper.sexp_raw("END { do_stuff }") # [:program, # [:stmts_add, # [:stmts_new], # [:END, # [:stmts_add, # [:stmts_new], # [:vcall, # [:@ident, "do_stuff", [1, 6]]]]]]]
#
on___end__(string, position)
(:__end__
,
in Ripper::SCANNER_EVENTS
)
Delimits the Ruby script from the following data (DATA
). Interestingly, the following data is absent from the parsed s-expression.
Ripper.sexp_raw("a\n__END__\nwacky stuff") # [:program, # [:stmts_add, # [:stmts_new], # [:vcall, [:@ident, "a", [1, 0]]]]]
Ripper.lex("a\n__END__\nwacky stuff") # [[[1, 0], :on_ident, "a"], # [[1, 1], :on_nl, "\n"], # [[2, 0], :on___end__, "__END__\n"]]
#
on_alias(new_method, old_method)
(:alias
,
in Ripper::PARSER_EVENTS
)
alias
keyword, whose arguments are always parsed as :symbol_literal
s
Ripper.sexp_raw("alias :a :b") # [:program, # [:stmts_add, # [:stmts_new], # [:alias, # [:symbol_literal, # [:symbol, # [:@ident, "a", [1, 7]]]], # [:symbol_literal, # [:symbol, # [:@ident, "b", [1, 10]]]]]]]
Ripper.sexp_raw("alias a b") # [:program, # [:stmts_add, # [:stmts_new], # [:alias, # [:symbol_literal, # [:@ident, "a", [1, 6]]], # [:symbol_literal, # [:@ident, "b", [1, 8]]]]]]
#
on_alias_error(alias_call)
(:alias_error
,
in Ripper::PARSER_EVENTS
)
Wraps an error call to alias
.
Ripper.sexp_raw("alias $foo $2") # nil
#
on_aref(receiver, arguments)
(:aref
,
in Ripper::PARSER_EVENTS
)
Value lookup with square brackets. (Short for “array reference”?)
Ripper.sexp_raw("a[:b]") # [:program, # [:stmts_add, # [:stmts_new], # [:aref, # [:vcall, [:@ident, "a", [1, 0]]], # [:args_add_block, # [:args_add, # [:args_new], # [:symbol_literal, # [:symbol, # [:@ident, "b", [1, 3]]]]], # false]]]]
Ripper.sexp_raw("c[0..2]") # [:program, # [:stmts_add, # [:stmts_new], # [:aref, # [:vcall, [:@ident, "c", [1, 0]]], # [:args_add_block, # [:args_add, # [:args_new], # [:dot2, # [:@int, "0", [1, 2]], # [:@int, "2", [1, 5]]]], # false]]]]
#
on_aref_field(receiver, arguments)
(:aref_field
,
in Ripper::PARSER_EVENTS
)
Square bracket access, but when used in the context of assignment.
Ripper.sexp_raw("[0,1,2][1] = 2") # [:program, # [:stmts_add, # [:stmts_new], # [:assign, # [:aref_field, # [:array, # [:args_add, # [:args_add, # [:args_add, # [:args_new], # [:@int, "0", [1, 1]]], # [:@int, "1", [1, 3]]], # [:@int, "2", [1, 5]]]], # [:args_add_block, # [:args_add, # [:args_new], # [:@int, "1", [1, 8]]], # false]], # [:@int, "2", [1, 13]]]]]
#
on_arg_ambiguous
(:arg_ambiguous
,
in Ripper::PARSER_EVENTS
)
#
on_arg_paren(arguments)
(:arg_paren
,
in Ripper::PARSER_EVENTS
)
Explicit parentheses for arguments
Ripper.sexp_raw("a(1)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add, # [:args_new], # [:@int, "1", [1, 2]]], # false]]]]]
#
on_args_add(_unknown, _unknown2)
(:args_add
,
in Ripper::PARSER_EVENTS
)
The beginning of a list of arguments.
Ripper.sexp_raw("a(1)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add, # [:args_new], # [:@int, "1", [1, 2]]], # false]]]]]
Ripper.sexp_raw("a(1, b: 2)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add, # [:args_add, # [:args_new], # [:@int, "1", [1, 2]]], # [:bare_assoc_hash, # [[:assoc_new, # [:@label, "b:", [1, 5]], # [:@int, "2", [1, 8]]]]]], # false]]]]]
#
on_args_add_block(normal_args, ampersand_block)
(:args_add_block
,
in Ripper::PARSER_EVENTS
)
An args list, may also contain an &
-passed block.
Ripper.sexp_raw("a(&b)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_new], # [:vcall, # [:@ident, "b", [1, 3]]]]]]]]
Ripper.sexp_raw("a(b)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add, # [:args_new], # [:vcall, # [:@ident, "b", [1, 2]]]], # false]]]]]
Ripper.sexp_raw("a(b, &c)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add, # [:args_new], # [:vcall, # [:@ident, "b", [1, 2]]]], # [:vcall, # [:@ident, "c", [1, 6]]]]]]]]
#
on_args_add_star(preceding_args, spatted_arg)
(:args_add_star
,
in Ripper::PARSER_EVENTS
)
An arguments list with a splatted array of arguments.
Ripper.sexp_raw("a(*b)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add_star, # [:args_new], # [:vcall, # [:@ident, "b", [1, 3]]]], # false]]]]]
Ripper.sexp_raw("a(b, c, *d)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add_star, # [:args_add, # [:args_add, # [:args_new], # [:vcall, # [:@ident, "b", [1, 2]]]], # [:vcall, # [:@ident, "c", [1, 5]]]], # [:vcall, # [:@ident, "d", [1, 9]]]], # false]]]]]
#
on_args_new
(:args_new
,
in Ripper::PARSER_EVENTS
)
#
on_array
(:array
,
in Ripper::PARSER_EVENTS
)
#
on_assign(lhs, rhs)
(:assign
,
in Ripper::PARSER_EVENTS
)
Usage of the assignment operator, =, with a left-hand side (receiving the value) and a right-hand side (the value).
Ripper.sexp_raw("a = 1") # [:program, # [:stmts_add, # [:stmts_new], # [:assign, # [:var_field, # [:@ident, "a", [1, 0]]], # [:@int, "1", [1, 4]]]]]
Ripper.sexp_raw("obj.x = other.y") # [:program, # [:stmts_add, # [:stmts_new], # [:assign, # [:field, # [:vcall, # [:@ident, "obj", [1, 0]]], # :".", # [:@ident, "x", [1, 4]]], # [:call, # [:vcall, # [:@ident, "other", [1, 8]]], # :".", # [:@ident, "y", [1, 14]]]]]]
#
on_assign_error
(:assign_error
,
in Ripper::PARSER_EVENTS
)
#
on_assoc_new
(:assoc_new
,
in Ripper::PARSER_EVENTS
)
#
on_assoc_splat
(:assoc_splat
,
in Ripper::PARSER_EVENTS
)
#
on_assoclist_from_args
(:assoclist_from_args
,
in Ripper::PARSER_EVENTS
)
#
on_backref
(:backref
,
in Ripper::SCANNER_EVENTS
)
#
on_backtick
(:backtick
,
in Ripper::SCANNER_EVENTS
)
#
on_bare_assoc_hash
(:bare_assoc_hash
,
in Ripper::PARSER_EVENTS
)
#
on_begin
(:begin
,
in Ripper::PARSER_EVENTS
)
#
on_binary(lhs, operator, rhs)
(:binary
,
in Ripper::PARSER_EVENTS
)
An operator with left-hand side and right-hand side
Ripper.sexp_raw("1 + 1") # [:program, # [:stmts_add, # [:stmts_new], # [:binary, # [:@int, "1", [1, 0]], # :+, # [:@int, "1", [1, 4]]]]]
#
on_block_var
(:block_var
,
in Ripper::PARSER_EVENTS
)
#
on_block_var_add_block
(:block_var_add_block
,
in Ripper::PARSER_EVENTS
)
#
on_block_var_add_star
(:block_var_add_star
,
in Ripper::PARSER_EVENTS
)
#
on_blockarg
(:blockarg
,
in Ripper::PARSER_EVENTS
)
#
on_bodystmt
(:bodystmt
,
in Ripper::PARSER_EVENTS
)
#
on_brace_block
(:brace_block
,
in Ripper::PARSER_EVENTS
)
#
on_break
(:break
,
in Ripper::PARSER_EVENTS
)
#
on_call
(:call
,
in Ripper::PARSER_EVENTS
)
#
on_case
(:case
,
in Ripper::PARSER_EVENTS
)
#
on_class(classname, superclass, body)
(:class
,
in Ripper::PARSER_EVENTS
)
A class definition with the class
keyword.
Ripper.sexp_raw("class A < B; def a; end; end") # [:program, # [:stmts_add, # [:stmts_new], # [:class, # [:const_ref, # [:@const, "A", [1, 6]]], # [:var_ref, # [:@const, "B", [1, 10]]], # [:bodystmt, # [:stmts_add, # [:stmts_new], # [:def, # [:@ident, "a", [1, 17]], # [:params, nil, nil, nil, nil, nil, nil, nil], # [:bodystmt, # [:stmts_add, # [:stmts_new], # [:void_stmt]], # nil, # nil, # nil]]], # nil, # nil, # nil]]]]
#
on_class_name_error(invalid_name)
(:class_name_error
,
in Ripper::PARSER_EVENTS
)
Wraps an @ident
which is an invalid class name.
Ripper.sexp_raw("class x; end") # nil
#
on_comma
(:comma
,
in Ripper::SCANNER_EVENTS
)
#
on_command
(:command
,
in Ripper::PARSER_EVENTS
)
#
on_command_call
(:command_call
,
in Ripper::PARSER_EVENTS
)
#
on_comment
(:comment
,
in Ripper::SCANNER_EVENTS
)
#
on_const(name, position)
(:const
,
in Ripper::SCANNER_EVENTS
)
A literal reference to a constant (variable beginning with a capital letter).
Ripper.sexp_raw("A = 1") # [:program, # [:stmts_add, # [:stmts_new], # [:assign, # [:var_field, # [:@const, "A", [1, 0]]], # [:@int, "1", [1, 4]]]]]
Ripper.sexp_raw("A.b") # [:program, # [:stmts_add, # [:stmts_new], # [:call, # [:var_ref, # [:@const, "A", [1, 0]]], # :".", # [:@ident, "b", [1, 2]]]]]
Ripper.sexp_raw("module A; include B; end") # [:program, # [:stmts_add, # [:stmts_new], # [:module, # [:const_ref, # [:@const, "A", [1, 7]]], # [:bodystmt, # [:stmts_add, # [:stmts_add, # [:stmts_new], # [:void_stmt]], # [:command, # [:@ident, "include", [1, 10]], # [:args_add_block, # [:args_add, # [:args_new], # [:var_ref, # [:@const, "B", [1, 18]]]], # false]]], # nil, # nil, # nil]]]]
#
on_const_path_field
(:const_path_field
,
in Ripper::PARSER_EVENTS
)
#
on_const_path_ref
(:const_path_ref
,
in Ripper::PARSER_EVENTS
)
#
on_const_ref
(:const_ref
,
in Ripper::PARSER_EVENTS
)
#
on_cvar
(:cvar
,
in Ripper::SCANNER_EVENTS
)
#
on_def
(:def
,
in Ripper::PARSER_EVENTS
)
#
on_defined
(:defined
,
in Ripper::PARSER_EVENTS
)
#
on_defs
(:defs
,
in Ripper::PARSER_EVENTS
)
#
on_do_block
(:do_block
,
in Ripper::PARSER_EVENTS
)
#
on_dot2(lhs, rhs)
(:dot2
,
in Ripper::PARSER_EVENTS
)
Two dots, ..
, for inclusive ranges or flip-flop operator.
Ripper.sexp_raw("1..10") # [:program, # [:stmts_add, # [:stmts_new], # [:dot2, # [:@int, "1", [1, 0]], # [:@int, "10", [1, 3]]]]]
Ripper.sexp_raw("if x..y; end") # [:program, # [:stmts_add, # [:stmts_new], # [:if, # [:dot2, # [:vcall, [:@ident, "x", [1, 3]]], # [:vcall, # [:@ident, "y", [1, 6]]]], # [:stmts_add, # [:stmts_new], # [:void_stmt]], # nil]]]
#
on_dot3(lhs, rhs)
(:dot3
,
in Ripper::PARSER_EVENTS
)
Three dots, ...
, use for exclusive ranges.
Ripper.sexp_raw("'a'...'k'") # [:program, # [:stmts_add, # [:stmts_new], # [:dot3, # [:string_literal, # [:string_add, # [:string_content], # [:@tstring_content, "a", [1, 1]]]], # [:string_literal, # [:string_add, # [:string_content], # [:@tstring_content, "k", [1, 7]]]]]]]
#
on_dyna_symbol(contents)
(:dyna_symbol
,
in Ripper::PARSER_EVENTS
)
A symbol literal, created from a string.
Ripper.sexp_raw(":\"x\"") # [:program, # [:stmts_add, # [:stmts_new], # [:dyna_symbol, # [:xstring_add, # [:xstring_new], # [:@tstring_content, "x", [1, 2]]]]]]
Ripper.sexp_raw(":\"x\#{y}\"") # [:program, # [:stmts_add, # [:stmts_new], # [:dyna_symbol, # [:xstring_add, # [:xstring_add, # [:xstring_new], # [:@tstring_content, "x", [1, 2]]], # [:string_embexpr, # [:stmts_add, # [:stmts_new], # [:vcall, # [:@ident, "y", [1, 5]]]]]]]]]
#
on_else(statements)
(:else
,
in Ripper::PARSER_EVENTS
)
An else
keyword, used with if
or begin
-rescue
.
Ripper.sexp_raw("if a; b; else; c; end") # [:program, # [:stmts_add, # [:stmts_new], # [:if, # [:vcall, [:@ident, "a", [1, 3]]], # [:stmts_add, # [:stmts_new], # [:vcall, # [:@ident, "b", [1, 6]]]], # [:else, # [:stmts_add, # [:stmts_add, # [:stmts_new], # [:void_stmt]], # [:vcall, # [:@ident, "c", [1, 15]]]]]]]]
Ripper.sexp_raw("begin; a; rescue; b; else; c; end") # [:program, # [:stmts_add, # [:stmts_new], # [:begin, # [:bodystmt, # [:stmts_add, # [:stmts_add, # [:stmts_new], # [:void_stmt]], # [:vcall, # [:@ident, "a", [1, 7]]]], # [:rescue, # nil, # nil, # [:stmts_add, # [:stmts_new], # [:vcall, # [:@ident, "b", [1, 18]]]], # nil], # [:else, # [:stmts_add, # [:stmts_add, # [:stmts_new], # [:void_stmt]], # [:vcall, # [:@ident, "c", [1, 27]]]]], # nil]]]]
#
on_elsif
(:elsif
,
in Ripper::PARSER_EVENTS
)
#
on_embdoc
(:embdoc
,
in Ripper::SCANNER_EVENTS
)
#
on_embdoc_beg
(:embdoc_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_embdoc_end
(:embdoc_end
,
in Ripper::SCANNER_EVENTS
)
#
on_embexpr_beg
(:embexpr_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_embexpr_end
(:embexpr_end
,
in Ripper::SCANNER_EVENTS
)
#
on_embvar
(:embvar
,
in Ripper::SCANNER_EVENTS
)
#
on_ensure
(:ensure
,
in Ripper::PARSER_EVENTS
)
#
on_excessed_comma
(:excessed_comma
,
in Ripper::PARSER_EVENTS
)
#
on_fcall(method_name)
(:fcall
,
in Ripper::PARSER_EVENTS
)
A method call without a receiver, but syntactically known to be a method call, not a local variable reference. (This can be known by the presence of arguments.)
Ripper.sexp_raw("a(b)") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:arg_paren, # [:args_add_block, # [:args_add, # [:args_new], # [:vcall, # [:@ident, "b", [1, 2]]]], # false]]]]]
Ripper.sexp_raw("a { }") # [:program, # [:stmts_add, # [:stmts_new], # [:method_add_block, # [:method_add_arg, # [:fcall, [:@ident, "a", [1, 0]]], # [:args_new]], # [:brace_block, # nil, # [:stmts_add, # [:stmts_new], # [:void_stmt]]]]]]
#
on_field
(:field
,
in Ripper::PARSER_EVENTS
)
#
on_float
(:float
,
in Ripper::SCANNER_EVENTS
)
#
on_for
(:for
,
in Ripper::PARSER_EVENTS
)
#
on_gvar
(:gvar
,
in Ripper::SCANNER_EVENTS
)
#
on_hash
(:hash
,
in Ripper::PARSER_EVENTS
)
#
on_heredoc_beg
(:heredoc_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_heredoc_dedent
(:heredoc_dedent
,
in Ripper::PARSER_EVENTS
)
#
on_heredoc_end
(:heredoc_end
,
in Ripper::SCANNER_EVENTS
)
#
on_ident(name, position)
(:ident
,
in Ripper::SCANNER_EVENTS
)
A local reference (not a constant) which may be a method call or local variable reference.
Ripper.sexp_raw("a") # [:program, # [:stmts_add, # [:stmts_new], # [:vcall, [:@ident, "a", [1, 0]]]]]
Ripper.sexp_raw("b = 1") # [:program, # [:stmts_add, # [:stmts_new], # [:assign, # [:var_field, # [:@ident, "b", [1, 0]]], # [:@int, "1", [1, 4]]]]]
Ripper.sexp_raw("C.d") # [:program, # [:stmts_add, # [:stmts_new], # [:call, # [:var_ref, # [:@const, "C", [1, 0]]], # :".", # [:@ident, "d", [1, 2]]]]]
Ripper.lex("a") # [[[1, 0], :on_ident, "a"]]
Ripper.lex("A.a") # [[[1, 0], :on_const, "A"], # [[1, 1], :on_period, "."], # [[1, 2], :on_ident, "a"]]
#
on_if
(:if
,
in Ripper::PARSER_EVENTS
)
#
on_if_mod(statement, condition)
(:if_mod
,
in Ripper::PARSER_EVENTS
)
Line-final if.
Ripper.sexp_raw("a if b") # [:program, # [:stmts_add, # [:stmts_new], # [:if_mod, # [:vcall, [:@ident, "b", [1, 5]]], # [:vcall, # [:@ident, "a", [1, 0]]]]]]
#
on_ifop
(:ifop
,
in Ripper::PARSER_EVENTS
)
#
on_ignored_nl
(:ignored_nl
,
in Ripper::SCANNER_EVENTS
)
#
on_imaginary(string, position)
(:imaginary
,
in Ripper::SCANNER_EVENTS
)
The imaginary part of a complex number
Ripper.sexp_raw("2+1i") # [:program, # [:stmts_add, # [:stmts_new], # [:binary, # [:@int, "2", [1, 0]], # :+, # [:@imaginary, "1i", [1, 2]]]]]
Ripper.lex("2i") # [[[1, 0], :on_imaginary, "2i"]]
#
on_int(literal, position)
(:int
,
in Ripper::SCANNER_EVENTS
)
An integer literal
Ripper.sexp_raw("100") # [:program, # [:stmts_add, # [:stmts_new], # [:@int, "100", [1, 0]]]]
#
on_ivar
(:ivar
,
in Ripper::SCANNER_EVENTS
)
#
on_kw
(:kw
,
in Ripper::SCANNER_EVENTS
)
#
on_label
(:label
,
in Ripper::SCANNER_EVENTS
)
#
on_label_end
(:label_end
,
in Ripper::SCANNER_EVENTS
)
#
on_lambda
(:lambda
,
in Ripper::PARSER_EVENTS
)
#
on_lbrace
(:lbrace
,
in Ripper::SCANNER_EVENTS
)
#
on_lbracket
(:lbracket
,
in Ripper::SCANNER_EVENTS
)
#
on_lparen
(:lparen
,
in Ripper::SCANNER_EVENTS
)
#
on_magic_comment
(:magic_comment
,
in Ripper::PARSER_EVENTS
)
#
on_massign
(:massign
,
in Ripper::PARSER_EVENTS
)
#
on_method_add_arg
(:method_add_arg
,
in Ripper::PARSER_EVENTS
)
#
on_method_add_block
(:method_add_block
,
in Ripper::PARSER_EVENTS
)
#
on_mlhs_add
(:mlhs_add
,
in Ripper::PARSER_EVENTS
)
#
on_mlhs_add_star
(:mlhs_add_star
,
in Ripper::PARSER_EVENTS
)
#
on_mlhs_new
(:mlhs_new
,
in Ripper::PARSER_EVENTS
)
#
on_mlhs_paren
(:mlhs_paren
,
in Ripper::PARSER_EVENTS
)
#
on_module
(:module
,
in Ripper::PARSER_EVENTS
)
#
on_mrhs_add
(:mrhs_add
,
in Ripper::PARSER_EVENTS
)
#
on_mrhs_add_star
(:mrhs_add_star
,
in Ripper::PARSER_EVENTS
)
#
on_mrhs_new
(:mrhs_new
,
in Ripper::PARSER_EVENTS
)
#
on_mrhs_new_from_args
(:mrhs_new_from_args
,
in Ripper::PARSER_EVENTS
)
#
on_next
(:next
,
in Ripper::PARSER_EVENTS
)
#
on_nl
(:nl
,
in Ripper::SCANNER_EVENTS
)
#
on_op
(:op
,
in Ripper::SCANNER_EVENTS
)
#
on_opassign
(:opassign
,
in Ripper::PARSER_EVENTS
)
#
on_operator_ambiguous
(:operator_ambiguous
,
in Ripper::PARSER_EVENTS
)
#
on_param_error
(:param_error
,
in Ripper::PARSER_EVENTS
)
#
on_params
(:params
,
in Ripper::PARSER_EVENTS
)
#
on_paren
(:paren
,
in Ripper::PARSER_EVENTS
)
#
on_parse_error
(:parse_error
,
in Ripper::PARSER_EVENTS
)
#
on_period
(:period
,
in Ripper::SCANNER_EVENTS
)
#
on_program(expressions)
(:program
,
in Ripper::PARSER_EVENTS
)
Top-level node for all parsed code
Ripper.sexp_raw("") # [:program, # [:stmts_add, # [:stmts_new], # [:void_stmt]]]
#
on_qsymbols_add
(:qsymbols_add
,
in Ripper::PARSER_EVENTS
)
#
on_qsymbols_beg
(:qsymbols_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_qsymbols_new
(:qsymbols_new
,
in Ripper::PARSER_EVENTS
)
#
on_qwords_add
(:qwords_add
,
in Ripper::PARSER_EVENTS
)
#
on_qwords_beg
(:qwords_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_qwords_new
(:qwords_new
,
in Ripper::PARSER_EVENTS
)
#
on_rational
(:rational
,
in Ripper::SCANNER_EVENTS
)
#
on_rbrace
(:rbrace
,
in Ripper::SCANNER_EVENTS
)
#
on_rbracket
(:rbracket
,
in Ripper::SCANNER_EVENTS
)
#
on_redo
(:redo
,
in Ripper::PARSER_EVENTS
)
#
on_regexp_add
(:regexp_add
,
in Ripper::PARSER_EVENTS
)
#
on_regexp_beg
(:regexp_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_regexp_end
(:regexp_end
,
in Ripper::SCANNER_EVENTS
)
#
on_regexp_literal
(:regexp_literal
,
in Ripper::PARSER_EVENTS
)
#
on_regexp_new
(:regexp_new
,
in Ripper::PARSER_EVENTS
)
#
on_rescue
(:rescue
,
in Ripper::PARSER_EVENTS
)
#
on_rescue_mod
(:rescue_mod
,
in Ripper::PARSER_EVENTS
)
#
on_rest_param
(:rest_param
,
in Ripper::PARSER_EVENTS
)
#
on_retry
(:retry
,
in Ripper::PARSER_EVENTS
)
#
on_return
(:return
,
in Ripper::PARSER_EVENTS
)
#
on_return0
(:return0
,
in Ripper::PARSER_EVENTS
)
A return statement with no arguments
Ripper.sexp_raw("def a; return; end;") # [:program, # [:stmts_add, # [:stmts_new], # [:def, # [:@ident, "a", [1, 4]], # [:params, nil, nil, nil, nil, nil, nil, nil], # [:bodystmt, # [:stmts_add, # [:stmts_new], # [:return0]], # nil, # nil, # nil]]]]
#
on_rparen
(:rparen
,
in Ripper::SCANNER_EVENTS
)
#
on_sclass
(:sclass
,
in Ripper::PARSER_EVENTS
)
#
on_semicolon
(:semicolon
,
in Ripper::SCANNER_EVENTS
)
#
on_sp
(:sp
,
in Ripper::SCANNER_EVENTS
)
#
on_stmts_add
(:stmts_add
,
in Ripper::PARSER_EVENTS
)
#
on_stmts_new
(:stmts_new
,
in Ripper::PARSER_EVENTS
)
#
on_string_add
(:string_add
,
in Ripper::PARSER_EVENTS
)
#
on_string_concat
(:string_concat
,
in Ripper::PARSER_EVENTS
)
#
on_string_content
(:string_content
,
in Ripper::PARSER_EVENTS
)
#
on_string_dvar
(:string_dvar
,
in Ripper::PARSER_EVENTS
)
#
on_string_embexpr
(:string_embexpr
,
in Ripper::PARSER_EVENTS
)
#
on_string_literal
(:string_literal
,
in Ripper::PARSER_EVENTS
)
#
on_super
(:super
,
in Ripper::PARSER_EVENTS
)
#
on_symbeg
(:symbeg
,
in Ripper::SCANNER_EVENTS
)
#
on_symbol
(:symbol
,
in Ripper::PARSER_EVENTS
)
#
on_symbol_literal
(:symbol_literal
,
in Ripper::PARSER_EVENTS
)
#
on_symbols_add
(:symbols_add
,
in Ripper::PARSER_EVENTS
)
#
on_symbols_beg
(:symbols_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_symbols_new
(:symbols_new
,
in Ripper::PARSER_EVENTS
)
#
on_tlambda
(:tlambda
,
in Ripper::SCANNER_EVENTS
)
#
on_tlambeg
(:tlambeg
,
in Ripper::SCANNER_EVENTS
)
#
on_top_const_field
(:top_const_field
,
in Ripper::PARSER_EVENTS
)
#
on_top_const_ref
(:top_const_ref
,
in Ripper::PARSER_EVENTS
)
#
on_tstring_beg
(:tstring_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_tstring_content
(:tstring_content
,
in Ripper::SCANNER_EVENTS
)
#
on_tstring_end
(:tstring_end
,
in Ripper::SCANNER_EVENTS
)
#
on_unary
(:unary
,
in Ripper::PARSER_EVENTS
)
#
on_undef
(:undef
,
in Ripper::PARSER_EVENTS
)
#
on_unless
(:unless
,
in Ripper::PARSER_EVENTS
)
#
on_unless_mod
(:unless_mod
,
in Ripper::PARSER_EVENTS
)
#
on_until
(:until
,
in Ripper::PARSER_EVENTS
)
#
on_until_mod
(:until_mod
,
in Ripper::PARSER_EVENTS
)
#
on_var_alias
(:var_alias
,
in Ripper::PARSER_EVENTS
)
#
on_var_field
(:var_field
,
in Ripper::PARSER_EVENTS
)
#
on_var_ref
(:var_ref
,
in Ripper::PARSER_EVENTS
)
#
on_vcall
(:vcall
,
in Ripper::PARSER_EVENTS
)
#
on_void_stmt
(:void_stmt
,
in Ripper::PARSER_EVENTS
)
A filler node for blank statements, such as empty method bodies
Ripper.sexp_raw("def a; end") # [:program, # [:stmts_add, # [:stmts_new], # [:def, # [:@ident, "a", [1, 4]], # [:params, nil, nil, nil, nil, nil, nil, nil], # [:bodystmt, # [:stmts_add, # [:stmts_new], # [:void_stmt]], # nil, # nil, # nil]]]]
Ripper.sexp_raw("-> { } ") # [:program, # [:stmts_add, # [:stmts_new], # [:lambda, # [:params, nil, nil, nil, nil, nil, nil, nil], # [:stmts_add, # [:stmts_new], # [:void_stmt]]]]]
#
on_when
(:when
,
in Ripper::PARSER_EVENTS
)
#
on_while
(:while
,
in Ripper::PARSER_EVENTS
)
#
on_while_mod
(:while_mod
,
in Ripper::PARSER_EVENTS
)
#
on_word_add
(:word_add
,
in Ripper::PARSER_EVENTS
)
#
on_word_new
(:word_new
,
in Ripper::PARSER_EVENTS
)
#
on_words_add
(:words_add
,
in Ripper::PARSER_EVENTS
)
#
on_words_beg
(:words_beg
,
in Ripper::SCANNER_EVENTS
)
#
on_words_new
(:words_new
,
in Ripper::PARSER_EVENTS
)
#
on_words_sep
(:words_sep
,
in Ripper::SCANNER_EVENTS
)
#
on_xstring_add
(:xstring_add
,
in Ripper::PARSER_EVENTS
)
#
on_xstring_literal
(:xstring_literal
,
in Ripper::PARSER_EVENTS
)
#
on_xstring_new
(:xstring_new
,
in Ripper::PARSER_EVENTS
)
#
on_yield
(:yield
,
in Ripper::PARSER_EVENTS
)
#
on_yield0
(:yield0
,
in Ripper::PARSER_EVENTS
)
#
on_zsuper
(:zsuper
,
in Ripper::PARSER_EVENTS
)