diff options
author | ydah <[email protected]> | 2024-11-05 14:13:29 +0900 |
---|---|---|
committer | Yudai Takada <[email protected]> | 2025-01-04 13:53:13 +0900 |
commit | 5fcc3ab534cb001a577a5c64381d3a31813344c9 () | |
tree | 62687d0f66759fbfa458f6c5182f320a57f2fbf5 /ast.c | |
parent | fa2517451ec265d5b273e864bc750a1b9ba2957f (diff) |
Implement REGX 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,5)) +-- locals: [] +-- statements: @ StatementsNode (location: (1,0)-(1,5)) +-- body: (length: 1) +-- @ RegularExpressionNode (location: (1,0)-(1,5)) +-- RegularExpressionFlags: forced_us_ascii_encoding +-- opening_loc: (1,0)-(1,1) = "/" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- content_loc: (1,1)-(1,4) = "foo" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- closing_loc: (1,4)-(1,5) = "/" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +-- unescaped: "foo" ```
-rw-r--r-- | ast.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -849,6 +849,12 @@ node_locations(VALUE ast_value, const NODE *node) return rb_ary_new_from_args(2, location_new(nd_code_loc(node)), location_new(&RNODE_REDO(node)->keyword_loc)); case NODE_RETURN: return rb_ary_new_from_args(2, location_new(nd_code_loc(node)), |