tree-sitter-nu
tree-sitter-nu copied to clipboard
Fail to parse assignments with pipeline
Code snippet like this
$a = $a
| str substring ..3
leads to parsing error because the right hand side is a pipeline instead of expression. This is involved by #28
=====
assignment-003-assignment-to-a-pipeline
=====
$x += 1 | $in + 10
# Note that rhs of ++= is not a pipeline, but only 1
# currently nushell parses this as two statements
# $x ++= 1 and $in + 10. Therefore you will get error
# about adding int to nothing, and $x increased by one
-----
(nu_script
(assignment
(val_variable
(identifier))
(val_number))
(ERROR)
(pipeline
(pipe_element
(expr_binary
(val_variable)
(val_number))))
(comment)
(comment)
(comment)
(comment))
Since this is no longer the truth, current version of nushell takes 1 | $in + 10
as the rhs value, should we consider to change it back to $.pipeline ?