nushell/crates/nu-parser/src
Bahex 36c30ade3a
fix parsing of bare word string interpolations that start with a sub expression (#15735)
- fixes #15731

# Description
Existing bare word string interpolation only works if the string doesn't
start with a subxpression.
```nushell
echo fork(2)
# => fork2

echo (2)fork
# => Error: nu::parser::unclosed_delimiter
# => 
# =>   × Unclosed delimiter.
# =>    ╭─[entry #25:1:13]
# =>  1 │ echo (2)fork
# =>    ╰────
```
This PR lifts that restriction.
```nushell
echo fork(2)
# => fork2

echo (2)fork
# => 2fork
```

This was first brought to my attention on discord with the following
command failing to parse.
```nushell
docker run -u (id -u):(id -g)
```
It now works.

# User-Facing Changes

# Tests + Formatting
No existing test broke or required tweaking. Additional tests covering
this case was added.
- 🟢 toolkit fmt
- 🟢 toolkit clippy
- 🟢 toolkit test
- 🟢 toolkit test stdlib

# After Submitting

---------

Co-authored-by: Bahex <17417311+Bahex@users.noreply.github.com>
2025-05-13 22:25:07 +03:00
..
deparse.rs Fix quoting in to nuon and refactor quoting functions (#14180) 2024-10-29 07:43:26 -05:00
exportable.rs Restructure nu-protocol in more meaningful units (#11917) 2024-03-10 18:45:45 +01:00
flatten.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
known_external.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
lex.rs 14523 all comments should be prefixed with space tab or be beginning of token (#14616) 2024-12-25 21:31:51 +08:00
lib.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
lite_parser.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
parse_keywords.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
parse_patterns.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
parse_shape_specs.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00
parser.rs fix parsing of bare word string interpolations that start with a sub expression (#15735) 2025-05-13 22:25:07 +03:00
type_check.rs Rust 1.85, edition=2024 (#15741) 2025-05-13 16:49:30 +02:00