nushell/crates
Leonhard Kipp 3e6e3a207c
Feature/def signature with comments (#2905)
* Put parse_definition related funcs into own module

* Add failing lexer test

* Implement Parsing of definition signature

This commit applied changes how the signature of a function is parsed. Before
there was a little bit of "quick-and-dirty" string-matching/parsing involved.
Now, a signature is a little bit more properly parsed.
The grammar of a definition signature understood by these parsing-functions is
as follows:
 `[ (parameter | flag | <eol>)* ]`
where
parameter is:
    `name (<:> type)? (<,> | <eol> | (#Comment <eol>))?`
flag is:
    `--name (-shortform)? (<:> type)? (<,> | <eol> | (#Comment <eol>))?`
(Note: After the last item no <,> has to come.)
Note: It is now possible to pass comments to flags and parameters
Example:
[
  d:int          # The required d parameter
  --x (-x):string # The all powerful x flag
  --y (-y):int    # The accompanying y flag
]

(Sadly there seems to be a bug (Or is this expected behaviour?) in the lexer, because of which `--x(-x)` would
be treated as one baseline token and is therefore not correctly recognized as 2. For
now a space has to be inserted)

During the implementation of the module, 2 question arose:
Should flag/parameter names be allowed to be type names?
Example case:
```shell
def f [ string ] { echo $string }
```
Currently an error is thrown

* Fix clippy lints

* Remove wrong comment

* Add spacing

* Add Cargo.lock
2021-01-12 06:53:58 +13:00
..
nu_plugin_binaryview Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_chart Update dependency rust-embed now that issue with its use of syn has been fixed. (#2880) 2021-01-07 14:33:39 +13:00
nu_plugin_fetch updated dependencies (#2857) 2021-01-07 13:38:22 +13:00
nu_plugin_from_bson Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_from_sqlite Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_inc Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_match Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_post Rename the Path and Pattern primitives (#2889) 2021-01-08 20:30:41 +13:00
nu_plugin_ps Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_s3 Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_selector Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_start Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_sys Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_textview updated dependencies (#2857) 2021-01-07 13:38:22 +13:00
nu_plugin_to_bson Rename the Path and Pattern primitives (#2889) 2021-01-08 20:30:41 +13:00
nu_plugin_to_sqlite Rename the Path and Pattern primitives (#2889) 2021-01-08 20:30:41 +13:00
nu_plugin_tree Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu_plugin_xpath Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu-cli nu_cli refactor in preparation for a crate called nu_command (#2907) 2021-01-11 17:58:15 +13:00
nu-data Rename the Path and Pattern primitives (#2889) 2021-01-08 20:30:41 +13:00
nu-engine nu_cli refactor in preparation for a crate called nu_command (#2907) 2021-01-11 17:58:15 +13:00
nu-errors Document lexer (#2865) 2021-01-07 16:03:00 +13:00
nu-json updated dependencies (#2857) 2021-01-07 13:38:22 +13:00
nu-parser Feature/def signature with comments (#2905) 2021-01-12 06:53:58 +13:00
nu-plugin Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu-protocol Feature/def signature with comments (#2905) 2021-01-12 06:53:58 +13:00
nu-source Document lexer (#2865) 2021-01-07 16:03:00 +13:00
nu-stream Split nu-cli into nu-cli/nu-engine (#2898) 2021-01-10 15:50:49 +13:00
nu-table Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu-test-support Bump to 0.25.1 for the hotfix release (#2870) 2021-01-06 15:16:08 +13:00
nu-value-ext Rename the Path and Pattern primitives (#2889) 2021-01-08 20:30:41 +13:00