aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r--crates/ra_mbe/src/mbe_expander.rs6
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs1
2 files changed, 4 insertions, 3 deletions
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs
index b2faa86d2..c2a5702f0 100644
--- a/crates/ra_mbe/src/mbe_expander.rs
+++ b/crates/ra_mbe/src/mbe_expander.rs
@@ -11,6 +11,7 @@ use rustc_hash::FxHashMap;
11use crate::{ExpandError, ExpandResult}; 11use crate::{ExpandError, ExpandResult};
12 12
13pub(crate) fn expand(rules: &crate::MacroRules, input: &tt::Subtree) -> ExpandResult<tt::Subtree> { 13pub(crate) fn expand(rules: &crate::MacroRules, input: &tt::Subtree) -> ExpandResult<tt::Subtree> {
14 eprintln!("expanding input: {:?}", input);
14 let (mut result, mut unmatched_tokens, mut unmatched_patterns, mut err) = ( 15 let (mut result, mut unmatched_tokens, mut unmatched_patterns, mut err) = (
15 tt::Subtree::default(), 16 tt::Subtree::default(),
16 usize::max_value(), 17 usize::max_value(),
@@ -39,9 +40,8 @@ fn expand_rule(
39 rule: &crate::Rule, 40 rule: &crate::Rule,
40 input: &tt::Subtree, 41 input: &tt::Subtree,
41) -> ExpandResult<(tt::Subtree, usize, usize)> { 42) -> ExpandResult<(tt::Subtree, usize, usize)> {
42 dbg!(&rule.lhs); 43 let (match_result, bindings_err) = matcher::match_(&rule.lhs, input);
43 let (match_result, bindings_err) = dbg!(matcher::match_(&rule.lhs, input)); 44 let (res, transcribe_err) = transcriber::transcribe(&rule.rhs, &match_result.bindings);
44 let (res, transcribe_err) = dbg!(transcriber::transcribe(&rule.rhs, &match_result.bindings));
45 ( 45 (
46 (res, match_result.unmatched_tokens, match_result.unmatched_patterns), 46 (res, match_result.unmatched_tokens, match_result.unmatched_patterns),
47 bindings_err.or(transcribe_err), 47 bindings_err.or(transcribe_err),
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index fcb73fbc7..8aa3b906b 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -73,6 +73,7 @@ pub fn token_tree_to_syntax_node(
73 tt: &tt::Subtree, 73 tt: &tt::Subtree,
74 fragment_kind: FragmentKind, 74 fragment_kind: FragmentKind,
75) -> Result<(Parse<SyntaxNode>, TokenMap), ExpandError> { 75) -> Result<(Parse<SyntaxNode>, TokenMap), ExpandError> {
76 eprintln!("token_tree_to_syntax_node {:?} as {:?}", tt, fragment_kind);
76 let tmp; 77 let tmp;
77 let tokens = match tt { 78 let tokens = match tt {
78 tt::Subtree { delimiter: None, token_trees } => token_trees.as_slice(), 79 tt::Subtree { delimiter: None, token_trees } => token_trees.as_slice(),