Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing validation fails with bareword containing # in block #10327

Open
sholderbach opened this issue Sep 11, 2023 · 2 comments
Open

Parsing validation fails with bareword containing # in block #10327

sholderbach opened this issue Sep 11, 2023 · 2 comments
Labels
🐛 bug Something isn't working parser Issues related to parsing

Comments

@sholderbach
Copy link
Member

Describe the bug

On the REPL insert, and try to submit via enter.

1..10 | each {echo nixpkgs#unzip }

This will continue to insert a new line as if the block was not closed.

The basic behavior that a string containing a # is not interpreted as a comment (commonly found in the nix context) still works outside the block:

> echo nixpkgs#unzip
nixpkgs#unzip

The original problem was described in: (#6957, #6335, #8137)
The parsing/lexing change to make it possible came with #8151

How to reproduce

  1. In repl
  2. Insert
1..10 | each {echo nixpkgs#unzip }
  1. cursor at the end
  2. Press enter

Expected behavior

Should be a valid expression to submit

Screenshots

No response

Configuration

key value
version 0.84.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.72.0 (5680fa18f 2023-08-23)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.72.0 (103a7ff2e 2023-08-15)
build_time 2023-09-11 22:00:27 +02:00
build_rust_channel release
allocator standard
features default, sqlite, trash, which, zip
installed_plugins

Additional context

No response

@sholderbach sholderbach added parser Issues related to parsing needs-triage An issue that hasn't had any proper look 🐛 bug Something isn't working and removed needs-triage An issue that hasn't had any proper look labels Sep 11, 2023
@Eisfunke
Copy link

Can confirm. Also, still doesn't work if I try running via nu -c (so that the REPL not allowing me to submit the command doesn't play into it):

$> nu -c "nix run nixpkgs#hello"
Hello, world!

$> nu -c "echo (nix run nixpkgs#hello)"
Error: nu::parser::unexpected_eof

  × Unexpected end of code.
   ╭─[source:1:1]
 1 │ echo (nix run nixpkgs#hello)
   ╰────

(same with your example each {echo nixpkgs#unzip })

So it seems this is not just a problem with the REPL not allowing you to submit the command, the # just seems to still be parsed incorrectly if inside a block.

@amtoine
Copy link
Member

amtoine commented Dec 14, 2023

ooh i stumbled upon the same exact one when writing this, where i tried nix run nixpkgs#opam inside a do block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working parser Issues related to parsing
Projects
None yet
Development

No branches or pull requests

3 participants