nushell/src/parser.rs

32 lines
980 B
Rust
Raw Normal View History

2019-08-02 21:15:07 +02:00
crate mod deserializer;
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-08-02 21:15:07 +02:00
crate use deserializer::ConfigDeserializer;
2019-06-29 18:32:58 +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};
crate use parse::text::Text;
crate use parse::token_tree::{DelimitedNode, Delimiter, PathNode, TokenNode};
2019-06-25 06:33:12 +02:00
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),
Err(err) => Err(ShellError::parse_error(err)),
}
}