mirror of
https://github.com/nushell/nushell
synced 2025-01-22 18:05:21 +00:00
f70c6d5d48
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.
32 lines
1,010 B
Rust
32 lines
1,010 B
Rust
pub(crate) mod debug;
|
|
pub(crate) mod deserializer;
|
|
pub(crate) mod hir;
|
|
pub(crate) mod parse;
|
|
pub(crate) mod parse_command;
|
|
pub(crate) mod registry;
|
|
|
|
use crate::errors::ShellError;
|
|
|
|
pub(crate) use deserializer::ConfigDeserializer;
|
|
pub(crate) use hir::syntax_shape::flat_shape::FlatShape;
|
|
pub(crate) use hir::TokensIterator;
|
|
pub(crate) use parse::call_node::CallNode;
|
|
pub(crate) use parse::files::Files;
|
|
pub(crate) use parse::flag::{Flag, FlagKind};
|
|
pub(crate) use parse::operator::Operator;
|
|
pub(crate) use parse::parser::pipeline;
|
|
pub(crate) use parse::token_tree::{DelimitedNode, Delimiter, TokenNode};
|
|
pub(crate) use parse::tokens::{RawNumber, UnspannedToken};
|
|
pub(crate) use parse::unit::Unit;
|
|
pub(crate) use registry::CommandRegistry;
|
|
|
|
use nu_source::nom_input;
|
|
|
|
pub fn parse(input: &str) -> Result<TokenNode, ShellError> {
|
|
let _ = pretty_env_logger::try_init();
|
|
|
|
match pipeline(nom_input(input)) {
|
|
Ok((_rest, val)) => Ok(val),
|
|
Err(err) => Err(ShellError::parse_error(err)),
|
|
}
|
|
}
|