diff options
author | ydah <[email protected]> | 2024-11-04 23:32:00 +0900 |
---|---|---|
committer | Yudai Takada <[email protected]> | 2025-01-04 07:34:25 +0900 |
commit | 4c192011422dc04902ddf930ff22be223325a35d (patch) | |
tree | 040fced96644259bd80af515e6ca1adc145cd3df /rubyparser.h | |
parent | 34ee062d74ebfcbd04a0f2be2cdfda9cd8d20716 (diff) |
Implement EVSTR 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 '"#{foo}"'
@ ProgramNode (location: (1,0)-(1,8))
+-- locals: []
+-- statements:
@ StatementsNode (location: (1,0)-(1,8))
+-- body: (length: 1)
+-- @ InterpolatedStringNode (location: (1,0)-(1,8))
+-- InterpolatedStringNodeFlags: nil
+-- opening_loc: (1,0)-(1,1) = "\""
+-- parts: (length: 1)
| +-- @ EmbeddedStatementsNode (location: (1,1)-(1,7))
| +-- opening_loc: (1,1)-(1,3) = "\#{"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| +-- statements:
| | @ StatementsNode (location: (1,3)-(1,6))
| | +-- body: (length: 1)
| | +-- @ CallNode (location: (1,3)-(1,6))
| | +-- CallNodeFlags: variable_call, ignore_visibility
| | +-- receiver: nil
| | +-- call_operator_loc: nil
| | +-- name: :foo
| | +-- message_loc: (1,3)-(1,6) = "foo"
| | +-- opening_loc: nil
| | +-- arguments: nil
| | +-- closing_loc: nil
| | +-- block: nil
| +-- closing_loc: (1,6)-(1,7) = "}"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+-- closing_loc: (1,7)-(1,8) = "\""
```
Diffstat (limited to 'rubyparser.h')
-rw-r--r-- | rubyparser.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/rubyparser.h b/rubyparser.h index fa2e2af264..e3c7eae05a 100644 --- a/rubyparser.h +++ b/rubyparser.h @@ -725,6 +725,8 @@ typedef struct RNode_EVSTR { NODE node; struct RNode *nd_body; + rb_code_location_t opening_loc; + rb_code_location_t closing_loc; } rb_node_evstr_t; typedef struct RNode_REGX { /* also RNode_MATCH */ |