nushell/src/parser.rs

31 lines
926 B
Rust
Raw Normal View History

2019-06-22 05:43:37 +02:00
crate mod hir;
2019-06-11 07:53:04 +02:00
crate mod parse2;
2019-06-22 05:43:37 +02:00
crate mod parse_command;
crate mod registry;
2019-05-26 08:54:41 +02:00
use crate::errors::ShellError;
2019-06-22 05:43:37 +02:00
crate use hir::baseline_parse_tokens::baseline_parse_tokens;
crate use parse2::call_node::CallNode;
crate use parse2::files::Files;
crate use parse2::flag::Flag;
crate use parse2::operator::Operator;
crate use parse2::parser::{nom_input, pipeline};
2019-06-23 19:35:43 +02:00
crate use parse2::pipeline::{Pipeline, PipelineElement};
2019-06-22 05:43:37 +02:00
crate use parse2::span::{Span, Spanned};
crate use parse2::text::Text;
crate use parse2::token_tree::TokenNode;
crate use parse2::tokens::{RawToken, Token};
crate use parse2::unit::Unit;
crate use parse_command::parse_command;
crate use registry::CommandRegistry;
pub fn parse(input: &str) -> Result<TokenNode, ShellError> {
2019-06-04 23:42:31 +02:00
let _ = pretty_env_logger::try_init();
2019-06-22 05:43:37 +02:00
match pipeline(nom_input(input)) {
Ok((_rest, val)) => Ok(val),
Err(err) => Err(ShellError::parse_error(err)),
}
}