diff options
author | ydah <[email protected]> | 2024-11-11 01:00:05 +0900 |
---|---|---|
committer | Yudai Takada <[email protected]> | 2025-01-09 18:24:56 +0900 |
commit | c721301132507c58dbef4f9bab0188a79f691e3c () | |
tree | e101e86f401b3a6c75837390cc1f457bbf390864 /rubyparser.h | |
parent | 841555245d770df88a0c8079fc97a51ffa7ef8e9 (diff) |
Implement FOR 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 "for a in b do end" @ ProgramNode (location: (1,0)-(1,17)) +-- locals: [:a] +-- statements: @ StatementsNode (location: (1,0)-(1,17)) +-- body: (length: 1) +-- @ ForNode (location: (1,0)-(1,17)) +-- index: | @ LocalVariableTargetNode (location: (1,4)-(1,5)) | +-- name: :a | +-- depth: 0 +-- collection: | @ CallNode (location: (1,9)-(1,10)) | +-- CallNodeFlags: variable_call, ignore_visibility | +-- receiver: nil | +-- call_operator_loc: nil | +-- name: :b | +-- message_loc: (1,9)-(1,10) = "b" | +-- opening_loc: nil | +-- arguments: nil | +-- closing_loc: nil | +-- block: nil +-- statements: nil +-- for_keyword_loc: (1,0)-(1,3) = "for" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- in_keyword_loc: (1,6)-(1,8) = "in" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- do_keyword_loc: (1,11)-(1,13) = "do" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- end_keyword_loc: (1,14)-(1,17) = "end" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ```
-rw-r--r-- | rubyparser.h | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -341,7 +341,18 @@ typedef struct RNode_ITER { struct RNode *nd_body; struct RNode *nd_iter; -} rb_node_iter_t, rb_node_for_t; typedef struct RNode_FOR_MASGN { NODE node; |