mruby 4.0
4.0 3.4
Grammar changes
Tokens
Source: mrbgems/mruby-compiler/core/parse.y @ 4.0.0 (831da26) / lrama 0.8.0 / 2026-04-20
These diagrams describe a parser grammar, rather than the complete language specification. Lexer state and semantic checks may impose additional restrictions.
MIT
Start wrapper
Unreachable
BNF $accept ::= program YYEOF
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 file
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.
ε
program › top_compstmt
BNF top_compstmt ::= top_stmts opt_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
| YYerror 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 @2 '{' top_compstmt '}'
Used by (1)
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
Midrule action
program › top_compstmt › top_stmts › top_stmt › @2
BNF @2 ::= ε
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 › arg › primary › bodystmt
BNF bodystmt ::= compstmt opt_rescue opt_else opt_ensure
Used by (4)
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 › compstmt
BNF compstmt ::= stmts opt_terms
Used by (14)
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
| stmts terms stmt
| YYerror 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.
ε
Midrule action
program › top_compstmt › top_stmts › top_stmt › stmt › $@3
BNF $@3 ::= ε
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 fsym $@3 fsym
| 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 stmt
| keyword_END '{' compstmt '}'
| command_asgn
| mlhs '=' command_call
| lhs '=' mrhs
| mlhs '=' arg
| mlhs '=' mrhs
| expr
Used by (4)
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.
method name
Code example if true
puts "hello"
end
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn
BNF command_asgn ::= lhs '=' command_rhs
| var_lhs tOP_ASGN command_rhs
| primary_value '[' opt_call_args ']' tOP_ASGN command_rhs
| primary_value call_op tIDENTIFIER tOP_ASGN command_rhs
| primary_value call_op tCONSTANT tOP_ASGN command_rhs
| primary_value tCOLON2 tCONSTANT tOP_ASGN command_call
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN command_rhs
| defn_head f_opt_arglist_paren '=' command
| defn_head f_opt_arglist_paren '=' command modifier_rescue arg
| defs_head f_opt_arglist_paren '=' command
| defs_head f_opt_arglist_paren '=' command modifier_rescue arg
| backref tOP_ASGN 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.
numbered parameter = identifier &
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › command_rhs
BNF command_rhs ::= command_call
| command_call modifier_rescue stmt
| command_asgn
Used by (1)
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 &
+2 alternatives added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr
BNF expr ::= command_call
| expr keyword_and expr
| expr keyword_or expr
| keyword_not opt_nl expr
| '!' command_call
| arg tASSOC $@4 p_expr
| arg keyword_in $@5 p_expr
| arg+ alternatives added in 4.0
+ arg tASSOC p_expr
+ arg keyword_in p_expr
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.
method name
Code example (1 + 2) * 3
Midrule action
program › top_compstmt › top_stmts › top_stmt › stmt › expr › $@4
BNF $@4 ::= ε
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 › $@5
BNF $@5 ::= ε
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 ::= keyword_def singleton dot_or_colon $@6 fname
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.
def identifier . identifier
program › top_compstmt › top_stmts › top_stmt › stmt › expr_value
BNF expr_value ::= expr
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.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › command_call
BNF command_call ::= command
| block_command
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 › 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_asgn › command
BNF command ::= operation command_args
| operation 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
| keyword_super command_args
| keyword_yield command_args
| keyword_return call_args
| keyword_break call_args
| keyword_next call_args
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.
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_list
| mlhs_list mlhs_item
| mlhs_list tSTAR mlhs_node
| mlhs_list tSTAR mlhs_node ',' mlhs_post
| mlhs_list tSTAR
| mlhs_list 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_list
BNF mlhs_list ::= mlhs_item ','
| mlhs_list mlhs_item ','
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 › mlhs › mlhs_basic › mlhs_post
BNF mlhs_post ::= mlhs_item
| mlhs_list mlhs_item
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.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › mlhs › mlhs_basic › mlhs_node
BNF mlhs_node ::= variable
| primary_value '[' opt_call_args ']'
| 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 (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
program › top_compstmt › top_stmts › top_stmt › stmt › lhs
BNF lhs ::= variable
| primary_value '[' opt_call_args ']'
| primary_value call_op tIDENTIFIER
| primary_value tCOLON2 tIDENTIFIER
| primary_value call_op tCONSTANT
| primary_value tCOLON2 tCONSTANT
| tCOLON3 tCONSTANT
| backref
| tNUMPARAM
Used by (5)
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.
numbered parameter
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › cpath
BNF cpath ::= tCOLON3 cname
| cname
| primary_value tCOLON2 cname
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.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › fsym › fname
BNF fname ::= tIDENTIFIER
| tCONSTANT
| tFID
| op
| reswords
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 › fsym
BNF fsym ::= fname
| basic_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 ::= fsym
| undef_list ',' $@8 fsym
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 › fsym › 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 › fsym › 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_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 › arg
BNF arg ::= lhs '=' arg_rhs
| var_lhs tOP_ASGN arg_rhs
| primary_value '[' opt_call_args ']' tOP_ASGN arg_rhs
| primary_value call_op tIDENTIFIER tOP_ASGN arg_rhs
| primary_value call_op tCONSTANT tOP_ASGN arg_rhs
| primary_value tCOLON2 tIDENTIFIER tOP_ASGN arg_rhs
| primary_value tCOLON2 tCONSTANT tOP_ASGN arg_rhs
| tCOLON3 tCONSTANT tOP_ASGN arg_rhs
| backref tOP_ASGN arg_rhs
| arg tDOT2 arg
| arg tDOT2
| tBDOT2 arg
| arg tDOT3 arg
| arg tDOT3
| tBDOT3 arg
| arg '+' arg
| arg '-' arg
| arg '*' arg
| arg '/' arg
| arg '%' arg
| arg tPOW arg
| tUMINUS_NUM tINTEGER tPOW arg
| tUMINUS_NUM tFLOAT tPOW arg
| tUPLUS arg
| tUMINUS arg
| arg '|' arg
| arg '^' arg
| arg '&' arg
| arg tCMP arg
| arg '>' arg
| arg tGEQ arg
| arg '<' arg
| arg tLEQ arg
| 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
| arg '?' arg opt_nl ':' arg
| arg '?' arg opt_nl tLABEL_TAG arg
| defn_head f_opt_arglist_paren '=' arg
| defn_head f_opt_arglist_paren '=' arg modifier_rescue arg
| defs_head f_opt_arglist_paren '=' arg
| defs_head f_opt_arglist_paren '=' arg modifier_rescue arg
| primary
Used by (12)
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.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › aref_args
BNF aref_args ::= none
| args trailer
| args comma assocs trailer
| assocs trailer
Used by (1)
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 › arg › arg_rhs
BNF arg_rhs ::= arg
| arg modifier_rescue arg
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.
method name
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › opt_call_args
BNF opt_call_args ::= none
| call_args opt_terms
| args comma
| args comma assocs comma
| assocs comma
Used by (6)
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 › command_asgn › opt_call_args › call_args
BNF call_args ::= command
| args opt_block_arg
| assocs opt_block_arg
| args comma assocs opt_block_arg
| block_arg
Used by (3)
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 › mrhs › comma
BNF comma ::= ',' opt_nl
Used by (9)
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 › args
BNF args ::= arg
| tSTAR
| tSTAR arg
| args comma arg
| args comma tSTAR
| args comma tSTAR arg
Used by (7)
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 › mrhs
BNF mrhs ::= args comma arg
| args comma tSTAR arg
| tSTAR 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
+4 alternatives added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary
BNF primary ::= literal
| string
| xstring
| regexp
| heredoc
| var_ref
| backref
| tFID
| keyword_begin @10 bodystmt keyword_end
| tLPAREN_ARG @11 compstmt $@12 rparen
| tLPAREN_ARG $@13 rparen
| tLPAREN compstmt ')'
| primary_value tCOLON2 tCONSTANT
| tCOLON3 tCONSTANT
| tLBRACK aref_args ']'
| tLBRACE assoc_list '}'
| keyword_return
| keyword_yield opt_paren_args
| keyword_not '(' expr rparen
| keyword_not '(' rparen
| operation brace_block
| method_call
| method_call brace_block
| tLAMBDA @14 f_larglist @15 lambda_body
| keyword_if expr_value then compstmt if_tail keyword_end
| keyword_unless expr_value then compstmt opt_else keyword_end
| keyword_while $@16 expr_value do $@17 compstmt keyword_end
| keyword_until $@18 expr_value do $@19 compstmt keyword_end
| keyword_case expr_value opt_terms case_body keyword_end
| keyword_case opt_terms case_body keyword_end
| keyword_case expr_value opt_terms keyword_in p_expr then compstmt in_clauses keyword_end
| keyword_case expr_value opt_terms keyword_in p_expr modifier_if expr_value then compstmt in_clauses keyword_end
| keyword_case expr_value opt_terms keyword_in p_expr modifier_unless expr_value then compstmt in_clauses keyword_end
| keyword_for for_var keyword_in $@20 expr_value do $@21 compstmt keyword_end
| keyword_class cpath superclass @22 bodystmt keyword_end
| keyword_class tLSHFT expr @23 term @24 bodystmt keyword_end
| keyword_module cpath @25 bodystmt keyword_end
| defn_head f_arglist bodystmt keyword_end
| defs_head f_arglist bodystmt keyword_end
| keyword_break
| keyword_next
| keyword_redo
| keyword_retry+ alternatives added in 4.0
+ tLPAREN_ARG compstmt rparen
+ keyword_case expr_value opt_terms keyword_in p_expr then compstmt in_clauses keyword_end
+ keyword_case expr_value opt_terms keyword_in p_expr modifier_if expr_value then compstmt in_clauses keyword_end
+ keyword_case expr_value opt_terms keyword_in p_expr modifier_unless expr_value then compstmt in_clauses keyword_end
Used by (2)
References (52)
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
Midrule action
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › @10
BNF @10 ::= ε
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 › arg › primary › @11
BNF @11 ::= ε
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 › arg › primary › @14
BNF @14 ::= ε
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 › arg › primary › @15
BNF @15 ::= ε
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 › arg › primary › @22
BNF @22 ::= ε
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 › arg › primary › @23
BNF @23 ::= ε
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 › arg › primary › @24
BNF @24 ::= ε
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 › arg › primary › @25
BNF @25 ::= ε
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 › arg › primary › then
BNF then ::= term
| keyword_then
| term keyword_then
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.
then
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › do
BNF do ::= term
| keyword_do_cond
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.
do
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › if_tail
BNF if_tail ::= opt_else
| keyword_elsif expr_value then compstmt if_tail
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 › arg › primary › for_var
BNF for_var ::= lhs
| mlhs
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.
numbered parameter
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › command › cmd_brace_block › opt_block_param › block_param_def › block_param
BNF block_param ::= f_arg ',' f_block_optarg ',' f_rest_arg opt_block_args_tail
| f_arg ',' f_block_optarg ',' f_rest_arg ',' f_arg opt_block_args_tail
| f_arg ',' f_block_optarg opt_block_args_tail
| f_arg ',' f_block_optarg ',' f_arg opt_block_args_tail
| f_arg ',' f_rest_arg opt_block_args_tail
| f_arg ',' opt_block_args_tail
| f_arg ',' f_rest_arg ',' f_arg opt_block_args_tail
| f_arg opt_block_args_tail
| f_block_optarg ',' f_rest_arg opt_block_args_tail
| f_block_optarg ',' f_rest_arg ',' f_arg opt_block_args_tail
| f_block_optarg opt_block_args_tail
| f_block_optarg ',' f_arg opt_block_args_tail
| f_rest_arg opt_block_args_tail
| f_rest_arg ',' f_arg opt_block_args_tail
| block_args_tail
Used by (1)
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.
constant
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › lambda_body
BNF lambda_body ::= tLAMBEG compstmt '}'
| keyword_do_LAMBDA bodystmt keyword_end
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.
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 › arg › primary › method_call
BNF method_call ::= operation 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 ']'
Used by (1)
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.
super
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › brace_block
BNF brace_block ::= '{' @29 opt_block_param compstmt '}'
| keyword_do @30 opt_block_param bodystmt keyword_end
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 › arg › primary › case_body
BNF case_body ::= keyword_when args then compstmt cases
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.
when * then
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › in_clauses
BNF in_clauses ::= opt_else
| keyword_in p_expr $@31 then compstmt in_clauses
| keyword_in p_expr $@32 modifier_if expr_value then compstmt in_clauses
| keyword_in p_expr $@33 modifier_unless expr_value then compstmt in_clauses
Used by (2)
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.
ε
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr
BNF p_expr ::= p_as
| p_args_head p_as
| p_args_head p_rest
| p_args_head p_rest ',' p_args_post
| p_rest
| p_rest ',' p_args_post
| p_hash_elems
| p_hash_elems ',' p_kwrest
| p_kwrest
Used by (3)
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.
*
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_args_head
BNF p_args_head ::= p_as ','
| p_args_head p_as ','
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.
tSTRING ,
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_args_post
BNF p_args_post ::= p_as
| p_args_post ',' p_as
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.
tSTRING
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_as
BNF p_as ::= p_alt
| p_alt tASSOC tIDENTIFIER
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.
tSTRING
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_as › p_alt
BNF p_alt ::= p_value
| p_alt '|' p_value
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.
tSTRING
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_as › p_alt › p_value
BNF p_value ::= p_var
| numeric
| symbol
| tSTRING
| keyword_nil
| keyword_true
| keyword_false
| p_const
| p_array
| p_hash
| '^' tIDENTIFIER
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.
tSTRING
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_as › p_alt › p_value › p_array › p_array_body
BNF p_array_body ::= p_array_elems
| p_array_elems ',' p_rest
| p_array_elems ',' p_rest ',' p_array_elems
| p_rest
| p_rest ',' p_array_elems
| p_rest ',' p_array_elems ',' p_rest
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.
*
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_rest
BNF p_rest ::= tSTAR tIDENTIFIER
| tSTAR
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.
*
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_as › p_alt › p_value › p_hash › p_hash_body
BNF p_hash_body ::= p_hash_elems
| p_hash_elems ',' p_kwrest
| p_kwrest
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.
**
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_hash_elems
BNF p_hash_elems ::= p_hash_elem
| p_hash_elems ',' p_hash_elem
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 label
+ Added in 4.0
program › top_compstmt › top_stmts › top_stmt › stmt › expr › p_expr › p_kwrest
BNF p_kwrest ::= tDSTAR tIDENTIFIER
| tDSTAR keyword_nil
| tDSTAR
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.
**
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › literal
BNF literal ::= numeric
| symbol
| words
| symbols
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.
integer
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › string
BNF string ::= string_fragment
| string string_fragment
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.
character
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › string › string_fragment
BNF string_fragment ::= tCHAR
| tSTRING
| tSTRING_BEG tSTRING
| tSTRING_BEG string_rep tSTRING
Used by (2)
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.
character
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › xstring
BNF xstring ::= tXSTRING_BEG tXSTRING
| tXSTRING_BEG string_rep tXSTRING
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.
tXSTRING_BEG tXSTRING
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › regexp
BNF regexp ::= tREGEXP_BEG tREGEXP
| tREGEXP_BEG string_rep tREGEXP
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.
tREGEXP_BEG tREGEXP
program › top_compstmt › top_stmts › terms › term › nl › heredoc_body
BNF heredoc_body ::= tHEREDOC_END
| heredoc_string_rep tHEREDOC_END
Used by (2)
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.
tHEREDOC_END
program › top_compstmt › top_stmts › terms › term › nl › heredoc_body › heredoc_string_rep
BNF heredoc_string_rep ::= heredoc_string_interp
| heredoc_string_rep heredoc_string_interp
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.
tHD_STRING_MID
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › literal › words
BNF words ::= tWORDS_BEG tSTRING
| tWORDS_BEG string_rep tSTRING
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.
tWORDS_BEG tSTRING
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › literal › symbol
BNF symbol ::= basic_symbol
| tSYMBEG tSTRING_BEG string_rep tSTRING
| tSYMBEG tNUMPARAM
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 numbered parameter
program › top_compstmt › top_stmts › top_stmt › stmt › fsym › basic_symbol
BNF basic_symbol ::= tSYMBEG sym
Used by (2)
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 identifier
program › top_compstmt › top_stmts › top_stmt › stmt › fsym › basic_symbol › sym
BNF sym ::= fname
| tIVAR
| tGVAR
| tCVAR
| tSTRING
| tSTRING_BEG tSTRING
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.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › literal › symbols
BNF symbols ::= tSYMBOLS_BEG tSTRING
| tSYMBOLS_BEG string_rep tSTRING
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.
tSYMBOLS_BEG tSTRING
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › literal › numeric
BNF numeric ::= tINTEGER
| tFLOAT
| tUMINUS_NUM tINTEGER
| tUMINUS_NUM tFLOAT
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 › variable
BNF variable ::= tIDENTIFIER
| tIVAR
| tGVAR
| tCVAR
| tCONSTANT
Used by (4)
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.
identifier
program › top_compstmt › top_stmts › top_stmt › stmt › arg › primary › var_ref
BNF var_ref ::= variable
| tNUMPARAM
| keyword_nil
| keyword_self
| keyword_true
| keyword_false
| keyword__FILE__
| keyword__LINE__
| keyword__ENCODING__
Used by (2)
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 › arg › primary › f_arglist
BNF f_arglist ::= f_arglist_paren
| f_args term
| f_arg ',' tBDOT3 term
| tDOT3 term
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.
;
program › top_compstmt › top_stmts › top_stmt › stmt › command_asgn › f_opt_arglist_paren › f_arglist_paren › f_args
BNF f_args ::= f_arg ',' f_optarg ',' f_rest_arg opt_args_tail
| f_arg ',' f_optarg ',' f_rest_arg ',' f_arg opt_args_tail
| f_arg ',' f_optarg opt_args_tail
| f_arg ',' f_optarg ',' f_arg opt_args_tail
| f_arg ',' f_rest_arg opt_args_tail
| f_arg ',' f_rest_arg ',' f_arg opt_args_tail
| f_arg opt_args_tail
| f_optarg ',' f_rest_arg opt_args_tail
| f_optarg ',' f_rest_arg ',' f_arg opt_args_tail
| f_optarg opt_args_tail
| f_optarg ',' f_arg opt_args_tail
| f_rest_arg opt_args_tail
| f_rest_arg ',' f_arg opt_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 tASSOC arg
| tIDENTIFIER tLABEL_TAG arg
| tIDENTIFIER tLABEL_TAG
| tNUMPARAM tLABEL_TAG
| tNUMPARAM tLABEL_TAG arg
| string_fragment tLABEL_TAG arg
| tDSTAR arg
| 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.
**
program › top_compstmt › opt_terms
BNF opt_terms ::= ε
| terms
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 › arg › opt_nl
BNF opt_nl ::= ε
| opt_nl nl
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 › mlhs › rparen
BNF rparen ::= opt_terms ')'
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 › terms › term
BNF term ::= ';'
| nl
Used by (6)
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 › nl
BNF nl ::= '\n'
| heredoc_body
Used by (2)
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.
newline
program › top_compstmt › top_stmts › terms
BNF terms ::= term
| terms term
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 › none
BNF none ::= ε
Used by (15)
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.
ε