nushell/crates
Wind 155934f783
make better messages for incomplete string (#12868)
# Description
Fixes: #12795

The issue is caused by an empty position of `ParseError::UnexpectedEof`.
So no detailed message is displayed.
To fix the issue, I adjust the start of span to `span.end - 1`. In this
way, we can make sure that it never points to an empty position.

After lexing item, I also reorder the unclosed character checking . Now
it will be checking unclosed opening delimiters first.

# User-Facing Changes
After this pr, it outputs detailed error message for incomplete string
when running scripts.

## Before
```
❯ nu -c "'ab"
Error: nu::parser::unexpected_eof

  × Unexpected end of code.
   ╭─[source:1:4]
 1 │ 'ab
   ╰────
> ./target/debug/nu -c "r#'ab"
Error: nu::parser::unexpected_eof

  × Unexpected end of code.
   ╭─[source:1:6]
 1 │ r#'ab
   ╰────
```
## After
```
> nu -c "'ab"
Error: nu::parser::unexpected_eof

  × Unexpected end of code.
   ╭─[source:1:3]
 1 │ 'ab
   ·   ┬
   ·   ╰── expected closing '
   ╰────
> ./target/debug/nu -c "r#'ab"
Error: nu::parser::unexpected_eof

  × Unexpected end of code.
   ╭─[source:1:5]
 1 │ r#'ab
   ·     ┬
   ·     ╰── expected closing '#
   ╰────
```


# Tests + Formatting
Added some tests for incomplete string.

---------

Co-authored-by: Ian Manske <ian.manske@pm.me>
2024-05-15 01:14:11 +00:00
..
nu_plugin_custom_values Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_example feat: add an echo command to nu_plugin_example (#12754) 2024-05-08 12:45:44 -07:00
nu_plugin_formats Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_gstat Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_inc Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_nu_example Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_polars Allow custom value operations to work on eager and lazy dataframes interchangeably. (#12819) 2024-05-13 18:17:31 -05:00
nu_plugin_python Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_query Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu_plugin_stress_internals Upgrade to interprocess 2.0.0 (#12729) 2024-05-02 22:31:33 -07:00
nu-cli Implement PWD recovery (#12779) 2024-05-10 11:06:33 -05:00
nu-cmd-base Implement PWD recovery (#12779) 2024-05-10 11:06:33 -05:00
nu-cmd-dataframe Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-cmd-extra ListStream touchup (#12524) 2024-05-05 16:00:59 +00:00
nu-cmd-lang Shrink Value by boxing Range/Closure (#12784) 2024-05-09 08:10:58 +08:00
nu-cmd-plugin Make the message when running a plugin exe directly clearer (#12806) 2024-05-07 20:12:32 -07:00
nu-color-config Shrink Value by boxing Range/Closure (#12784) 2024-05-09 08:10:58 +08:00
nu-command Fix char panic (#12867) 2024-05-14 21:10:06 +00:00
nu-engine Fix pipe redirection into complete (#12818) 2024-05-11 15:32:00 +00:00
nu-explore Fix panic when exploring empty dictionary (#12860) 2024-05-14 14:13:49 +00:00
nu-glob Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-json Minimize future false positive typos (#12751) 2024-05-04 15:00:44 +00:00
nu-lsp Refactor the CLI code a bit (#12782) 2024-05-10 07:29:27 +08:00
nu-parser make better messages for incomplete string (#12868) 2024-05-15 01:14:11 +00:00
nu-path Fix trailing slash in PWD set by cd (#12760) 2024-05-04 12:38:37 +03:00
nu-plugin Make the message when running a plugin exe directly clearer (#12806) 2024-05-07 20:12:32 -07:00
nu-plugin-core ListStream touchup (#12524) 2024-05-05 16:00:59 +00:00
nu-plugin-engine Shrink Value by boxing Range/Closure (#12784) 2024-05-09 08:10:58 +08:00
nu-plugin-protocol ListStream touchup (#12524) 2024-05-05 16:00:59 +00:00
nu-plugin-test-support ListStream touchup (#12524) 2024-05-05 16:00:59 +00:00
nu-pretty-hex Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-protocol Add Stack::stdout_file and Stack::stderr_file to capture stdout/-err of external commands (#12857) 2024-05-13 18:48:38 +00:00
nu-std Update PR template (#12838) 2024-05-13 08:45:44 -05:00
nu-system Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-table Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
nu-term-grid Bump version to 0.93.1 (#12710) 2024-05-01 17:19:20 -05:00
nu-test-support Avoid taking unnecessary ownership of intermediates (#12740) 2024-05-04 00:53:15 +00:00
nu-utils overhaul shell_integration to enable individual control over ansi escape sequences (#12629) 2024-05-02 09:56:50 -04:00
nuon Shrink Value by boxing Range/Closure (#12784) 2024-05-09 08:10:58 +08:00
README.md Remove old nushell/merge engine-q 2022-02-07 14:54:06 -05:00

Nushell core libraries and plugins

These sub-crates form both the foundation for Nu and a set of plugins which extend Nu with additional functionality.

Foundational libraries are split into two kinds of crates:

  • Core crates - those crates that work together to build the Nushell language engine
  • Support crates - a set of crates that support the engine with additional features like JSON support, ANSI support, and more.

Plugins are likewise also split into two types:

  • Core plugins - plugins that provide part of the default experience of Nu, including access to the system properties, processes, and web-connectivity features.
  • Extra plugins - these plugins run a wide range of different capabilities like working with different file types, charting, viewing binary data, and more.