summaryrefslogtreecommitdiff
path: root/node_dump.c
diff options
context:
space:
mode:
authorydah <[email protected]>2024-11-02 15:46:49 +0900
committerYudai Takada <[email protected]>2025-03-03 11:17:14 +0900
commita47e686cb6195dbd1266229d6e8d6bb17207c311 (patch)
treea8be0db1a50f1b41da76ebb3ae343bf5ab25541a /node_dump.c
parent617e8608b2cff8be1d063c2f47ab425cda839d58 (diff)
Implement POSTEXE NODE locations
The following Location information has been added This is the information required for parse.y to be a universal parser: ``` ❯ ruby --parser=prism --dump=parsetree -e "END { }" @ ProgramNode (location: (1,0)-(1,8)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,8)) +-- body: (length: 1) +-- @ PostExecutionNode (location: (1,0)-(1,8)) +-- statements: nil +-- keyword_loc: (1,0)-(1,3) = "END" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- opening_loc: (1,4)-(1,5) = "{" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,7)-(1,8) = "}" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
Diffstat (limited to 'node_dump.c')
-rw-r--r--node_dump.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/node_dump.c b/node_dump.c
index 14fb54fcb7..058aecb960 100644
--- a/node_dump.c
+++ b/node_dump.c
@@ -1106,8 +1106,11 @@ dump_node(VALUE buf, VALUE indent, int comment, const NODE * node)
ANN("post-execution");
ANN("format: END { [nd_body] }");
ANN("example: END { foo }");
- LAST_NODE;
F_NODE(nd_body, RNODE_POSTEXE, "END clause");
+ F_LOC(keyword_loc, RNODE_POSTEXE);
+ F_LOC(opening_loc, RNODE_POSTEXE);
+ LAST_NODE;
+ F_LOC(closing_loc, RNODE_POSTEXE);
return;
case NODE_ATTRASGN: