2019-06-22 05:43:37 +02:00
|
|
|
crate mod hir;
|
2019-06-25 06:33:12 +02:00
|
|
|
crate mod parse;
|
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;
|
2019-06-25 06:33:12 +02:00
|
|
|
crate use parse::call_node::CallNode;
|
|
|
|
crate use parse::files::Files;
|
|
|
|
crate use parse::flag::Flag;
|
|
|
|
crate use parse::operator::Operator;
|
|
|
|
crate use parse::parser::{nom_input, pipeline};
|
|
|
|
crate use parse::pipeline::{Pipeline, PipelineElement};
|
2019-06-27 06:56:48 +02:00
|
|
|
pub use parse::span::{Span, Spanned};
|
2019-06-25 06:33:12 +02:00
|
|
|
crate use parse::text::Text;
|
|
|
|
crate use parse::token_tree::TokenNode;
|
|
|
|
crate use parse::tokens::{RawToken, Token};
|
|
|
|
crate use parse::unit::Unit;
|
2019-06-22 05:43:37 +02:00
|
|
|
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),
|
2019-06-10 21:13:29 +02:00
|
|
|
Err(err) => Err(ShellError::parse_error(err)),
|
|
|
|
}
|
|
|
|
}
|