summaryrefslogtreecommitdiff
path: root/rubyparser.h
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-07-25 14:57:14 +0900
committerYuichiro Kaneko <[email protected]>2024-07-26 07:29:32 +0900
commitf2728c3393d7571f681accd9c887dcd5bad65950 ()
tree6f6d6f061516255d122b898f3661809cbf9ce2aa /rubyparser.h
parenta4563be05c1e7c6031e6fde613f7e874f41fe06c (diff)
Change RESBODY Node structure
Extracrt exception variable into `nd_exc_var` field to keep the original grammar structure. For example: ``` begin rescue Error => e1 end ``` Before: ``` @ NODE_RESBODY (id: 8, line: 2, location: (2,0)-(2,18)) +- nd_args: | @ NODE_LIST (id: 2, line: 2, location: (2,7)-(2,12)) | +- as.nd_alen: 1 | +- nd_head: | | @ NODE_CONST (id: 1, line: 2, location: (2,7)-(2,12)) | | +- nd_vid: :Error | +- nd_next: | (null node) +- nd_body: | @ NODE_BLOCK (id: 6, line: 2, location: (2,13)-(2,18)) | +- nd_head (1): | | @ NODE_LASGN (id: 3, line: 2, location: (2,13)-(2,18)) | | +- nd_vid: :e1 | | +- nd_value: | | @ NODE_ERRINFO (id: 5, line: 2, location: (2,13)-(2,18)) | +- nd_head (2): | @ NODE_BEGIN (id: 4, line: 2, location: (2,18)-(2,18)) | +- nd_body: | (null node) +- nd_next: (null node) ``` After: ``` @ NODE_RESBODY (id: 6, line: 2, location: (2,0)-(2,18)) +- nd_args: | @ NODE_LIST (id: 2, line: 2, location: (2,7)-(2,12)) | +- as.nd_alen: 1 | +- nd_head: | | @ NODE_CONST (id: 1, line: 2, location: (2,7)-(2,12)) | | +- nd_vid: :Error | +- nd_next: | (null node) +- nd_exc_var: | @ NODE_LASGN (id: 3, line: 2, location: (2,13)-(2,18)) | +- nd_vid: :e1 | +- nd_value: | @ NODE_ERRINFO (id: 5, line: 2, location: (2,13)-(2,18)) +- nd_body: | @ NODE_BEGIN (id: 4, line: 2, location: (2,18)-(2,18)) | +- nd_body: | (null node) +- nd_next: (null node) ```
Notes: Merged: https://.com/ruby/ruby/pull/11243
-rw-r--r--rubyparser.h1
1 files changed, 1 insertions, 0 deletions
@@ -396,6 +396,7 @@ typedef struct RNode_RESBODY {
NODE node;
struct RNode *nd_args;
struct RNode *nd_body;
struct RNode *nd_next;
} rb_node_resbody_t;