nushell/crates
Horasal b943cbedff
skip comments and eols while parsing pipeline (#10149)
This pr 
- fixes https://github.com/nushell/nushell/issues/10143
- fixes https://github.com/nushell/nushell/issues/5559

# Description

Current `lite_parse` does not handle multiple line comments and eols in
pipeline.
When parsing the following tokens:


| `"abcdefg"` | ` \|` | `# foobar` | ` \n` | `split chars` |
| ------------- | ------------- |------------- |-------------
|------------- |
| [Command] | [Pipe] | [Comment] | [Eol] | [Command] |
| | | Last Token |Current Token | |

`TokenContent::Eol` handler only checks if `last_token` is `Pipe` but it
will be broken if there exist any other thing, e.g. extra `[Comment]` in
this example.

This pr make the following change:

- While parsing `[Eol]`, try to find the last non-comment token as
`last_token`
- Comment is supposed as `[Comment]+` or `([Comment] [Eol])+`
- `[Eol]+` is still parsed just like current nu (i.e. generates
`nothing`).

Notice that this pr is just a quick patch if more comment/eol related
issue occures, `lite_parser` may need a rewrite.

# User-Facing Changes

Now the following pipeline works: 

```bash
1 | # comment
each { |it| $it + 2 } | # comment
math sum
```

Comment will not end the pipeline in interactive mode:

```bash
❯ 1 | # comment   (now enter multiple line mode instead of end)
▶▶ # foo
▶▶ 2
```

# Tests + Formatting

- 🟢 `toolkit fmt`
- 🟢 `toolkit clippy`
- 🟢 `toolkit test`
- 🟢 `toolkit test stdlib`

# After Submitting

None

---------

Co-authored-by: Horasal <horsal@horsal.dev>
2023-08-30 13:24:13 -05:00
..
nu_plugin_custom_values Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
nu_plugin_example Create Record type (#10103) 2023-08-25 07:50:29 +12:00
nu_plugin_formats Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
nu_plugin_gstat Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
nu_plugin_inc bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu_plugin_python remove vectorize_over_list from python plugin (#9905) 2023-08-03 16:46:48 +02:00
nu_plugin_query Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
nu-cli Move eval_hook to nu-cmd-base (#10146) 2023-08-29 23:46:50 +02:00
nu-cmd-base Move eval_hook to nu-cmd-base (#10146) 2023-08-29 23:46:50 +02:00
nu-cmd-dataframe Updating polars and sqlparser versions (#10114) 2023-08-30 00:13:34 +02:00
nu-cmd-extra Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
nu-cmd-lang Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
nu-color-config Create Record type (#10103) 2023-08-25 07:50:29 +12:00
nu-command Updating polars and sqlparser versions (#10114) 2023-08-30 00:13:34 +02:00
nu-engine Allow parse-time evaluation of calls, pipelines and subexpressions (#9499) 2023-08-26 16:41:29 +03:00
nu-explore add support for Vim motions in explore (#9966) 2023-08-26 07:48:37 -05:00
nu-glob bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-json bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-parser skip comments and eols while parsing pipeline (#10149) 2023-08-30 13:24:13 -05:00
nu-path Support Termux (#10013) 2023-08-28 09:53:25 +03:00
nu-plugin bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-pretty-hex bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-protocol Screen reader-friendly errors (#10122) 2023-08-27 06:54:15 -05:00
nu-std bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-system Use built-in is_terminal instead of is_terminal::is_terminal (#9550) 2023-08-25 10:54:44 +02:00
nu-table Spanned Value step 1: span all value cases (#10042) 2023-08-25 08:48:05 +12:00
nu-term-grid bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-test-support bump nushell to dev version 0.84.1 (#10101) 2023-08-23 15:23:27 -05:00
nu-utils Screen reader-friendly errors (#10122) 2023-08-27 06:54:15 -05: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.