Ruby 3.4

出典: parse.y @ v3_4_0 (f450108) / lrama 0.8.0 / 2024-12-24

この図はパーサ向けの文法を表しています。言語仕様そのものではなく、字句解析器の状態や意味検査による制約は図に表れません。

Ruby 3.4以降の既定パーサはPrismです。この図はparse.y(--parser=parse.y)の文法であり、Prismと受理する構文が異なる場合があります。

BSD-2-Clause

読みやすい表示 原文どおり

$accept

$@1

program

option_terms

top_compstmt

top_stmts

top_stmt

block_open

begin_block

$@2

$@3

bodystmt

$@4

compstmt

stmts

stmt_or_begin

$@5

allow_exits

k_END

$@6

stmt

command_asgn

endless_command

option_'\n'

command_rhs

expr

$@7

$@8

def_name

defn_head

$@9

defs_head

expr_value

$@10

$@11

expr_value_do

command_call

block_command

cmd_brace_block

fcall

command

mlhs

mlhs_inner

mlhs_basic

mlhs_item

mlhs_head

mlhs_post

mlhs_node

lhs

cname

cpath

fname

fitem

undef_list

$@12

op

reswords

arg

endless_arg

relop

rel_expr

lex_ctxt

begin_defined

after_rescue

arg_value

aref_args

arg_rhs

paren_args

opt_paren_args

opt_call_args

call_args

$@13

command_args

block_arg

opt_block_arg

args

arg_splat

mrhs_arg

mrhs

primary

$@14

$@15

@16

@17

$@18

$@19

$@20

$@21

$@22

primary_value

k_begin

k_if

k_unless

k_while

k_until

k_case

k_for

k_class

k_module

k_def

k_do

k_do_block

k_rescue

k_ensure

k_when

k_else

k_elsif

k_end

k_return

k_yield

then

do

if_tail

opt_else

for_var

f_marg

f_marg_list

f_margs

f_rest_marg

f_any_kwrest

$@23

f_eq

f_kwarg_f_block_kw

block_args_tail

excessed_comma

f_opt_primary_value

f_optarg_primary_value

opt_args_tail_block_args_tail

block_param

opt_block_param

block_param_def

opt_bv_decl

bv_decls

bvar

max_numparam

numparam

it_id

@24

$@25

lambda

f_larglist

lambda_body

$@26

do_block

block_call

method_call

brace_block

@27

brace_body

@28

do_body

case_args

case_body

cases

p_pvtbl

p_pktbl

p_in_kwarg

$@29

p_case_body

p_cases

p_top_expr

p_top_expr_body

p_expr

p_as

p_alt

p_lparen

p_lbracket

p_expr_basic

$@30

p_args

p_args_head

p_args_tail

p_find

p_rest

p_args_post

p_arg

p_kwargs

p_kwarg

p_kw

p_kw_label

p_kwrest

p_kwnorest

p_any_kwrest

p_value

p_primitive

p_variable

p_var_ref

p_expr_ref

p_const

opt_rescue

exc_list

exc_var

opt_ensure

literal

strings

string

string1

xstring

regexp

nonempty_list_' '

words_tWORDS_BEG_word_list

words

word_list

word

words_tSYMBOLS_BEG_symbol_list

symbols

symbol_list

words_tQWORDS_BEG_qword_list

qwords

words_tQSYMBOLS_BEG_qsym_list

qsymbols

qword_list

qsym_list

string_contents

xstring_contents

regexp_contents

string_content

@31

@32

@33

@34

string_dend

string_dvar

symbol

ssym

sym

dsym

numeric

simple_numeric

nonlocal_var

user_variable

keyword_variable

var_ref

var_lhs

backref

$@35

superclass

f_opt_paren_args

f_paren_args

f_arglist

@36

f_kwarg_f_kw

args_tail

f_opt_arg_value

f_optarg_arg_value

opt_args_tail_args_tail

f_args

args_forward

f_bad_arg

f_norm_arg

f_arg_asgn

f_arg_item

f_arg

f_label

f_kw

f_block_kw

kwrest_mark

f_no_kwarg

f_kwrest

restarg_mark

f_rest_arg

blkarg_mark

f_block_arg

opt_f_block_arg

singleton

$@37

assoc_list

assocs

assoc

operation

operation2

operation3

dot_or_colon

call_op

call_op2

rparen

rbracket

rbrace

trailer

term

terms

none

キーボード操作

/で検索、jとkで前後の規則へ移動、?でこのヘルプを表示します。Escapeで閉じます。