Commit graph

2691 commits

Author SHA1 Message Date
Nobuyoshi Nakada
9059dfce12
yield cannot be placed outside methods even in blocks 2023-10-02 23:20:03 +09:00
yui-knk
4da04d5f43 Include new node types into %printer 2023-10-02 13:49:57 +09:00
yui-knk
81668579ed Remove not used fields from call nodes 2023-10-02 09:41:45 +09:00
yui-knk
fdc329ea6f Correctly casting node for accessing nd_args in parse.y 2023-10-02 09:41:45 +09:00
yui-knk
c1894a9d8b Use rb_node_fcall_t instead of NODE 2023-10-02 09:41:45 +09:00
yui-knk
50756a1f08 Use rb_node_block_pass_t instead of NODE 2023-10-01 19:38:03 +09:00
yui-knk
08239fd6af Use rb_node_args_t and rb_node_args_aux_t instead of NODE 2023-10-01 19:38:03 +09:00
yui-knk
cecd1de2eb Use rb_node_opt_arg_t and rb_node_kw_arg_t instead of NODE 2023-10-01 09:19:42 +09:00
Nobuyoshi Nakada
1cedecebb8 Stop saving source locations unnecessarily
`node_newnode` and `parser_dispatch_delayed_token` do not use or
change `ruby_sourceline`.
2023-09-30 20:14:53 +09:00
Nobuyoshi Nakada
7592b07c28 Take line number from the tracked token location 2023-09-30 20:14:53 +09:00
yui-knk
4997903c20 Remove not used fields from FOR_MASGN 2023-09-30 19:17:28 +09:00
yui-knk
1fbccd02ee Remove not used fields from OP_ASGN_AND, OP_ASGN_OR 2023-09-30 18:53:40 +09:00
yui-knk
eba19d86d4 Remove not used fields from HASH 2023-09-30 17:20:54 +09:00
yui-knk
97ac5deeec Remove not used fields from BEGIN 2023-09-30 17:20:16 +09:00
yui-knk
716a12902d Remove not used fields from ERROR 2023-09-30 17:02:50 +09:00
yui-knk
db18428fff Remove not used fields from ITER, FOR 2023-09-30 16:30:57 +09:00
yui-knk
4c18615ffe Remove not used fields from MODULE, SCLASS 2023-09-30 16:24:43 +09:00
yui-knk
4e90be4c93 Remove not used fields from ONCE 2023-09-30 13:23:32 +09:00
yui-knk
d293d9e191 Expand pattern_info struct into ARYPTN Node and FNDPTN Node 2023-09-30 13:11:32 +09:00
yui-knk
1b97c17e03 Remove not used fields from ARYPTN, FNDPTN 2023-09-30 13:11:32 +09:00
yui-knk
129d006852 Remove not used fields from argument nodes 2023-09-30 12:29:29 +09:00
yui-knk
83af0b9128 Remove not used fields from NTH_REF, BACK_REF 2023-09-30 12:28:06 +09:00
yui-knk
0a386b827b Remove not used fields from ERRINFO 2023-09-30 11:23:20 +09:00
yui-knk
fa54d06a40 Remove not used fields from POSTEXE 2023-09-30 11:22:06 +09:00
yui-knk
f9f728e804 Remove not used fields from DEFINED 2023-09-30 10:48:07 +09:00
yui-knk
ef37bdeb4d Remove not used fields from AND, OR 2023-09-30 10:27:39 +09:00
yui-knk
443099377f Remove not used fields from LAMBDA 2023-09-30 10:15:25 +09:00
Nobuyoshi Nakada
a2b6427514 Consolidate includes common to universal parser 2023-09-30 02:39:01 +09:00
yui-knk
7979f07427 Change NODE DEF_TEMP nd_cval to struct lex_context 2023-09-29 19:36:34 +09:00
yui-knk
68ae87546e Merge NODE_DEF_TEMP and NODE_DEF_TEMP2 2023-09-29 19:36:34 +09:00
yui-knk
5537a41059 Remove not used fields from CASE, CASE2, CASE3 2023-09-29 17:31:34 +09:00
yui-knk
b9bf419aa3 Remove not used fields from ALIAS, VALIAS, UNDEF 2023-09-29 11:43:04 +09:00
yui-knk
52f8b347a0 Remove not used fields from DOT2, DOT3, FLIP2, FLIP3 2023-09-29 10:09:04 +09:00
yui-knk
37a783a30c Merge RNode_OP_ASGN2 and RNode_OP_ASGN22 2023-09-29 08:36:39 +09:00
yui-knk
23bcdda377 Remove not used fields from SELF, NIL, TRUE, FALSE 2023-09-29 07:43:29 +09:00
Nobuyoshi Nakada
eaa0fbf9b9 Fix retry in nested rescue blocks
Restore `rescue`-context from the outer context.
`retry` targets the next outer block except for between `rescue` and
`else` or `ensure`, otherwise, if there is no enclosing block, it
should be syntax error.
2023-09-29 03:14:17 +09:00
Nobuyoshi Nakada
b5e23d3e3b
Syntax check of yield in the parser 2023-09-28 16:23:51 +09:00
Nobuyoshi Nakada
ad96962173
Jumps are possible in the top-level loop 2023-09-28 15:12:27 +09:00
yui-knk
74c6781153 Change RNode structure from union to struct
All kind of AST nodes use same struct RNode, which has u1, u2, u3 union members
for holding different kind of data.
This has two problems.

1. Low flexibility of data structure

Some nodes, for example NODE_TRUE, don’t use u1, u2, u3. On the other hand,
NODE_OP_ASGN2 needs more than three union members. However they use same
structure definition, need to allocate three union members for NODE_TRUE and
need to separate NODE_OP_ASGN2 into another node.
This change removes the restriction so make it possible to
change data structure by each node type.

2. No compile time check for union member access

It’s developer’s responsibility for using correct member for each node type when it’s union.
This change clarifies which node has which type of fields and enables compile time check.

This commit also changes node_buffer_elem_struct buf management to handle
different size data with alignment.
2023-09-28 11:58:10 +09:00
Nobuyoshi Nakada
5b36c11e21 Out of place jumps are valid in defined? 2023-09-27 21:53:01 +09:00
Nobuyoshi Nakada
29e5fca718 Syntax check of retry in the parser 2023-09-27 21:53:01 +09:00
Nobuyoshi Nakada
ff8278e52c Fix error token location 2023-09-27 21:53:01 +09:00
Nobuyoshi Nakada
e1250a5f97 Syntax check of block exits in the parser 2023-09-27 21:53:01 +09:00
Nobuyoshi Nakada
e2a5f0469c Use named references for method/class/module definitions 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
03ef85bee7 Extract class/module context checks 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
56604c7a3b Split the build of RESBODY nodes 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
4449dcac15 Reduce stack usage in string_content 2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
dd292640bf Remove escape_Qundef
Ripper dispatcher methods always escape `Qundef` by `get_value`.
2023-09-25 23:04:09 +09:00
Nobuyoshi Nakada
963d12722e Name midrules in complex rules 2023-09-25 23:04:09 +09:00
yui-knk
34d802f32f Refactor to use ripper_new_yylval2 2023-09-24 12:58:01 +09:00