nushell/crates/nu-parser/src
dj-sourbrough 48fca1c151
Fix: lex now throws error on unbalanced closing parentheses (issue #11982) (#12098)
- Fixes issue #11982 

# Description
Expressions with unbalanced parenthesis [excess closing ')' parenthesis]
will throw an error instead of interpreting ')' as a string.

Solved he same way as closing braces '}' are handled.

![Screenshot 2024-03-06 at 14 53
46](https://github.com/nushell/nushell/assets/56027726/86834e47-a1e5-484d-881d-0e3b80fecef8)

![Screenshot 2024-03-06 at 14 48
27](https://github.com/nushell/nushell/assets/56027726/bb27c969-6a3b-4735-8a1e-a5881d9096d3)

# User-Facing Changes
- Trailing closing parentheses ')' which do not match the number of
opening parentheses '(' will lead to a parse error.
- From what I have found in the documentation this is the intended
behavior, thus no documentation has been updated on my part

# Tests + Formatting
- Two tests added in src/tests/test_parser.rs
- All previous tests are still passing
- cargo fmt, clippy and test have been run

Unable to get the following command run
- `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` to run the tests for the standard library
![Screenshot 2024-03-06 at 20 06
25](https://github.com/nushell/nushell/assets/56027726/91724fb9-d7d0-472b-bf14-bfa2a7618d09)

---------

Co-authored-by: Noak Jönsson <noakj@kth.se>
2024-03-07 06:05:04 -06:00
..
deparse.rs update deps calamine and quick-xml (#11582) 2024-01-19 12:23:51 -06:00
flatten.rs Support redirect stderr and stdout+stderr with a pipe (#11708) 2024-02-09 01:30:46 +08:00
known_external.rs Allow spreading arguments to commands (#11289) 2023-12-28 15:43:20 +08:00
lex.rs Fix: lex now throws error on unbalanced closing parentheses (issue #11982) (#12098) 2024-03-07 06:05:04 -06:00
lib.rs Move SyntaxShape specifier parsing into own file (#10448) 2023-10-05 23:31:40 +02:00
lite_parser.rs Support redirect stderr and stdout+stderr with a pipe (#11708) 2024-02-09 01:30:46 +08:00
parse_keywords.rs Fix typos in comments (#12052) 2024-03-03 06:28:56 -06:00
parse_patterns.rs Remove Expr::MatchPattern (#11367) 2023-12-20 18:52:28 +01:00
parse_shape_specs.rs Move SyntaxShape specifier parsing into own file (#10448) 2023-10-05 23:31:40 +02:00
parser_path.rs Add virtual path abstraction layer (#9245) 2023-05-23 23:48:50 +03:00
parser.rs Glob: don't allow implicit casting between glob and string (#11992) 2024-02-28 23:05:35 +08:00
type_check.rs Glob: don't allow implicit casting between glob and string (#11992) 2024-02-28 23:05:35 +08:00