Extract nu_source into a crate

This commit extracts Tag, Span, Text, as well as source-related debug
facilities into a new crate called nu_source.

This change is much bigger than one might have expected because the
previous code relied heavily on implementing inherent methods on
`Tagged<T>` and `Spanned<T>`, which is no longer possible.

As a result, this change creates more concrete types instead of using
`Tagged<T>`. One notable example: Tagged<Value> became Value, and Value
became UntaggedValue.

This change clarifies the intent of the code in many places, but it does
make it a big change.
This commit is contained in:
Yehuda Katz
2019-11-21 06:33:14 -08:00
parent fe53c37654
commit f70c6d5d48
173 changed files with 4958 additions and 4210 deletions

View File

@ -36,14 +36,14 @@ fn shells(args: CommandArgs, _registry: &CommandRegistry) -> Result<OutputStream
let mut dict = TaggedDictBuilder::new(&tag);
if index == (*args.shell_manager.current_shell).load(Ordering::SeqCst) {
dict.insert(" ", "X".to_string());
dict.insert_untagged(" ", "X".to_string());
} else {
dict.insert(" ", " ".to_string());
dict.insert_untagged(" ", " ".to_string());
}
dict.insert("name", shell.name());
dict.insert("path", shell.path());
dict.insert_untagged("name", shell.name());
dict.insert_untagged("path", shell.path());
shells_out.push_back(dict.into_tagged_value());
shells_out.push_back(dict.into_value());
}
Ok(shells_out.to_output_stream())