aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_mbe/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-03-15 10:17:13 +0000
committerFlorian Diebold <[email protected]>2020-03-16 17:38:19 +0000
commitc32529ddd0d66a219226dd63da2d4b1825375c0e (patch)
tree060bf75bcd43d2bd1ed9519bf1030ca7f24c7af0 /crates/ra_mbe/src
parent0f3a54dd4d439a6598526144c4ecccee9c5f1362 (diff)
Get tests working
Diffstat (limited to 'crates/ra_mbe/src')
-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(),