Actions
Bug #20465
openparse.y adds an extra empty string to the AST
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-05-02T15:27:18Z master 7c0cf71049) [arm64-darwin23]
Description
Given this code:
t0 = '\\xc1'
"#{t0}"
The AST is like this:
$ ./miniruby --dump=parsetree test.rb
###########################################################
## Do NOT use this node dump for any purpose other than ##
## debug and research. Compatibility is not guaranteed. ##
###########################################################
# @ NODE_SCOPE (id: 8, line: 1, location: (1,0)-(2,7))
# +- nd_tbl: :t0
# +- nd_args:
# | (null node)
# +- nd_body:
# @ NODE_BLOCK (id: 6, line: 1, location: (1,0)-(2,7))
# +- nd_head (1):
# | @ NODE_LASGN (id: 0, line: 1, location: (1,0)-(1,12))*
# | +- nd_vid: :t0
# | +- nd_value:
# | @ NODE_STR (id: 1, line: 1, location: (1,5)-(1,12))
# | +- string: "\\xc1"
# +- nd_head (2):
# @ NODE_DSTR (id: 4, line: 2, location: (2,0)-(2,7))*
# +- string: ""
# +- nd_next->nd_head:
# | @ NODE_EVSTR (id: 3, line: 2, location: (2,0)-(2,7))
# | +- nd_body:
# | @ NODE_LVAR (id: 2, line: 2, location: (2,3)-(2,5))
# | +- nd_vid: :t0
# +- nd_next->nd_next:
# (null node)
There is an empty DSTR. I don't think that DSTR should be there since it's not part of the source.
Actions
Like0
Like0Like0Like0