1
0
mirror of https://github.com/nushell/nushell.git synced 2025-04-23 12:48:22 +02:00

Merge branch 'master' into pixel_ascii

This commit is contained in:
Jonathan Turner 2019-07-16 17:23:17 +12:00
commit 7ffab5441b
25 changed files with 438 additions and 262 deletions

99
Cargo.lock generated
View File

@ -7,7 +7,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.37 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.37 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -41,6 +41,14 @@ dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "ansi_term"
version = "0.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "app_dirs" name = "app_dirs"
version = "1.2.1" version = "1.2.1"
@ -158,7 +166,7 @@ version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -313,7 +321,7 @@ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
@ -349,7 +357,7 @@ dependencies = [
"cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
@ -636,7 +644,7 @@ dependencies = [
[[package]] [[package]]
name = "derive-new" name = "derive-new"
version = "0.5.6" version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
@ -675,7 +683,7 @@ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.37 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.37 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -848,8 +856,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -1065,7 +1073,7 @@ dependencies = [
"bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"libgit2-sys 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1082,7 +1090,7 @@ dependencies = [
"futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"string 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "string 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1136,7 +1144,7 @@ dependencies = [
"httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1280,9 +1288,9 @@ name = "language-reporting"
version = "0.3.0" version = "0.3.0"
source = "git+https://github.com/jonathandturner/language-reporting#0a6c284a19a00b5b6b680480c0ad5f241fc5edac" source = "git+https://github.com/jonathandturner/language-reporting#0a6c284a19a00b5b6b680480c0ad5f241fc5edac"
dependencies = [ dependencies = [
"derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
"itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"render-tree 0.1.1 (git+https://github.com/jonathandturner/language-reporting)", "render-tree 0.1.1 (git+https://github.com/jonathandturner/language-reporting)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1402,7 +1410,7 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.6" version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1517,7 +1525,7 @@ dependencies = [
"iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1542,7 +1550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl 0.10.23 (registry+https://github.com/rust-lang/crates.io-index)", "openssl 0.10.23 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1559,7 +1567,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)", "wasm-bindgen 0.2.47 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1626,7 +1634,7 @@ name = "nu"
version = "0.1.2" version = "0.1.2"
dependencies = [ dependencies = [
"adhoc_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "adhoc_derive 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_term 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"byte-unit 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "byte-unit 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1637,7 +1645,7 @@ dependencies = [
"clipboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "clipboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"crossterm 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)", "crossterm 0.9.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
"derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
"derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"dirs 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"dunce 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "dunce 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1653,7 +1661,7 @@ dependencies = [
"itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"language-reporting 0.3.0 (git+https://github.com/jonathandturner/language-reporting)", "language-reporting 0.3.0 (git+https://github.com/jonathandturner/language-reporting)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"logos 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)", "logos 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)",
"logos-derive 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)", "logos-derive 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1668,12 +1676,13 @@ dependencies = [
"prettytable-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ptree 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "ptree 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rawkey 0.1.0 (git+https://github.com/jonathandturner/rawkey.git)", "rawkey 0.1.0 (git+https://github.com/jonathandturner/rawkey.git)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)",
"roxmltree 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "roxmltree 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rustyline 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustyline 5.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_bytes 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_ini 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde_ini 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1922,7 +1931,7 @@ name = "parse-zoneinfo"
version = "0.2.0" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2036,7 +2045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2104,7 +2113,7 @@ dependencies = [
"error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "error-chain 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2327,7 +2336,7 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.1.8" version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2359,7 +2368,7 @@ version = "0.1.1"
source = "git+https://github.com/jonathandturner/language-reporting#0a6c284a19a00b5b6b680480c0ad5f241fc5edac" source = "git+https://github.com/jonathandturner/language-reporting#0a6c284a19a00b5b6b680480c0ad5f241fc5edac"
dependencies = [ dependencies = [
"itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2378,7 +2387,7 @@ dependencies = [
"http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.12.30 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.30 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
"native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2441,7 +2450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"dirs 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2550,7 +2559,7 @@ dependencies = [
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2562,7 +2571,7 @@ dependencies = [
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.8.23 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -2575,6 +2584,14 @@ dependencies = [
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]]
name = "serde_bytes"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.94" version = "1.0.94"
@ -2937,7 +2954,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -2948,7 +2965,7 @@ dependencies = [
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2989,7 +3006,7 @@ dependencies = [
"crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
"slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3040,7 +3057,7 @@ dependencies = [
"failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"toml-query_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml-query_derive 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3201,7 +3218,7 @@ version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@ -3220,7 +3237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "bumpalo 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
"proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)",
"quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.37 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.37 (registry+https://github.com/rust-lang/crates.io-index)",
@ -3331,7 +3348,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -3363,6 +3380,7 @@ dependencies = [
"checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282" "checksum aho-corasick 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36b7aa1ccb7d7ea3f437cf025a2ab1c47cc6c1bc9fc84918ff449def12f5e282"
"checksum ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0f302a81afc6a7f4350c04f0ba7cfab529cc009bca3324b3fb5764e6add8b6" "checksum ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0f302a81afc6a7f4350c04f0ba7cfab529cc009bca3324b3fb5764e6add8b6"
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
"checksum ansi_term 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eaa72766c3585a1f812a3387a7e2c6cab780f899c2f43ff6ea06c8d071fcbb36"
"checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d" "checksum app_dirs 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e73a24bad9bd6a94d6395382a6c69fe071708ae4409f763c5475e14ee896313d"
"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392"
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
@ -3428,7 +3446,7 @@ dependencies = [
"checksum darling_macro 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "244e8987bd4e174385240cde20a3657f607fb0797563c28255c353b5819a07b1" "checksum darling_macro 0.8.6 (registry+https://github.com/rust-lang/crates.io-index)" = "244e8987bd4e174385240cde20a3657f607fb0797563c28255c353b5819a07b1"
"checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1" "checksum darling_macro 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c6d8dac1c6f1d29a41c4712b4400f878cb4fcc4c7628f298dd75038e024998d1"
"checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" "checksum deflate 0.7.20 (registry+https://github.com/rust-lang/crates.io-index)" = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4"
"checksum derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "6ca414e896ae072546f4d789f452daaecf60ddee4c9df5dc6d5936d769e3d87c" "checksum derive-new 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c3fd04571b29c91cfbe1e7c9a228e069ac8635f180ffb4ccd6a6907617ee8bb0"
"checksum derive_builder 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ac53fa6a3cda160df823a9346442525dcaf1e171999a1cf23e67067e4fd64d4" "checksum derive_builder 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3ac53fa6a3cda160df823a9346442525dcaf1e171999a1cf23e67067e4fd64d4"
"checksum derive_builder_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0288a23da9333c246bb18c143426074a6ae96747995c5819d2947b64cd942b37" "checksum derive_builder_core 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0288a23da9333c246bb18c143426074a6ae96747995c5819d2947b64cd942b37"
"checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe" "checksum derive_more 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a141330240c921ec6d074a3e188a7c7ef95668bb95e7d44fa0e5778ec2a7afe"
@ -3513,7 +3531,7 @@ dependencies = [
"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
"checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff" "checksum lock_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ed946d4529956a20f2d63ebe1b69996d5a2137c91913fe3ebbeff957f5bca7ff"
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum log 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c275b6ad54070ac2d665eef9197db647b32239c9d244bfb6f041a766d00da5b3"
"checksum logos 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)" = "e136962e0902a48fd1d8da8706fac078fdba547bf82f9d9d728cf551d367b41e" "checksum logos 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)" = "e136962e0902a48fd1d8da8706fac078fdba547bf82f9d9d728cf551d367b41e"
"checksum logos-derive 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f03ecd1d993aacc6c4f3a9540e60a4f3811ddac2276dbb66dad4d42671bd5bf" "checksum logos-derive 0.10.0-rc2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f03ecd1d993aacc6c4f3a9540e60a4f3811ddac2276dbb66dad4d42671bd5bf"
"checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" "checksum lzw 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084"
@ -3605,7 +3623,7 @@ dependencies = [
"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252"
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
"checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" "checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828"
"checksum regex 1.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "1325e8a57b7da4cbcb38b3957112f729990bad0a18420e7e250ef6b1d9a15763" "checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"
"checksum regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d76410686f9e3a17f06128962e0ecc5755870bb890c34820c7af7f1db2e1d48" "checksum regex-syntax 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "9d76410686f9e3a17f06128962e0ecc5755870bb890c34820c7af7f1db2e1d48"
"checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e" "checksum remove_dir_all 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4a83fa3702a688b9359eccba92d153ac33fd2e8462f9e0e3fdf155239ea7792e"
"checksum render-tree 0.1.1 (git+https://github.com/jonathandturner/language-reporting)" = "<none>" "checksum render-tree 0.1.1 (git+https://github.com/jonathandturner/language-reporting)" = "<none>"
@ -3634,6 +3652,7 @@ dependencies = [
"checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153" "checksum serde-hjson 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0b833c5ad67d52ced5f5938b2980f32a9c1c5ef047f0b4fb3127e7a423c76153"
"checksum serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4640cf3168e40c00c874ff1ad436c0f18c37edec101d5d897a4396f617abce29" "checksum serde-hjson 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4640cf3168e40c00c874ff1ad436c0f18c37edec101d5d897a4396f617abce29"
"checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f"
"checksum serde_bytes 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aaff47db6ef8771cca5d88febef2f22f47f645420e51226374049f68c6b08569"
"checksum serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "ef45eb79d6463b22f5f9e16d283798b7c0175ba6050bc25c1a946c122727fe7b" "checksum serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "ef45eb79d6463b22f5f9e16d283798b7c0175ba6050bc25c1a946c122727fe7b"
"checksum serde_derive_internals 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8a80c6c0b1ebbcea4ec2c7e9e2e9fa197a425d17f1afec8ba79fcd1352b18ffb" "checksum serde_derive_internals 0.24.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8a80c6c0b1ebbcea4ec2c7e9e2e9fa197a425d17f1afec8ba79fcd1352b18ffb"
"checksum serde_ini 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb236687e2bb073a7521c021949be944641e671b8505a94069ca37b656c81139" "checksum serde_ini 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eb236687e2bb073a7521c021949be944641e671b8505a94069ca37b656c81139"

View File

@ -14,10 +14,10 @@ rustyline = "5.0.0"
sysinfo = "0.9" sysinfo = "0.9"
chrono = { version = "0.4.7", features = ["serde"] } chrono = { version = "0.4.7", features = ["serde"] }
chrono-tz = "0.5.1" chrono-tz = "0.5.1"
derive-new = "0.5.6" derive-new = "0.5.7"
prettytable-rs = "0.8.0" prettytable-rs = "0.8.0"
itertools = "0.8.0" itertools = "0.8.0"
ansi_term = "0.11.0" ansi_term = "0.12.0"
nom = "5.0.0" nom = "5.0.0"
dunce = "1.0.0" dunce = "1.0.0"
indexmap = { version = "1.0.2", features = ["serde-1"] } indexmap = { version = "1.0.2", features = ["serde-1"] }
@ -30,13 +30,14 @@ futures-sink-preview = "=0.3.0-alpha.16"
futures_codec = "0.2.2" futures_codec = "0.2.2"
term = "0.5.2" term = "0.5.2"
bytes = "0.4.12" bytes = "0.4.12"
log = "0.4.6" log = "0.4.7"
pretty_env_logger = "0.3.0" pretty_env_logger = "0.3.0"
serde = "1.0.94" serde = "1.0.94"
serde_json = "1.0.40" serde_json = "1.0.40"
serde-hjson = "0.9.0" serde-hjson = "0.9.0"
serde_yaml = "0.8" serde_yaml = "0.8"
serde_derive = "1.0.94" serde_derive = "1.0.94"
serde_bytes = "0.11.1"
getset = "0.0.7" getset = "0.0.7"
logos = "0.10.0-rc2" logos = "0.10.0-rc2"
logos-derive = "0.10.0-rc2" logos-derive = "0.10.0-rc2"
@ -63,7 +64,7 @@ serde_ini = "0.2.0"
subprocess = "0.1.18" subprocess = "0.1.18"
sys-info = "0.5.7" sys-info = "0.5.7"
mime = "0.3.13" mime = "0.3.13"
regex = "1.1.8" regex = "1.1.9"
pretty-hex = "0.1.0" pretty-hex = "0.1.0"
neso = "0.5.0" neso = "0.5.0"
rawkey = { git = "https://github.com/jonathandturner/rawkey.git" } rawkey = { git = "https://github.com/jonathandturner/rawkey.git" }

View File

@ -25,24 +25,24 @@ In Unix, it's common to pipe between commands to split up a sophisticated comman
Commands are separated by the pipe symbol (`|`) to denote a pipeline flowing left to right. Commands are separated by the pipe symbol (`|`) to denote a pipeline flowing left to right.
``` ```
/home/jonathan/Source/nushell(master)> ls | where "file type" == "Directory" | autoview /home/jonathan/Source/nushell(master)> ls | where type == "Directory" | autoview
-----------+-----------+----------+--------+--------------+---------------- --------+-----------+----------+--------+--------------+----------------
file name | file type | readonly | size | accessed | modified name | type | readonly | size | accessed | modified
-----------+-----------+----------+--------+--------------+---------------- --------+-----------+----------+--------+--------------+----------------
target | Directory | | 4.1 KB | 19 hours ago | 19 hours ago target | Directory | | 4.1 KB | 19 hours ago | 19 hours ago
images | Directory | | 4.1 KB | 2 weeks ago | a week ago images | Directory | | 4.1 KB | 2 weeks ago | a week ago
tests | Directory | | 4.1 KB | 2 weeks ago | 18 minutes ago tests | Directory | | 4.1 KB | 2 weeks ago | 18 minutes ago
docs | Directory | | 4.1 KB | a week ago | a week ago docs | Directory | | 4.1 KB | a week ago | a week ago
.git | Directory | | 4.1 KB | 2 weeks ago | 25 minutes ago .git | Directory | | 4.1 KB | 2 weeks ago | 25 minutes ago
src | Directory | | 4.1 KB | 2 weeks ago | 25 minutes ago src | Directory | | 4.1 KB | 2 weeks ago | 25 minutes ago
.cargo | Directory | | 4.1 KB | 2 weeks ago | 2 weeks ago .cargo | Directory | | 4.1 KB | 2 weeks ago | 2 weeks ago
-----------+-----------+----------+--------+--------------+---------------- -----------+-----------+----------+--------+--------------+----------------
``` ```
Because most of the time you'll want to see the output of a pipeline, `autoview` is assumed. We could have also written the above: Because most of the time you'll want to see the output of a pipeline, `autoview` is assumed. We could have also written the above:
``` ```
/home/jonathan/Source/nushell(master)> ls | where "file type" == "Directory" /home/jonathan/Source/nushell(master)> ls | where type == Directory
``` ```
Being able to use the same commands and compose them differently is an important philosophy in Nu. For example, we could use the built-in `ps` command as well to get a list of the running processes, using the same `where` as above. Being able to use the same commands and compose them differently is an important philosophy in Nu. For example, we could use the built-in `ps` command as well to get a list of the running processes, using the same `where` as above.

View File

@ -179,6 +179,7 @@ pub async fn cli() -> Result<(), Box<dyn Error>> {
command("to-array", Box::new(to_array::to_array)), command("to-array", Box::new(to_array::to_array)),
command("to-json", Box::new(to_json::to_json)), command("to-json", Box::new(to_json::to_json)),
command("to-toml", Box::new(to_toml::to_toml)), command("to-toml", Box::new(to_toml::to_toml)),
command("to-yaml", Box::new(to_yaml::to_yaml)),
command("sort-by", Box::new(sort_by::sort_by)), command("sort-by", Box::new(sort_by::sort_by)),
command("sort-by", Box::new(sort_by::sort_by)), command("sort-by", Box::new(sort_by::sort_by)),
Arc::new(Open), Arc::new(Open),

View File

@ -35,6 +35,7 @@ crate mod table;
crate mod to_array; crate mod to_array;
crate mod to_json; crate mod to_json;
crate mod to_toml; crate mod to_toml;
crate mod to_yaml;
crate mod trim; crate mod trim;
crate mod view; crate mod view;
crate mod vtable; crate mod vtable;

View File

@ -3,7 +3,8 @@ use crate::prelude::*;
use crate::errors::ShellError; use crate::errors::ShellError;
use crate::object::config; use crate::object::config;
use crate::object::Value; use crate::object::Value;
use crate::parser::registry::{CommandConfig, NamedType, NamedValue}; use crate::parser::hir::SyntaxType;
use crate::parser::registry::{CommandConfig, NamedType};
use indexmap::IndexMap; use indexmap::IndexMap;
use log::trace; use log::trace;
use std::iter::FromIterator; use std::iter::FromIterator;
@ -20,14 +21,11 @@ impl Command for Config {
fn config(&self) -> CommandConfig { fn config(&self) -> CommandConfig {
let mut named: IndexMap<String, NamedType> = IndexMap::new(); let mut named: IndexMap<String, NamedType> = IndexMap::new();
named.insert("set".to_string(), NamedType::Optional(NamedValue::Single)); named.insert("set".to_string(), NamedType::Optional(SyntaxType::Any));
named.insert("get".to_string(), NamedType::Optional(NamedValue::Single)); named.insert("get".to_string(), NamedType::Optional(SyntaxType::Any));
named.insert("clear".to_string(), NamedType::Switch); named.insert("clear".to_string(), NamedType::Switch);
named.insert( named.insert("remove".to_string(), NamedType::Optional(SyntaxType::Any));
"remove".to_string(),
NamedType::Optional(NamedValue::Single),
);
CommandConfig { CommandConfig {
name: self.name().to_string(), name: self.name().to_string(),

View File

@ -1,3 +1,10 @@
#[doc(hidden)]
macro_rules! named_type {
($name:ident) => {
$crate::parser::registry::NamedType::$($name)*
}
}
#[macro_export] #[macro_export]
macro_rules! command { macro_rules! command {
( (
@ -11,7 +18,7 @@ macro_rules! command {
rest_positional: $rest_positional:tt, rest_positional: $rest_positional:tt,
named: { named: {
$( $(
($named_param:tt : $named_type:tt) ($named_param:tt : $named_type:ty : $named_kind:tt)
)* )*
} }
} }
@ -35,7 +42,7 @@ macro_rules! command {
Ok(output.boxed().to_output_stream()) Ok(output.boxed().to_output_stream())
} }
let tuple = ( $($extract),*, ); let tuple = ( $($extract ,)* );
command( $args, tuple ) command( $args, tuple )
} }
@ -58,7 +65,7 @@ macro_rules! command {
let mut named: indexmap::IndexMap<String, NamedType> = indexmap::IndexMap::new(); let mut named: indexmap::IndexMap<String, NamedType> = indexmap::IndexMap::new();
$( $(
named.insert(stringify!($named_param).to_string(), NamedType::$named_type); named.insert(stringify!($named_param).to_string(), $crate::parser::registry::NamedType::$named_kind);
)* )*
named named
@ -72,7 +79,7 @@ macro_rules! command {
( (
Named { $export:tt $args:ident $body:block } Named { $export:tt $args:ident $body:block }
Positional { $($positional_count:tt)* } Positional { $($positional_count:tt)* }
Rest { , -- $param_name:ident : Switch $($rest:tt)* } Rest { -- $param_name:ident : Switch , $($rest:tt)* }
CommandConfig { CommandConfig {
name: $config_name:tt, name: $config_name:tt,
mandatory_positional: vec![ $($mandatory_positional:tt)* ], mandatory_positional: vec![ $($mandatory_positional:tt)* ],
@ -100,7 +107,7 @@ macro_rules! command {
rest_positional: $rest_positional, rest_positional: $rest_positional,
named: { named: {
$($config_named)* $($config_named)*
($param_name : Switch) ($param_name : Switch : Switch)
} }
} }
@ -109,11 +116,11 @@ macro_rules! command {
} }
Extract { Extract {
($($extract)* { $($extract)* {
use std::convert::TryInto; use std::convert::TryInto;
$args.get(stringify!($param_name)).clone().try_into()? $args.get(stringify!($param_name)).clone().try_into()?
}) }
} }
); );
}; };
@ -122,7 +129,7 @@ macro_rules! command {
( (
Named { $export:tt $args:ident $body:block } Named { $export:tt $args:ident $body:block }
Positional { $($positional_count:tt)* } Positional { $($positional_count:tt)* }
Rest { , -- $param_name:ident : $param_kind:tt $($rest:tt)* } Rest { -- $param_name:ident : $param_kind:ty , $($rest:tt)* }
CommandConfig { CommandConfig {
name: $config_name:tt, name: $config_name:tt,
mandatory_positional: vec![ $($mandatory_positional:tt)* ], mandatory_positional: vec![ $($mandatory_positional:tt)* ],
@ -159,11 +166,11 @@ macro_rules! command {
} }
Extract { Extract {
($($extract)* { $($extract)* {
use std::convert::TryInto; use std::convert::TryInto;
$args.get(stringify!($param_name)).clone().try_into()? $args.get(stringify!($param_name)).clone().try_into()?
}) }
} }
); );
}; };
@ -172,7 +179,7 @@ macro_rules! command {
( (
Named { $export:tt $args:ident $body:block } Named { $export:tt $args:ident $body:block }
Positional { $($positional_count:tt)* } Positional { $($positional_count:tt)* }
Rest { , -- $param_name:ident ? : $param_kind:tt $($rest:tt)* } Rest { -- $param_name:ident ? : $param_kind:ty , $($rest:tt)* }
CommandConfig { CommandConfig {
name: $config_name:tt, name: $config_name:tt,
mandatory_positional: vec![ $($mandatory_positional:tt)* ], mandatory_positional: vec![ $($mandatory_positional:tt)* ],
@ -209,11 +216,11 @@ macro_rules! command {
} }
Extract { Extract {
($($extract)* { $($extract)* {
use std::convert::TryInto; use std::convert::TryInto;
$args.get(stringify!($param_name)).clone().try_into()? $args.get(stringify!($param_name)).clone().try_into()?
}) }
} }
); );
}; };
@ -222,7 +229,7 @@ macro_rules! command {
( (
Named { $export:ident $args:ident $body:block } Named { $export:ident $args:ident $body:block }
Positional { $($positional_count:tt)* } Positional { $($positional_count:tt)* }
Rest { , $param_name:ident : Block $($rest:tt)* } Rest { $param_name:ident : Block , $($rest:tt)* }
CommandConfig { CommandConfig {
name: $config_name:tt, name: $config_name:tt,
mandatory_positional: vec![ $($mandatory_positional:tt)* ], mandatory_positional: vec![ $($mandatory_positional:tt)* ],
@ -277,7 +284,7 @@ macro_rules! command {
( (
Named { $export:ident $args:ident $body:block } Named { $export:ident $args:ident $body:block }
Positional { $($positional_count:tt)* } Positional { $($positional_count:tt)* }
Rest { , $param_name:ident : $param_kind:tt $($rest:tt)* } Rest { $param_name:ident : $param_kind:ty , $($rest:tt)* }
CommandConfig { CommandConfig {
name: $config_name:tt, name: $config_name:tt,
mandatory_positional: vec![ $($mandatory_positional:tt)* ], mandatory_positional: vec![ $($mandatory_positional:tt)* ],
@ -304,7 +311,7 @@ macro_rules! command {
CommandConfig { CommandConfig {
name: $config_name, name: $config_name,
mandatory_positional: vec![ $($mandatory_positional)* $crate::parser::registry::PositionalType::mandatory( mandatory_positional: vec![ $($mandatory_positional)* $crate::parser::registry::PositionalType::mandatory(
stringify!($param_name) stringify!($param_name), <$param_kind>::syntax_type()
), ], ), ],
optional_positional: vec![ $($optional_positional)* ], optional_positional: vec![ $($optional_positional)* ],
rest_positional: $rest_positional, rest_positional: $rest_positional,
@ -321,14 +328,13 @@ macro_rules! command {
$($extract:tt)* { $($extract:tt)* {
use $crate::object::types::ExtractType; use $crate::object::types::ExtractType;
let value = $args.expect_nth($($positional_count)*)?; let value = $args.expect_nth($($positional_count)*)?;
// let value = $param_kind.check(value)?; <$param_kind>::extract(&value)?
$param_kind::extract(value)?
} }
} }
); );
}; };
($export:ident as $config_name:tt ( $args:ident $($command_rest:tt)* ) $body:block) => { ($export:ident as $config_name:tt ( $args:ident , $($command_rest:tt)* ) $body:block) => {
command!( command!(
Named { $export $args $body } Named { $export $args $body }
Positional { 0 } Positional { 0 }

View File

@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
use std::str::FromStr; use std::str::FromStr;
command! { command! {
Open as open(args, --raw: Switch) { Open as open(args, path: Spanned<PathBuf>, --raw: Switch,) {
let span = args.name_span; let span = args.name_span;
let cwd = args let cwd = args
@ -21,16 +21,19 @@ command! {
let full_path = PathBuf::from(cwd); let full_path = PathBuf::from(cwd);
let (file_extension, contents, contents_span) = match &args.expect_nth(0)?.item { let path_str = path.to_str().ok_or(ShellError::type_error("Path", "invalid path".spanned(path.span)))?;
Value::Primitive(Primitive::String(s)) => fetch(&full_path, s, args.expect_nth(0)?.span)?,
_ => { let (file_extension, contents, contents_span) = fetch(&full_path, path_str, path.span)?;
return Err(ShellError::labeled_error( // let (file_extension, contents, contents_span) = match &args.expect_nth(0)?.item {
"Expected string value for filename", // Value::Primitive(Primitive::String(s)) => fetch(&full_path, s, args.expect_nth(0)?.span)?,
"expected filename", // _ => {
args.expect_nth(0)?.span, // return Err(ShellError::labeled_error(
)); // "Expected string value for filename",
} // "expected filename",
}; // args.expect_nth(0)?.span,
// ));
// }
// };
let mut stream = VecDeque::new(); let mut stream = VecDeque::new();

View File

@ -1,4 +1,7 @@
use crate::commands::command::SinkCommandArgs; use crate::commands::command::SinkCommandArgs;
use crate::commands::to_json::value_to_json_value;
use crate::commands::to_toml::value_to_toml_value;
use crate::commands::to_yaml::value_to_yaml_value;
use crate::errors::ShellError; use crate::errors::ShellError;
use crate::object::{Primitive, Value}; use crate::object::{Primitive, Value};
use crate::parser::Spanned; use crate::parser::Spanned;
@ -48,15 +51,7 @@ pub fn save(args: SinkCommandArgs) -> Result<(), ShellError> {
"saving to toml requires a single object (or use --raw)", "saving to toml requires a single object (or use --raw)",
)); ));
} }
toml::to_string(&args.input[0]).unwrap() toml::to_string(&value_to_toml_value(&args.input[0])).unwrap()
}
Some(x) if x == "ini" && !save_raw => {
if args.input.len() != 1 {
return Err(ShellError::string(
"saving to ini requires a single object (or use --raw)",
));
}
serde_ini::to_string(&args.input[0]).unwrap()
} }
Some(x) if x == "json" && !save_raw => { Some(x) if x == "json" && !save_raw => {
if args.input.len() != 1 { if args.input.len() != 1 {
@ -64,7 +59,7 @@ pub fn save(args: SinkCommandArgs) -> Result<(), ShellError> {
"saving to json requires a single object (or use --raw)", "saving to json requires a single object (or use --raw)",
)); ));
} }
serde_json::to_string(&args.input[0]).unwrap() serde_json::to_string(&value_to_json_value(&args.input[0])).unwrap()
} }
Some(x) if x == "yml" && !save_raw => { Some(x) if x == "yml" && !save_raw => {
if args.input.len() != 1 { if args.input.len() != 1 {
@ -72,7 +67,7 @@ pub fn save(args: SinkCommandArgs) -> Result<(), ShellError> {
"saving to yml requires a single object (or use --raw)", "saving to yml requires a single object (or use --raw)",
)); ));
} }
serde_yaml::to_string(&args.input[0]).unwrap() serde_yaml::to_string(&value_to_yaml_value(&args.input[0])).unwrap()
} }
Some(x) if x == "yaml" && !save_raw => { Some(x) if x == "yaml" && !save_raw => {
if args.input.len() != 1 { if args.input.len() != 1 {
@ -80,7 +75,7 @@ pub fn save(args: SinkCommandArgs) -> Result<(), ShellError> {
"saving to yaml requires a single object (or use --raw)", "saving to yaml requires a single object (or use --raw)",
)); ));
} }
serde_yaml::to_string(&args.input[0]).unwrap() serde_yaml::to_string(&value_to_yaml_value(&args.input[0])).unwrap()
} }
_ => { _ => {
let mut save_data = String::new(); let mut save_data = String::new();

View File

@ -17,6 +17,7 @@ pub fn value_to_json_value(v: &Value) -> serde_json::Value {
} }
Value::Primitive(Primitive::Nothing) => serde_json::Value::Null, Value::Primitive(Primitive::Nothing) => serde_json::Value::Null,
Value::Primitive(Primitive::String(s)) => serde_json::Value::String(s.clone()), Value::Primitive(Primitive::String(s)) => serde_json::Value::String(s.clone()),
Value::Primitive(Primitive::Path(s)) => serde_json::Value::String(s.display().to_string()),
Value::Filesystem => serde_json::Value::Null, Value::Filesystem => serde_json::Value::Null,
Value::List(l) => { Value::List(l) => {

View File

@ -13,6 +13,7 @@ pub fn value_to_toml_value(v: &Value) -> toml::Value {
Value::Primitive(Primitive::Int(i)) => toml::Value::Integer(*i), Value::Primitive(Primitive::Int(i)) => toml::Value::Integer(*i),
Value::Primitive(Primitive::Nothing) => toml::Value::String("<Nothing>".to_string()), Value::Primitive(Primitive::Nothing) => toml::Value::String("<Nothing>".to_string()),
Value::Primitive(Primitive::String(s)) => toml::Value::String(s.clone()), Value::Primitive(Primitive::String(s)) => toml::Value::String(s.clone()),
Value::Primitive(Primitive::Path(s)) => toml::Value::String(s.display().to_string()),
Value::Filesystem => toml::Value::String("<Filesystem>".to_string()), Value::Filesystem => toml::Value::String("<Filesystem>".to_string()),
Value::List(l) => toml::Value::Array(l.iter().map(|x| value_to_toml_value(x)).collect()), Value::List(l) => toml::Value::Array(l.iter().map(|x| value_to_toml_value(x)).collect()),

60
src/commands/to_yaml.rs Normal file
View File

@ -0,0 +1,60 @@
use crate::object::{Primitive, Value};
use crate::prelude::*;
pub fn value_to_yaml_value(v: &Value) -> serde_yaml::Value {
match v {
Value::Primitive(Primitive::Boolean(b)) => serde_yaml::Value::Bool(*b),
Value::Primitive(Primitive::Bytes(b)) => {
serde_yaml::Value::Number(serde_yaml::Number::from(*b as u64))
}
Value::Primitive(Primitive::Date(d)) => serde_yaml::Value::String(d.to_string()),
Value::Primitive(Primitive::EndOfStream) => serde_yaml::Value::Null,
Value::Primitive(Primitive::Float(f)) => {
serde_yaml::Value::Number(serde_yaml::Number::from(f.into_inner()))
}
Value::Primitive(Primitive::Int(i)) => {
serde_yaml::Value::Number(serde_yaml::Number::from(*i))
}
Value::Primitive(Primitive::Nothing) => serde_yaml::Value::Null,
Value::Primitive(Primitive::String(s)) => serde_yaml::Value::String(s.clone()),
Value::Primitive(Primitive::Path(s)) => serde_yaml::Value::String(s.display().to_string()),
Value::Filesystem => serde_yaml::Value::Null,
Value::List(l) => {
serde_yaml::Value::Sequence(l.iter().map(|x| value_to_yaml_value(x)).collect())
}
Value::Block(_) => serde_yaml::Value::Null,
Value::Binary(b) => serde_yaml::Value::Sequence(
b.iter()
.map(|x| serde_yaml::Value::Number(serde_yaml::Number::from(*x)))
.collect(),
),
Value::Object(o) => {
let mut m = serde_yaml::Mapping::new();
for (k, v) in o.entries.iter() {
m.insert(serde_yaml::Value::String(k.clone()), value_to_yaml_value(v));
}
serde_yaml::Value::Mapping(m)
}
}
}
pub fn to_yaml(args: CommandArgs) -> Result<OutputStream, ShellError> {
let out = args.input;
let name_span = args.name_span;
Ok(out
.values
.map(
move |a| match serde_yaml::to_string(&value_to_yaml_value(&a)) {
Ok(x) => {
ReturnSuccess::value(Value::Primitive(Primitive::String(x)).spanned(name_span))
}
Err(_) => Err(ShellError::maybe_labeled_error(
"Can not convert to YAML string",
"can not convert piped data to YAML string",
name_span,
)),
},
)
.to_output_stream())
}

View File

@ -5,7 +5,7 @@ use futures::future::ready;
use log::trace; use log::trace;
command! { command! {
Where as where(args, condition: Block) { Where as where(args, condition: Block,) {
let input: InputStream = trace_stream!(target: "nu::trace_stream::where", "where input" = args.input); let input: InputStream = trace_stream!(target: "nu::trace_stream::where", "where input" = args.input);
input.values.filter_map(move |item| { input.values.filter_map(move |item| {

View File

@ -11,6 +11,7 @@ use derive_new::new;
use ordered_float::OrderedFloat; use ordered_float::OrderedFloat;
use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer}; use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer};
use std::fmt; use std::fmt;
use std::path::PathBuf;
use std::time::SystemTime; use std::time::SystemTime;
#[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, new, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, Ord, PartialOrd, Eq, PartialEq, new, Serialize, Deserialize)]
@ -40,6 +41,7 @@ pub enum Primitive {
String(String), String(String),
Boolean(bool), Boolean(bool),
Date(DateTime<Utc>), Date(DateTime<Utc>),
Path(PathBuf),
EndOfStream, EndOfStream,
} }
@ -51,6 +53,7 @@ impl Primitive {
match self { match self {
Nothing => "nothing", Nothing => "nothing",
EndOfStream => "end-of-stream", EndOfStream => "end-of-stream",
Path(_) => "path",
Int(_) => "int", Int(_) => "int",
Float(_) => "float", Float(_) => "float",
Bytes(_) => "bytes", Bytes(_) => "bytes",
@ -68,6 +71,7 @@ impl Primitive {
Nothing => write!(f, "Nothing"), Nothing => write!(f, "Nothing"),
EndOfStream => write!(f, "EndOfStream"), EndOfStream => write!(f, "EndOfStream"),
Int(int) => write!(f, "{}", int), Int(int) => write!(f, "{}", int),
Path(path) => write!(f, "{}", path.display()),
Float(float) => write!(f, "{:?}", float), Float(float) => write!(f, "{:?}", float),
Bytes(bytes) => write!(f, "{}", bytes), Bytes(bytes) => write!(f, "{}", bytes),
String(string) => write!(f, "{:?}", string), String(string) => write!(f, "{:?}", string),
@ -80,6 +84,7 @@ impl Primitive {
match self { match self {
Primitive::Nothing => format!("{}", Color::Black.bold().paint("-")), Primitive::Nothing => format!("{}", Color::Black.bold().paint("-")),
Primitive::EndOfStream => format!("{}", Color::Black.bold().paint("-")), Primitive::EndOfStream => format!("{}", Color::Black.bold().paint("-")),
Primitive::Path(p) => format!("{}", p.display()),
Primitive::Bytes(b) => { Primitive::Bytes(b) => {
let byte = byte_unit::Byte::from_bytes(*b as u128); let byte = byte_unit::Byte::from_bytes(*b as u128);
@ -175,6 +180,7 @@ impl Block {
pub enum Value { pub enum Value {
Primitive(Primitive), Primitive(Primitive),
Object(crate::object::Dictionary), Object(crate::object::Dictionary),
#[serde(with = "serde_bytes")]
Binary(Vec<u8>), Binary(Vec<u8>),
List(Vec<Spanned<Value>>), List(Vec<Spanned<Value>>),
#[allow(unused)] #[allow(unused)]

View File

@ -3,19 +3,34 @@ use crate::parser::hir;
use crate::prelude::*; use crate::prelude::*;
use derive_new::new; use derive_new::new;
use serde_derive::Deserialize; use serde_derive::Deserialize;
use std::path::PathBuf;
pub trait Type: std::fmt::Debug + Send { pub trait Type: std::fmt::Debug + Send {
type Extractor: ExtractType; type Extractor: ExtractType;
fn name(&self) -> &'static str; fn name(&self) -> &'static str;
fn coerce(&self) -> Option<hir::ExpressionKindHint> {
None
}
} }
pub trait ExtractType: Sized { pub trait ExtractType: Sized {
fn extract(value: &Spanned<Value>) -> Result<Self, ShellError>; fn extract(value: &Spanned<Value>) -> Result<Self, ShellError>;
fn check(value: &'value Spanned<Value>) -> Result<&'value Spanned<Value>, ShellError>; fn check(value: &'value Spanned<Value>) -> Result<&'value Spanned<Value>, ShellError>;
fn syntax_type() -> hir::SyntaxType {
hir::SyntaxType::Any
}
}
impl<T: ExtractType> ExtractType for Spanned<T> {
fn extract(value: &Spanned<Value>) -> Result<Spanned<T>, ShellError> {
Ok(T::extract(value)?.spanned(value.span))
}
fn check(value: &'value Spanned<Value>) -> Result<&'value Spanned<Value>, ShellError> {
T::check(value)
}
fn syntax_type() -> hir::SyntaxType {
T::syntax_type()
}
} }
#[derive(Debug, Deserialize, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, new)] #[derive(Debug, Deserialize, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, new)]
@ -39,6 +54,35 @@ impl ExtractType for Spanned<Value> {
} }
} }
#[derive(Debug)]
pub struct FilePath;
impl ExtractType for std::path::PathBuf {
fn syntax_type() -> hir::SyntaxType {
hir::SyntaxType::Path
}
fn extract(value: &'a Spanned<Value>) -> Result<std::path::PathBuf, ShellError> {
match &value {
Spanned {
item: Value::Primitive(Primitive::String(p)),
span,
} => Ok(PathBuf::from(p)),
other => Err(ShellError::type_error("Path", other.spanned_type_name())),
}
}
fn check(value: &'value Spanned<Value>) -> Result<&'value Spanned<Value>, ShellError> {
match &value {
v @ Spanned {
item: Value::Primitive(Primitive::Path(_)),
..
} => Ok(v),
other => Err(ShellError::type_error("Path", other.spanned_type_name())),
}
}
}
#[derive(Debug, Deserialize, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, new)] #[derive(Debug, Deserialize, Clone, Eq, PartialEq, Hash, Ord, PartialOrd, new)]
pub struct Integer; pub struct Integer;

View File

@ -8,8 +8,8 @@ use crate::parser::{Span, Spanned, Unit};
use derive_new::new; use derive_new::new;
use getset::Getters; use getset::Getters;
crate use baseline_parse::baseline_parse_single_token; crate use baseline_parse::{baseline_parse_single_token, baseline_parse_token_as_string};
crate use baseline_parse_tokens::{baseline_parse_next_expr, ExpressionKindHint, TokensIterator}; crate use baseline_parse_tokens::{baseline_parse_next_expr, SyntaxType, TokensIterator};
crate use binary::Binary; crate use binary::Binary;
crate use named::NamedArguments; crate use named::NamedArguments;
crate use path::Path; crate use path::Path;

View File

@ -13,3 +13,16 @@ pub fn baseline_parse_single_token(token: &Token, source: &Text) -> hir::Express
RawToken::Bare => hir::Expression::bare(token.span), RawToken::Bare => hir::Expression::bare(token.span),
} }
} }
pub fn baseline_parse_token_as_string(token: &Token, source: &Text) -> hir::Expression {
match *token.item() {
RawToken::Variable(span) if span.slice(source) == "it" => {
hir::Expression::it_variable(span, token.span)
}
RawToken::Variable(span) => hir::Expression::variable(span, token.span),
RawToken::Integer(_) => hir::Expression::bare(token.span),
RawToken::Size(int, unit) => hir::Expression::bare(token.span),
RawToken::Bare => hir::Expression::bare(token.span),
RawToken::String(span) => hir::Expression::string(span, token.span),
}
}

View File

@ -1,11 +1,14 @@
use crate::errors::ShellError; use crate::errors::ShellError;
use crate::parser::registry::CommandRegistry; use crate::parser::registry::CommandRegistry;
use crate::parser::{ use crate::parser::{
hir, hir::baseline_parse_single_token, DelimitedNode, Delimiter, PathNode, RawToken, Span, hir,
Spanned, TokenNode, hir::{baseline_parse_single_token, baseline_parse_token_as_string},
DelimitedNode, Delimiter, PathNode, RawToken, Span, Spanned, TokenNode,
}; };
use crate::{SpannedItem, Text}; use crate::{SpannedItem, Text};
use derive_new::new; use derive_new::new;
use log::trace;
use serde_derive::{Deserialize, Serialize};
pub fn baseline_parse_tokens( pub fn baseline_parse_tokens(
token_nodes: &mut TokensIterator<'_>, token_nodes: &mut TokensIterator<'_>,
@ -19,7 +22,7 @@ pub fn baseline_parse_tokens(
break; break;
} }
let expr = baseline_parse_next_expr(token_nodes, registry, source, None)?; let expr = baseline_parse_next_expr(token_nodes, registry, source, SyntaxType::Any)?;
exprs.push(expr); exprs.push(expr);
} }
@ -27,10 +30,12 @@ pub fn baseline_parse_tokens(
} }
#[allow(unused)] #[allow(unused)]
#[derive(Debug)] #[derive(Debug, Copy, Clone, Serialize, Deserialize)]
pub enum ExpressionKindHint { pub enum SyntaxType {
Any,
Literal, Literal,
Variable, Variable,
Path,
Binary, Binary,
Block, Block,
Boolean, Boolean,
@ -40,13 +45,31 @@ pub fn baseline_parse_next_expr(
tokens: &mut TokensIterator, tokens: &mut TokensIterator,
registry: &dyn CommandRegistry, registry: &dyn CommandRegistry,
source: &Text, source: &Text,
coerce_hint: Option<ExpressionKindHint>, syntax_type: SyntaxType,
) -> Result<hir::Expression, ShellError> { ) -> Result<hir::Expression, ShellError> {
let first = match tokens.next() { let next = tokens
None => return Err(ShellError::string("Expected token, found none")), .next()
Some(token) => baseline_parse_semantic_token(token, registry, source)?, .ok_or_else(|| ShellError::string("Expected token, found none"))?;
trace!(target: "nu::parser::parse_one_expr", "syntax_type={:?}, token={:?}", syntax_type, next);
match (syntax_type, next) {
(SyntaxType::Path, TokenNode::Token(token)) => {
return Ok(baseline_parse_token_as_string(token, source))
}
(SyntaxType::Path, token) => {
return Err(ShellError::type_error(
"Path",
token.type_name().spanned(token.span()),
))
}
_ => {}
}; };
let first = baseline_parse_semantic_token(next, registry, source)?;
let possible_op = tokens.peek(); let possible_op = tokens.peek();
let op = match possible_op { let op = match possible_op {
@ -69,8 +92,8 @@ pub fn baseline_parse_next_expr(
// We definitely have a binary expression here -- let's see if we should coerce it into a block // We definitely have a binary expression here -- let's see if we should coerce it into a block
match coerce_hint { match syntax_type {
None => { SyntaxType::Any => {
let span = (first.span.start, second.span.end); let span = (first.span.start, second.span.end);
let binary = hir::Binary::new(first, op, second); let binary = hir::Binary::new(first, op, second);
let binary = hir::RawExpression::Binary(Box::new(binary)); let binary = hir::RawExpression::Binary(Box::new(binary));
@ -79,74 +102,75 @@ pub fn baseline_parse_next_expr(
Ok(binary) Ok(binary)
} }
Some(hint) => match hint { SyntaxType::Block => {
ExpressionKindHint::Block => { let span = (first.span.start, second.span.end);
let span = (first.span.start, second.span.end);
let path: Spanned<hir::RawExpression> = match first { let path: Spanned<hir::RawExpression> = match first {
Spanned {
item: hir::RawExpression::Literal(hir::Literal::Bare),
span,
} => {
let string = Spanned::from_item(span.slice(source).to_string(), span);
let path = hir::Path::new(
Spanned::from_item(
// TODO: Deal with synthetic nodes that have no representation at all in source
hir::RawExpression::Variable(hir::Variable::It(Span::from((0, 0)))),
(0, 0),
),
vec![string],
);
let path = hir::RawExpression::Path(Box::new(path));
Spanned { Spanned {
item: hir::RawExpression::Literal(hir::Literal::Bare), item: path,
span: first.span,
}
}
Spanned {
item: hir::RawExpression::Literal(hir::Literal::String(inner)),
span,
} => {
let string = Spanned::from_item(inner.slice(source).to_string(), span);
let path = hir::Path::new(
Spanned::from_item(
// TODO: Deal with synthetic nodes that have no representation at all in source
hir::RawExpression::Variable(hir::Variable::It(Span::from((0, 0)))),
(0, 0),
),
vec![string],
);
let path = hir::RawExpression::Path(Box::new(path));
Spanned {
item: path,
span: first.span,
}
}
Spanned {
item: hir::RawExpression::Variable(..),
..
} => first,
Spanned { span, item } => {
return Err(ShellError::labeled_error(
"The first part of an un-braced block must be a column name",
item.type_name(),
span, span,
} => { ))
let string = Spanned::from_item(span.slice(source).to_string(), span); }
let path = hir::Path::new( };
Spanned::from_item(
// TODO: Deal with synthetic nodes that have no representation at all in source
hir::RawExpression::Variable(hir::Variable::It(Span::from((0, 0)))),
(0, 0),
),
vec![string],
);
let path = hir::RawExpression::Path(Box::new(path));
Spanned {
item: path,
span: first.span,
}
}
Spanned {
item: hir::RawExpression::Literal(hir::Literal::String(inner)),
span,
} => {
let string = Spanned::from_item(inner.slice(source).to_string(), span);
let path = hir::Path::new(
Spanned::from_item(
// TODO: Deal with synthetic nodes that have no representation at all in source
hir::RawExpression::Variable(hir::Variable::It(Span::from((0, 0)))),
(0, 0),
),
vec![string],
);
let path = hir::RawExpression::Path(Box::new(path));
Spanned {
item: path,
span: first.span,
}
}
Spanned {
item: hir::RawExpression::Variable(..),
..
} => first,
Spanned { span, item } => {
return Err(ShellError::labeled_error(
"The first part of an un-braced block must be a column name",
item.type_name(),
span,
))
}
};
let binary = hir::Binary::new(path, op, second); let binary = hir::Binary::new(path, op, second);
let binary = hir::RawExpression::Binary(Box::new(binary)); let binary = hir::RawExpression::Binary(Box::new(binary));
let binary = Spanned::from_item(binary, span); let binary = Spanned::from_item(binary, span);
let block = hir::RawExpression::Block(vec![binary]); let block = hir::RawExpression::Block(vec![binary]);
let block = Spanned::from_item(block, span); let block = Spanned::from_item(block, span);
Ok(block) Ok(block)
} }
other => unimplemented!("coerce hint {:?}", other), other => Err(ShellError::unimplemented(format!(
}, "coerce hint {:?}",
other
))),
} }
} }
@ -161,8 +185,10 @@ pub fn baseline_parse_semantic_token(
TokenNode::Delimited(delimited) => baseline_parse_delimited(delimited, registry, source), TokenNode::Delimited(delimited) => baseline_parse_delimited(delimited, registry, source),
TokenNode::Pipeline(_pipeline) => unimplemented!(), TokenNode::Pipeline(_pipeline) => unimplemented!(),
TokenNode::Operator(_op) => unreachable!(), TokenNode::Operator(_op) => unreachable!(),
TokenNode::Flag(_flag) => Err(ShellError::unimplemented("passing flags is not supported yet.")), TokenNode::Flag(_flag) => Err(ShellError::unimplemented(
TokenNode::Identifier(_span) => unreachable!(), "passing flags is not supported yet.",
)),
TokenNode::Member(_span) => unreachable!(),
TokenNode::Whitespace(_span) => unreachable!(), TokenNode::Whitespace(_span) => unreachable!(),
TokenNode::Error(error) => Err(*error.item.clone()), TokenNode::Error(error) => Err(*error.item.clone()),
TokenNode::Path(path) => baseline_parse_path(path, registry, source), TokenNode::Path(path) => baseline_parse_path(path, registry, source),
@ -210,7 +236,7 @@ pub fn baseline_parse_path(
} }
}, },
TokenNode::Identifier(span) => span.slice(source), TokenNode::Member(span) => span.slice(source),
// TODO: Make this impossible // TODO: Make this impossible
other => unreachable!("{:?}", other), other => unreachable!("{:?}", other),

View File

@ -152,7 +152,7 @@ pub fn var(input: NomSpan) -> IResult<NomSpan, TokenNode> {
trace_step(input, "var", move |input| { trace_step(input, "var", move |input| {
let start = input.offset; let start = input.offset;
let (input, _) = tag("$")(input)?; let (input, _) = tag("$")(input)?;
let (input, bare) = identifier(input)?; let (input, bare) = member(input)?;
let end = input.offset; let end = input.offset;
Ok(( Ok((
@ -162,14 +162,7 @@ pub fn var(input: NomSpan) -> IResult<NomSpan, TokenNode> {
}) })
} }
// let start = input.offset; pub fn member(input: NomSpan) -> IResult<NomSpan, TokenNode> {
// let (input, _) = take_while1(is_start_bare_char)(input)?;
// let (input, _) = take_while(is_bare_char)(input)?;
// let end = input.offset;
// Ok((input, TokenTreeBuilder::spanned_bare((start, end))))
pub fn identifier(input: NomSpan) -> IResult<NomSpan, TokenNode> {
trace_step(input, "identifier", move |input| { trace_step(input, "identifier", move |input| {
let start = input.offset; let start = input.offset;
let (input, _) = take_while1(is_id_start)(input)?; let (input, _) = take_while1(is_id_start)(input)?;
@ -177,7 +170,7 @@ pub fn identifier(input: NomSpan) -> IResult<NomSpan, TokenNode> {
let end = input.offset; let end = input.offset;
Ok((input, TokenTreeBuilder::spanned_ident((start, end)))) Ok((input, TokenTreeBuilder::spanned_member((start, end))))
}) })
} }
@ -430,7 +423,7 @@ pub fn path(input: NomSpan) -> IResult<NomSpan, TokenNode> {
let left = input.offset; let left = input.offset;
let (input, head) = node1(input)?; let (input, head) = node1(input)?;
let (input, _) = tag(".")(input)?; let (input, _) = tag(".")(input)?;
let (input, tail) = separated_list(tag("."), alt((identifier, string)))(input)?; let (input, tail) = separated_list(tag("."), alt((member, string)))(input)?;
let right = input.offset; let right = input.offset;
Ok(( Ok((
@ -821,14 +814,14 @@ mod tests {
let _ = pretty_env_logger::try_init(); let _ = pretty_env_logger::try_init();
assert_eq!( assert_eq!(
apply(node, "node", "$it.print"), apply(node, "node", "$it.print"),
build_token(b::path(b::var("it"), vec![b::ident("print")])) build_token(b::path(b::var("it"), vec![b::member("print")]))
); );
assert_eq!( assert_eq!(
apply(node, "node", "$head.part1.part2"), apply(node, "node", "$head.part1.part2"),
build_token(b::path( build_token(b::path(
b::var("head"), b::var("head"),
vec![b::ident("part1"), b::ident("part2")] vec![b::member("part1"), b::member("part2")]
)) ))
); );
@ -836,7 +829,7 @@ mod tests {
apply(node, "node", "( hello ).world"), apply(node, "node", "( hello ).world"),
build_token(b::path( build_token(b::path(
b::parens(vec![b::sp(), b::bare("hello"), b::sp()]), b::parens(vec![b::sp(), b::bare("hello"), b::sp()]),
vec![b::ident("world")] vec![b::member("world")]
)) ))
); );
@ -862,7 +855,7 @@ mod tests {
b::sp(), b::sp(),
b::path( b::path(
b::var("it"), b::var("it"),
vec![b::ident("is"), b::string("great news"), b::ident("right")] vec![b::member("is"), b::string("great news"), b::member("right")]
), ),
b::sp(), b::sp(),
b::bare("yep"), b::bare("yep"),
@ -991,7 +984,7 @@ mod tests {
vec![ vec![
b::sp(), b::sp(),
b::braced(vec![ b::braced(vec![
b::path(b::var("it"), vec![b::ident("size")]), b::path(b::var("it"), vec![b::member("size")]),
b::sp(), b::sp(),
b::op(">"), b::op(">"),
b::sp(), b::sp(),

View File

@ -15,7 +15,7 @@ pub enum TokenNode {
Pipeline(Spanned<Pipeline>), Pipeline(Spanned<Pipeline>),
Operator(Spanned<Operator>), Operator(Spanned<Operator>),
Flag(Spanned<Flag>), Flag(Spanned<Flag>),
Identifier(Span), Member(Span),
Whitespace(Span), Whitespace(Span),
#[allow(unused)] #[allow(unused)]
Error(Spanned<Box<ShellError>>), Error(Spanned<Box<ShellError>>),
@ -92,13 +92,29 @@ impl TokenNode {
TokenNode::Pipeline(s) => s.span, TokenNode::Pipeline(s) => s.span,
TokenNode::Operator(s) => s.span, TokenNode::Operator(s) => s.span,
TokenNode::Flag(s) => s.span, TokenNode::Flag(s) => s.span,
TokenNode::Identifier(s) => *s, TokenNode::Member(s) => *s,
TokenNode::Whitespace(s) => *s, TokenNode::Whitespace(s) => *s,
TokenNode::Error(s) => s.span, TokenNode::Error(s) => s.span,
TokenNode::Path(s) => s.span, TokenNode::Path(s) => s.span,
} }
} }
pub fn type_name(&self) -> String {
match self {
TokenNode::Token(t) => t.type_name(),
TokenNode::Call(s) => "command",
TokenNode::Delimited(d) => d.type_name(),
TokenNode::Pipeline(s) => "pipeline",
TokenNode::Operator(s) => "operator",
TokenNode::Flag(s) => "flag",
TokenNode::Member(s) => "member",
TokenNode::Whitespace(s) => "whitespace",
TokenNode::Error(s) => "error",
TokenNode::Path(s) => "path",
}
.to_string()
}
pub fn debug(&'a self, source: &'a Text) -> DebugTokenNode<'a> { pub fn debug(&'a self, source: &'a Text) -> DebugTokenNode<'a> {
DebugTokenNode { node: self, source } DebugTokenNode { node: self, source }
} }
@ -147,6 +163,16 @@ pub struct DelimitedNode {
children: Vec<TokenNode>, children: Vec<TokenNode>,
} }
impl DelimitedNode {
pub fn type_name(&self) -> &'static str {
match self.delimiter {
Delimiter::Brace => "braced expression",
Delimiter::Paren => "parenthesized expression",
Delimiter::Square => "array literal or index operator",
}
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, FromStr)] #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, FromStr)]
pub enum Delimiter { pub enum Delimiter {
Paren, Paren,

View File

@ -266,17 +266,17 @@ impl TokenTreeBuilder {
)) ))
} }
pub fn ident(input: impl Into<String>) -> CurriedToken { pub fn member(input: impl Into<String>) -> CurriedToken {
let input = input.into(); let input = input.into();
Box::new(move |b| { Box::new(move |b| {
let (start, end) = b.consume(&input); let (start, end) = b.consume(&input);
TokenTreeBuilder::spanned_ident((start, end)) TokenTreeBuilder::spanned_member((start, end))
}) })
} }
pub fn spanned_ident(span: impl Into<Span>) -> TokenNode { pub fn spanned_member(span: impl Into<Span>) -> TokenNode {
TokenNode::Identifier(span.into()) TokenNode::Member(span.into())
} }
pub fn call(head: CurriedToken, input: Vec<CurriedToken>) -> CurriedCall { pub fn call(head: CurriedToken, input: Vec<CurriedToken>) -> CurriedCall {

View File

@ -86,7 +86,7 @@ fn parse_command_tail(
named.insert_switch(name, flag); named.insert_switch(name, flag);
} }
NamedType::Mandatory(kind) => { NamedType::Mandatory(syntax_type) => {
match extract_mandatory(config, name, tail, source, command_span) { match extract_mandatory(config, name, tail, source, command_span) {
Err(err) => return Err(err), // produce a correct diagnostic Err(err) => return Err(err), // produce a correct diagnostic
Ok((pos, flag)) => { Ok((pos, flag)) => {
@ -100,19 +100,15 @@ fn parse_command_tail(
)); ));
} }
let expr = hir::baseline_parse_next_expr( let expr =
tail, hir::baseline_parse_next_expr(tail, registry, source, *syntax_type)?;
registry,
source,
kind.to_coerce_hint(),
)?;
tail.restart(); tail.restart();
named.insert_mandatory(name, expr); named.insert_mandatory(name, expr);
} }
} }
} }
NamedType::Optional(kind) => match extract_optional(name, tail, source) { NamedType::Optional(syntax_type) => match extract_optional(name, tail, source) {
Err(err) => return Err(err), // produce a correct diagnostic Err(err) => return Err(err), // produce a correct diagnostic
Ok(Some((pos, flag))) => { Ok(Some((pos, flag))) => {
tail.move_to(pos); tail.move_to(pos);
@ -125,12 +121,7 @@ fn parse_command_tail(
)); ));
} }
let expr = hir::baseline_parse_next_expr( let expr = hir::baseline_parse_next_expr(tail, registry, source, *syntax_type)?;
tail,
registry,
source,
kind.to_coerce_hint(),
)?;
tail.restart(); tail.restart();
named.insert_optional(name, Some(expr)); named.insert_optional(name, Some(expr));
@ -169,7 +160,7 @@ fn parse_command_tail(
} }
} }
let result = hir::baseline_parse_next_expr(tail, registry, source, arg.to_coerce_hint())?; let result = hir::baseline_parse_next_expr(tail, registry, source, arg.syntax_type())?;
positional.push(result); positional.push(result);
} }

View File

@ -1,5 +1,5 @@
use crate::evaluate::{evaluate_baseline_expr, Scope}; use crate::evaluate::{evaluate_baseline_expr, Scope};
use crate::parser::{hir, hir::ExpressionKindHint, parse_command, CallNode, Spanned}; use crate::parser::{hir, hir::SyntaxType, parse_command, CallNode, Spanned};
use crate::prelude::*; use crate::prelude::*;
use derive_new::new; use derive_new::new;
use getset::Getters; use getset::Getters;
@ -12,55 +12,34 @@ use std::fmt;
#[derive(Debug, Serialize, Deserialize)] #[derive(Debug, Serialize, Deserialize)]
pub enum NamedType { pub enum NamedType {
Switch, Switch,
Mandatory(NamedValue), Mandatory(SyntaxType),
Optional(NamedValue), Optional(SyntaxType),
}
#[derive(Debug, Serialize, Deserialize)]
pub enum NamedValue {
Single,
#[allow(unused)]
Block,
}
impl NamedValue {
crate fn to_coerce_hint(&self) -> Option<ExpressionKindHint> {
match self {
NamedValue::Single => None,
NamedValue::Block => Some(ExpressionKindHint::Block),
}
}
} }
#[allow(unused)] #[allow(unused)]
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PositionalType { pub enum PositionalType {
Mandatory(String, PositionalValue), Mandatory(String, SyntaxType),
Optional(String, PositionalValue), Optional(String, SyntaxType),
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum PositionalValue {
Value,
Block,
} }
impl PositionalType { impl PositionalType {
pub fn mandatory(name: &str) -> PositionalType { pub fn mandatory(name: &str, ty: SyntaxType) -> PositionalType {
PositionalType::Mandatory(name.to_string(), PositionalValue::Value) PositionalType::Mandatory(name.to_string(), ty)
}
pub fn mandatory_any(name: &str) -> PositionalType {
PositionalType::Mandatory(name.to_string(), SyntaxType::Any)
} }
pub fn mandatory_block(name: &str) -> PositionalType { pub fn mandatory_block(name: &str) -> PositionalType {
PositionalType::Mandatory(name.to_string(), PositionalValue::Block) PositionalType::Mandatory(name.to_string(), SyntaxType::Block)
} }
crate fn to_coerce_hint(&self) -> Option<ExpressionKindHint> { crate fn to_coerce_hint(&self) -> Option<SyntaxType> {
match self { match self {
PositionalType::Mandatory(_, PositionalValue::Block) PositionalType::Mandatory(_, SyntaxType::Block)
| PositionalType::Optional(_, PositionalValue::Block) => { | PositionalType::Optional(_, SyntaxType::Block) => Some(SyntaxType::Block),
Some(ExpressionKindHint::Block)
}
_ => None, _ => None,
} }
} }
@ -71,6 +50,13 @@ impl PositionalType {
PositionalType::Optional(s, _) => s, PositionalType::Optional(s, _) => s,
} }
} }
crate fn syntax_type(&self) -> SyntaxType {
match *self {
PositionalType::Mandatory(_, t) => t,
PositionalType::Optional(_, t) => t,
}
}
} }
#[derive(Debug, Getters, Serialize, Deserialize)] #[derive(Debug, Getters, Serialize, Deserialize)]

View File

@ -17,7 +17,7 @@ impl Plugin for Inc {
fn config(&mut self) -> Result<CommandConfig, ShellError> { fn config(&mut self) -> Result<CommandConfig, ShellError> {
Ok(CommandConfig { Ok(CommandConfig {
name: "inc".to_string(), name: "inc".to_string(),
positional: vec![PositionalType::mandatory("Increment")], positional: vec![PositionalType::mandatory_any("Increment")],
is_filter: true, is_filter: true,
is_sink: false, is_sink: false,
named: IndexMap::new(), named: IndexMap::new(),

View File

@ -101,7 +101,7 @@ fn paint_token_node(token_node: &TokenNode, line: &str) -> String {
TokenNode::Call(..) => Color::Cyan.bold().paint(token_node.span().slice(line)), TokenNode::Call(..) => Color::Cyan.bold().paint(token_node.span().slice(line)),
TokenNode::Whitespace(..) => Color::White.normal().paint(token_node.span().slice(line)), TokenNode::Whitespace(..) => Color::White.normal().paint(token_node.span().slice(line)),
TokenNode::Flag(..) => Color::Black.bold().paint(token_node.span().slice(line)), TokenNode::Flag(..) => Color::Black.bold().paint(token_node.span().slice(line)),
TokenNode::Identifier(..) => Color::Yellow.bold().paint(token_node.span().slice(line)), TokenNode::Member(..) => Color::Yellow.bold().paint(token_node.span().slice(line)),
TokenNode::Path(..) => Color::Green.bold().paint(token_node.span().slice(line)), TokenNode::Path(..) => Color::Green.bold().paint(token_node.span().slice(line)),
TokenNode::Error(..) => Color::Red.bold().paint(token_node.span().slice(line)), TokenNode::Error(..) => Color::Red.bold().paint(token_node.span().slice(line)),
TokenNode::Delimited(..) => Color::White.paint(token_node.span().slice(line)), TokenNode::Delimited(..) => Color::White.paint(token_node.span().slice(line)),
@ -139,7 +139,12 @@ fn paint_pipeline_element(pipeline_element: &PipelineElement, line: &str) -> Str
styled.push_str(&Color::White.normal().paint(ws.slice(line))); styled.push_str(&Color::White.normal().paint(ws.slice(line)));
} }
styled.push_str(&Color::Cyan.bold().paint(pipeline_element.call().head().span().slice(line)).to_string()); styled.push_str(
&Color::Cyan
.bold()
.paint(pipeline_element.call().head().span().slice(line))
.to_string(),
);
if let Some(children) = pipeline_element.call().children() { if let Some(children) = pipeline_element.call().children() {
for child in children { for child in children {