From 725805dc795159399c90a5c9b6f11ffeadec2e0f Mon Sep 17 00:00:00 2001 From: Wilco Kusee Date: Sun, 3 Mar 2019 10:40:03 +0100 Subject: Split parse and expand errors --- crates/ra_mbe/src/lib.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/ra_mbe/src/lib.rs') diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs index 8a2d6ff63..34840dfa1 100644 --- a/crates/ra_mbe/src/lib.rs +++ b/crates/ra_mbe/src/lib.rs @@ -25,14 +25,17 @@ use ra_syntax::SmolStr; pub use tt::{Delimiter, Punct}; #[derive(Debug, PartialEq, Eq)] -pub enum MacroRulesError { +pub enum ParseError { + ParseError, +} + +#[derive(Debug, PartialEq, Eq)] +pub enum ExpandError { NoMatchingRule, UnexpectedToken, BindingError(String), - ParseError, } -pub type Result = ::std::result::Result; pub use crate::syntax_bridge::{ast_to_token_tree, token_tree_to_ast_item_list}; /// This struct contains AST for a single `macro_rules` definition. What might @@ -45,10 +48,10 @@ pub struct MacroRules { } impl MacroRules { - pub fn parse(tt: &tt::Subtree) -> Result { + pub fn parse(tt: &tt::Subtree) -> Result { mbe_parser::parse(tt) } - pub fn expand(&self, tt: &tt::Subtree) -> Result { + pub fn expand(&self, tt: &tt::Subtree) -> Result { mbe_expander::expand(self, tt) } } -- cgit v1.2.3