Confusing behavior of pipes with empty elements
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40.5k
- Forks
- 2.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 85
Description
Describe the bug
Pipelines are allowed to have empty parts. However behavior of these empty parts and where they are allowed to appear is inconsistent.
How to reproduce
- In the middle of pipeline empty element is equivalent to
$in
is equivalent tols | | printls | $in | print - In the beginning of pipeline empty element is equivalent to
null
is equivalent to| describenull | describe - At the end of pipeline empty elements are not allowed. For example nu parser is not considering this a complete statement:
Expected behavior
Behavior 3. is expected. However behavior 1. and 2. are not. I expect them to be incorrect syntax, beacuse 1. is simply useless, I see no need for pipeline element that does nothing, and 2. is just confusing and also kinda useless (writing explicit null is much more clear)
Screenshots
No response
Configuration
| key | value |
|---|---|
| version | 0.84.0 |
| branch | |
| commit_hash | d2abb8603abab43ec4a6d4ed56f9018790b99dce |
| build_os | windows-x86_64 |
| build_target | x86_64-pc-windows-msvc |
| rust_version | rustc 1.69.0 (84c898d65 2023-04-16) |
| rust_channel | 1.69.0-x86_64-pc-windows-msvc |
| cargo_version | cargo 1.69.0 (6e9a83356 2023-04-12) |
| build_time | 2023-08-22 21:21:31 +00:00 |
| build_rust_channel | release |
| allocator | standard |
| features | default, sqlite, trash, which, zip |
| installed_plugins |
Additional context
This issue arises when writing grammar for tree-sitter in PR https://github.com/nushell/tree-sitter-nu/pull/28 . Parsing rules around handling pipelines and newlines become significantly harder if empty pipeline elements are involved
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the pipeline and newline parsing rules discussed in tree-sitter-nu PR #28, comparing empty elements in the middle, beginning, and end. Reproduce the three examples in Nushell 0.84.0 to confirm the current behavior; done means empty pipeline elements are rejected consistently while explicit syntax remains valid.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100