Ruby 3.4
4.0 3.4
Grammar changes
Tokens
Source: parse.y @ v3_4_0 (f450108) / lrama 0.8.0 / 2024-12-24
These diagrams describe a parser grammar, rather than the complete language specification. Lexer state and semantic checks may impose additional restrictions.
Ruby uses Prism by default since 3.4. These diagrams describe parse.y (--parser=parse.y); accepted syntax can differ from Prism.
BSD-2-Clause
Start wrapper
Unreachable
BNF $accept ::= program END_OF_INPUT
Used by (0)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
end-of-input
Midrule action
program › $@1
BNF $@1 ::= ε
Used by (1)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
BNF program ::= $@1 top_compstmt
Used by (1)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
Parameterized rule
program › top_compstmt › option_terms
BNF option_terms ::= ε
| terms
Used by (4)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt
BNF top_compstmt ::= top_stmts option_terms
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts
BNF top_stmts ::= none
| top_stmt
| top_stmts terms top_stmt
Used by (2)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt
BNF top_stmt ::= stmt
| keyword_BEGIN begin_block
Used by (1)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
error
program › top_compstmt › top_stmts › top_stmt › begin_block
BNF begin_block ::= block_open top_compstmt '}'
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
{ }
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › bodystmt
BNF bodystmt ::= compstmt lex_ctxt opt_rescue k_else $@2 compstmt $@3 opt_ensure
| compstmt lex_ctxt opt_rescue $@4 opt_ensure
Used by (3)
References (8)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › compstmt
BNF compstmt ::= stmts option_terms
Used by (11)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › compstmt › stmts
BNF stmts ::= none
| stmt_or_begin
| stmts terms stmt_or_begin
Used by (3)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › k_END
BNF k_END ::= keyword_END lex_ctxt
Used by (1)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
END
Midrule action
program › top_compstmt › top_stmts › top_stmt › stmt › $@6
BNF $@6 ::= ε
Used by (1)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt
BNF stmt ::= keyword_alias fitem $@6 fitem
| keyword_alias tGVAR tGVAR
| keyword_alias tGVAR tBACK_REF
| keyword_alias tGVAR tNTH_REF
| keyword_undef undef_list
| stmt modifier_if expr_value
| stmt modifier_unless expr_value
| stmt modifier_while expr_value
| stmt modifier_until expr_value
| stmt modifier_rescue after_rescue stmt
| k_END allow_exits '{' compstmt '}'
| command_asgn
| mlhs '=' lex_ctxt command_call
| lhs '=' lex_ctxt mrhs
| mlhs '=' lex_ctxt mrhs_arg modifier_rescue after_rescue stmt
| mlhs '=' lex_ctxt mrhs_arg
| expr
| YYerror
Used by (4)
References (17)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
error
Code example if true
puts "hello"
end
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn
BNF command_asgn ::= lhs '=' lex_ctxt command_rhs
| var_lhs tOP_ASGN lex_ctxt command_rhs
| primary_value '[' opt_call_args rbracket tOP_ASGN lex_ctxt command_rhs
| primary_value call_op tIDENTIFIER tOP_ASGN lex_ctxt command_rhs
| primary_value call_op tCONSTANT tOP_ASGN lex_ctxt command_rhs
| primary_value tCOLON2 tCONSTANT tOP_ASGN lex_ctxt command_rhs
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN lex_ctxt command_rhs
| defn_head f_opt_paren_args '=' endless_command
| defs_head f_opt_paren_args '=' endless_command
| backref tOP_ASGN lex_ctxt command_rhs
Used by (2)
References (13)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier = identifier &
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › endless_command
BNF endless_command ::= command
| endless_command modifier_rescue after_rescue arg
| keyword_not option_'\n' endless_command
Used by (2)
References (5)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier &
Parameterized rule
program › top_compstmt › top_stmts › top_stmt › stmt › expr › option_'\n'
BNF option_'\n' ::= ε
| '\n'
Used by (10)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › command_rhs
BNF command_rhs ::= command_call
| command_call modifier_rescue after_rescue stmt
| command_asgn
Used by (1)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier &
program › top_compstmt › top_stmts › top_stmt › stmt › expr
BNF expr ::= command_call
| expr keyword_and expr
| expr keyword_or expr
| keyword_not option_'\n' expr
| '!' command_call
| arg tASSOC $@7 p_in_kwarg p_pvtbl p_pktbl p_top_expr_body
| arg keyword_in $@8 p_in_kwarg p_pvtbl p_pktbl p_top_expr_body
| arg
Used by (5)
References (10)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
Code example (1 + 2) * 3
Midrule action
program › top_compstmt › top_stmts › top_stmt › stmt › expr › $@7
BNF $@7 ::= ε
Used by (1)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
Midrule action
program › top_compstmt › top_stmts › top_stmt › stmt › expr › $@8
BNF $@8 ::= ε
Used by (1)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › defs_head
BNF defs_head ::= k_def singleton dot_or_colon $@9 def_name
Used by (3)
References (5)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
def identifier . identifier
program › top_compstmt › top_stmts › top_stmt › stmt › expr_value
BNF expr_value ::= expr
| YYerror
Used by (7)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
error
program › top_compstmt › top_stmts › top_stmt › stmt › command_call
BNF command_call ::= command
| block_command
Used by (3)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier &
program › top_compstmt › top_stmts › top_stmt › stmt › command_call › block_command
BNF block_command ::= block_call
| block_call call_op2 operation2 command_args
Used by (1)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier & do end
program › top_compstmt › top_stmts › top_stmt › stmt › command_call › command
BNF command ::= fcall command_args
| fcall command_args cmd_brace_block
| primary_value call_op operation2 command_args
| primary_value call_op operation2 command_args cmd_brace_block
| primary_value tCOLON2 operation2 command_args
| primary_value tCOLON2 operation2 command_args cmd_brace_block
| primary_value tCOLON2 tCONSTANT '{' brace_body '}'
| keyword_super command_args
| k_yield command_args
| k_return call_args
| keyword_break call_args
| keyword_next call_args
Used by (4)
References (10)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier &
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs
BNF mlhs ::= mlhs_basic
| tLPAREN mlhs_inner rparen
Used by (2)
References (3)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
*
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › mlhs_inner
BNF mlhs_inner ::= mlhs_basic
| tLPAREN mlhs_inner rparen
Used by (3)
References (3)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
*
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › mlhs_basic
BNF mlhs_basic ::= mlhs_head
| mlhs_head mlhs_item
| mlhs_head tSTAR mlhs_node
| mlhs_head tSTAR mlhs_node ',' mlhs_post
| mlhs_head tSTAR
| mlhs_head tSTAR ',' mlhs_post
| tSTAR mlhs_node
| tSTAR mlhs_node ',' mlhs_post
| tSTAR
| tSTAR ',' mlhs_post
Used by (2)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
*
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › mlhs_basic › mlhs_head
BNF mlhs_head ::= mlhs_item ','
| mlhs_head mlhs_item ','
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier ,
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › mlhs_basic › mlhs_post
BNF mlhs_post ::= mlhs_item
| mlhs_post ',' mlhs_item
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › mlhs_basic › mlhs_node
BNF mlhs_node ::= user_variable
| keyword_variable
| primary_value '[' opt_call_args rbracket
| primary_value call_op tIDENTIFIER
| primary_value tCOLON2 tIDENTIFIER
| primary_value call_op tCONSTANT
| primary_value tCOLON2 tCONSTANT
| tCOLON3 tCONSTANT
| backref
Used by (2)
References (7)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › lhs
BNF lhs ::= user_variable
| keyword_variable
| primary_value '[' opt_call_args rbracket
| primary_value call_op tIDENTIFIER
| primary_value tCOLON2 tIDENTIFIER
| primary_value call_op tCONSTANT
| primary_value tCOLON2 tCONSTANT
| tCOLON3 tCONSTANT
| backref
Used by (5)
References (7)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › fname
BNF fname ::= tIDENTIFIER
| tCONSTANT
| tFID
| op
| reswords
Used by (3)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › fitem
BNF fitem ::= fname
| symbol
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › undef_list
BNF undef_list ::= fitem
| undef_list ',' $@12 fitem
Used by (2)
References (3)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › fname › op
BNF op ::= '|'
| '^'
| '&'
| tCMP
| tEQ
| tEQQ
| tMATCH
| tNMATCH
| '>'
| tGEQ
| '<'
| tLEQ
| tNEQ
| tLSHFT
| tRSHFT
| '+'
| '-'
| '*'
| tSTAR
| '/'
| '%'
| tPOW
| tDSTAR
| '!'
| '~'
| tUPLUS
| tUMINUS
| tAREF
| tASET
| '`'
Used by (3)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
|
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › fname › reswords
BNF reswords ::= keyword__LINE__
| keyword__FILE__
| keyword__ENCODING__
| keyword_BEGIN
| keyword_END
| keyword_alias
| keyword_and
| keyword_begin
| keyword_break
| keyword_case
| keyword_class
| keyword_def
| keyword_defined
| keyword_do
| keyword_else
| keyword_elsif
| keyword_end
| keyword_ensure
| keyword_false
| keyword_for
| keyword_in
| keyword_module
| keyword_next
| keyword_nil
| keyword_not
| keyword_or
| keyword_redo
| keyword_rescue
| keyword_retry
| keyword_return
| keyword_self
| keyword_super
| keyword_then
| keyword_true
| keyword_undef
| keyword_when
| keyword_yield
| keyword_if
| keyword_unless
| keyword_while
| keyword_until
Used by (1)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
__LINE__
program › top_compstmt › top_stmts › top_stmt › stmt › expr › arg
BNF arg ::= lhs '=' lex_ctxt arg_rhs
| var_lhs tOP_ASGN lex_ctxt arg_rhs
| primary_value '[' opt_call_args rbracket tOP_ASGN lex_ctxt arg_rhs
| primary_value call_op tIDENTIFIER tOP_ASGN lex_ctxt arg_rhs
| primary_value call_op tCONSTANT tOP_ASGN lex_ctxt arg_rhs
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN lex_ctxt arg_rhs
| primary_value tCOLON2 tCONSTANT tOP_ASGN lex_ctxt arg_rhs
| tCOLON3 tCONSTANT tOP_ASGN lex_ctxt arg_rhs
| backref tOP_ASGN lex_ctxt arg_rhs
| arg tDOT2 arg
| arg tDOT3 arg
| arg tDOT2
| arg tDOT3
| tBDOT2 arg
| tBDOT3 arg
| arg '+' arg
| arg '-' arg
| arg '*' arg
| arg '/' arg
| arg '%' arg
| arg tPOW arg
| tUMINUS_NUM simple_numeric tPOW arg
| tUPLUS arg
| tUMINUS arg
| arg '|' arg
| arg '^' arg
| arg '&' arg
| arg tCMP arg
| rel_expr
| arg tEQ arg
| arg tEQQ arg
| arg tNEQ arg
| arg tMATCH arg
| arg tNMATCH arg
| '!' arg
| '~' arg
| arg tLSHFT arg
| arg tRSHFT arg
| arg tANDOP arg
| arg tOROP arg
| keyword_defined option_'\n' begin_defined arg
| arg '?' arg option_'\n' ':' arg
| defn_head f_opt_paren_args '=' endless_arg
| defs_head f_opt_paren_args '=' endless_arg
| primary
Used by (7)
References (19)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › expr › arg › endless_arg
BNF endless_arg ::= arg
| endless_arg modifier_rescue after_rescue arg
| keyword_not option_'\n' endless_arg
Used by (2)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › expr › arg › rel_expr
BNF rel_expr ::= arg relop arg
| rel_expr relop arg
Used by (2)
References (3)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name > method name
program › top_compstmt › top_stmts › top_stmt › stmt › lex_ctxt
BNF lex_ctxt ::= none
Used by (8)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › after_rescue
BNF after_rescue ::= lex_ctxt
Used by (5)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › mrhs › arg_value
BNF arg_value ::= arg
Used by (10)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › expr › arg › arg_rhs
BNF arg_rhs ::= arg
| arg modifier_rescue after_rescue arg
Used by (1)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › opt_call_args
BNF opt_call_args ::= none
| call_args
| args ','
| args ',' assocs ','
| assocs ','
Used by (6)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › opt_call_args › call_args
BNF call_args ::= command
| args opt_block_arg
| assocs opt_block_arg
| args ',' assocs opt_block_arg
| block_arg
Used by (4)
References (5)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
&
program › top_compstmt › top_stmts › top_stmt › stmt › mrhs › args
BNF args ::= arg_value
| arg_splat
| args ',' arg_value
| args ',' arg_splat
Used by (6)
References (3)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › mrhs_arg
BNF mrhs_arg ::= mrhs
| arg_value
Used by (1)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › mrhs
BNF mrhs ::= args ',' arg_value
| args ',' tSTAR arg_value
| tSTAR arg_value
Used by (3)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
* method name
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary
BNF primary ::= literal
| strings
| xstring
| regexp
| words
| qwords
| symbols
| qsymbols
| var_ref
| backref
| tFID
| k_begin $@14 bodystmt k_end
| tLPAREN_ARG compstmt $@15 ')'
| tLPAREN compstmt ')'
| primary_value tCOLON2 tCONSTANT
| tCOLON3 tCONSTANT
| tLBRACK aref_args ']'
| tLBRACE assoc_list '}'
| k_return
| k_yield '(' call_args rparen
| k_yield '(' rparen
| k_yield
| keyword_defined option_'\n' '(' begin_defined expr rparen
| keyword_not '(' expr rparen
| keyword_not '(' rparen
| fcall brace_block
| method_call
| method_call brace_block
| lambda
| k_if expr_value then compstmt if_tail k_end
| k_unless expr_value then compstmt opt_else k_end
| k_while expr_value_do compstmt k_end
| k_until expr_value_do compstmt k_end
| k_case expr_value option_terms @16 case_body k_end
| k_case option_terms @17 case_body k_end
| k_case expr_value option_terms p_case_body k_end
| k_for for_var keyword_in expr_value_do compstmt k_end
| k_class cpath superclass $@18 bodystmt k_end
| k_class tLSHFT expr_value $@19 term bodystmt k_end
| k_module cpath $@20 bodystmt k_end
| defn_head f_arglist $@21 bodystmt k_end
| defs_head f_arglist $@22 bodystmt k_end
| keyword_break
| keyword_next
| keyword_redo
| keyword_retry
Used by (2)
References (60)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
method name
Code example [1, 2, 3]
program › top_compstmt › top_stmts › top_stmt › stmt › command_call › command › brace_body › opt_block_param › block_param_def › block_param
BNF block_param ::= f_arg ',' f_optarg_primary_value ',' f_rest_arg opt_args_tail_block_args_tail
| f_arg ',' f_optarg_primary_value ',' f_rest_arg ',' f_arg opt_args_tail_block_args_tail
| f_arg ',' f_optarg_primary_value opt_args_tail_block_args_tail
| f_arg ',' f_optarg_primary_value ',' f_arg opt_args_tail_block_args_tail
| f_arg ',' f_rest_arg opt_args_tail_block_args_tail
| f_arg excessed_comma
| f_arg ',' f_rest_arg ',' f_arg opt_args_tail_block_args_tail
| f_arg opt_args_tail_block_args_tail
| f_optarg_primary_value ',' f_rest_arg opt_args_tail_block_args_tail
| f_optarg_primary_value ',' f_rest_arg ',' f_arg opt_args_tail_block_args_tail
| f_optarg_primary_value opt_args_tail_block_args_tail
| f_optarg_primary_value ',' f_arg opt_args_tail_block_args_tail
| f_rest_arg opt_args_tail_block_args_tail
| f_rest_arg ',' f_arg opt_args_tail_block_args_tail
| block_args_tail
Used by (1)
References (6)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
constant
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › lambda › lambda_body
BNF lambda_body ::= tLAMBEG compstmt '}'
| keyword_do_LAMBDA $@26 bodystmt k_end
Used by (1)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
tLAMBEG }
program › top_compstmt › top_stmts › top_stmt › stmt › command_call › block_command › block_call
BNF block_call ::= command do_block
| block_call call_op2 operation2 opt_paren_args
| block_call call_op2 operation2 opt_paren_args brace_block
| block_call call_op2 operation2 command_args do_block
Used by (2)
References (8)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier & do end
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › method_call
BNF method_call ::= fcall paren_args
| primary_value call_op operation2 opt_paren_args
| primary_value tCOLON2 operation2 paren_args
| primary_value tCOLON2 operation3
| primary_value call_op paren_args
| primary_value tCOLON2 paren_args
| keyword_super paren_args
| keyword_super
| primary_value '[' opt_call_args rbracket
Used by (1)
References (9)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
super
program › top_compstmt › top_stmts › top_stmt › stmt › command_call › command › brace_body
BNF brace_body ::= @27 max_numparam numparam it_id allow_exits opt_block_param compstmt
Used by (3)
References (7)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › brace_block › do_body
BNF do_body ::= @28 max_numparam numparam it_id allow_exits opt_block_param bodystmt
Used by (2)
References (7)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › case_body
BNF case_body ::= k_when case_args then compstmt cases
Used by (2)
References (5)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
when method name then
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › p_case_body
BNF p_case_body ::= keyword_in p_in_kwarg p_pvtbl p_pktbl p_top_expr then $@29 compstmt p_cases
Used by (2)
References (8)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
in * then
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_top_expr_body
BNF p_top_expr_body ::= p_expr
| p_expr ','
| p_expr ',' p_args
| p_find
| p_args_tail
| p_kwargs
Used by (2)
References (5)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
*
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_top_expr_body › p_expr › p_as › p_alt › p_expr_basic
BNF p_expr_basic ::= p_value
| p_variable
| p_const p_lparen p_args rparen
| p_const p_lparen p_find rparen
| p_const p_lparen p_kwargs rparen
| p_const '(' rparen
| p_const p_lbracket p_args rbracket
| p_const p_lbracket p_find rbracket
| p_const p_lbracket p_kwargs rbracket
| p_const '[' rbracket
| tLBRACK p_args rbracket
| tLBRACK p_find rbracket
| tLBRACK rbracket
| tLBRACE p_pktbl lex_ctxt $@30 p_kwargs rbrace
| tLBRACE rbrace
| tLPAREN p_pktbl p_expr rparen
Used by (1)
References (15)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_top_expr_body › p_args
BNF p_args ::= p_expr
| p_args_head
| p_args_head p_arg
| p_args_head p_rest
| p_args_head p_rest ',' p_args_post
| p_args_tail
Used by (2)
References (6)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
*
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_top_expr_body › p_args › p_args_post
BNF p_args_post ::= p_arg
| p_args_post ',' p_arg
Used by (4)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_top_expr_body › p_expr › p_as › p_alt › p_expr_basic › p_value
BNF p_value ::= p_primitive
| p_primitive tDOT2 p_primitive
| p_primitive tDOT3 p_primitive
| p_primitive tDOT2
| p_primitive tDOT3
| p_var_ref
| p_expr_ref
| p_const
| tBDOT2 p_primitive
| tBDOT3 p_primitive
Used by (1)
References (4)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
constant
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › symbol › dsym › string_contents
BNF string_contents ::= ε
| string_contents string_content
Used by (5)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › xstring › xstring_contents
BNF xstring_contents ::= ε
| xstring_contents string_content
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › primary_value › primary › regexp › regexp_contents
BNF regexp_contents ::= ε
| regexp_contents string_content
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › symbol › dsym › string_contents › string_content
BNF string_content ::= tSTRING_CONTENT
| tSTRING_DVAR @31 string_dvar
| tSTRING_DBEG @32 @33 @34 compstmt string_dend
Used by (4)
References (7)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
string content
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › symbol
BNF symbol ::= ssym
| dsym
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
symbol literal terminator
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › symbol › ssym
BNF ssym ::= tSYMBEG sym
Used by (1)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
symbol literal identifier
program › top_compstmt › top_stmts › top_stmt › stmt › fitem › symbol › dsym
BNF dsym ::= tSYMBEG string_contents tSTRING_END
Used by (1)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
symbol literal terminator
program › top_compstmt › top_stmts › top_stmt › stmt › expr › arg › simple_numeric
BNF simple_numeric ::= tINTEGER
| tFLOAT
| tRATIONAL
| tIMAGINARY
Used by (2)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
integer
program › top_compstmt › top_stmts › top_stmt › stmt › lhs › user_variable
BNF user_variable ::= tIDENTIFIER
| tCONSTANT
| nonlocal_var
Used by (4)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › lhs › keyword_variable
BNF keyword_variable ::= keyword_nil
| keyword_self
| keyword_true
| keyword_false
| keyword__FILE__
| keyword__LINE__
| keyword__ENCODING__
Used by (5)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
nil
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › var_lhs
BNF var_lhs ::= user_variable
| keyword_variable
Used by (2)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › f_opt_paren_args › f_paren_args › f_args
BNF f_args ::= f_arg ',' f_optarg_arg_value ',' f_rest_arg opt_args_tail_args_tail
| f_arg ',' f_optarg_arg_value ',' f_rest_arg ',' f_arg opt_args_tail_args_tail
| f_arg ',' f_optarg_arg_value opt_args_tail_args_tail
| f_arg ',' f_optarg_arg_value ',' f_arg opt_args_tail_args_tail
| f_arg ',' f_rest_arg opt_args_tail_args_tail
| f_arg ',' f_rest_arg ',' f_arg opt_args_tail_args_tail
| f_arg opt_args_tail_args_tail
| f_optarg_arg_value ',' f_rest_arg opt_args_tail_args_tail
| f_optarg_arg_value ',' f_rest_arg ',' f_arg opt_args_tail_args_tail
| f_optarg_arg_value opt_args_tail_args_tail
| f_optarg_arg_value ',' f_arg opt_args_tail_args_tail
| f_rest_arg opt_args_tail_args_tail
| f_rest_arg ',' f_arg opt_args_tail_args_tail
| args_tail
| ε
Used by (3)
References (5)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › opt_call_args › assocs › assoc
BNF assoc ::= arg_value tASSOC arg_value
| tLABEL arg_value
| tLABEL
| tSTRING_BEG string_contents tLABEL_END arg_value
| tDSTAR arg_value
| tDSTAR
Used by (1)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
label
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › rparen
BNF rparen ::= option_'\n' ')'
Used by (11)
References (1)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
)
program › top_compstmt › top_stmts › terms › term
BNF term ::= ';'
| '\n'
Used by (6)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
;
program › top_compstmt › top_stmts › terms
BNF terms ::= term
| terms ';'
Used by (4)
References (2)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
;
program › top_compstmt › top_stmts › none
BNF none ::= ε
Used by (16)
References (0)
Shortest derivation This is a token sequence derived from the grammar. It may require lexer context or semantic checks to be valid code.
ε