aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe/src/lib.rs')
-rw-r--r--crates/ra_mbe/src/lib.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ra_mbe/src/lib.rs b/crates/ra_mbe/src/lib.rs
index 43afe24cc..3adec4978 100644
--- a/crates/ra_mbe/src/lib.rs
+++ b/crates/ra_mbe/src/lib.rs
@@ -30,6 +30,8 @@ pub enum ExpandError {
30 InvalidRepeat, 30 InvalidRepeat,
31} 31}
32 32
33pub type ExpandResult<T> = (T, Option<ExpandError>);
34
33pub use crate::syntax_bridge::{ 35pub use crate::syntax_bridge::{
34 ast_to_token_tree, parse_to_token_tree, syntax_node_to_token_tree, token_tree_to_syntax_node, 36 ast_to_token_tree, parse_to_token_tree, syntax_node_to_token_tree, token_tree_to_syntax_node,
35 TokenMap, 37 TokenMap,
@@ -150,7 +152,7 @@ impl MacroRules {
150 Ok(MacroRules { rules, shift: Shift::new(tt) }) 152 Ok(MacroRules { rules, shift: Shift::new(tt) })
151 } 153 }
152 154
153 pub fn expand(&self, tt: &tt::Subtree) -> Result<tt::Subtree, ExpandError> { 155 pub fn expand(&self, tt: &tt::Subtree) -> ExpandResult<tt::Subtree> {
154 // apply shift 156 // apply shift
155 let mut tt = tt.clone(); 157 let mut tt = tt.clone();
156 self.shift.shift_all(&mut tt); 158 self.shift.shift_all(&mut tt);