use std::fmt;
-pub use tt::{Delimiter, DelimiterKind, Punct};
-
use crate::{
parser::{parse_pattern, parse_template, MetaTemplate, Op},
tt_iter::TtIter,
};
+// FIXME: we probably should re-think `token_tree_to_syntax_node` interfaces
+pub use ::parser::FragmentKind;
+pub use tt::{Delimiter, DelimiterKind, Punct};
+
#[derive(Debug, PartialEq, Eq)]
pub enum ParseError {
UnexpectedToken(String),
UnexpectedToken,
BindingError(String),
ConversionError,
- ProcMacroError(tt::ExpansionError),
+ // FIXME: no way mbe should know about proc macros.
UnresolvedProcMacro,
Other(String),
}
-impl From<tt::ExpansionError> for ExpandError {
- fn from(it: tt::ExpansionError) -> Self {
- ExpandError::ProcMacroError(it)
- }
-}
-
impl fmt::Display for ExpandError {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
ExpandError::UnexpectedToken => f.write_str("unexpected token in input"),
ExpandError::BindingError(e) => f.write_str(e),
ExpandError::ConversionError => f.write_str("could not convert tokens"),
- ExpandError::ProcMacroError(e) => e.fmt(f),
ExpandError::UnresolvedProcMacro => f.write_str("unresolved proc macro"),
ExpandError::Other(e) => f.write_str(e),
}
pub use crate::{
syntax_bridge::{
parse_exprs_with_sep, parse_to_token_tree, syntax_node_to_token_tree,
- token_tree_to_syntax_node,
+ syntax_node_to_token_tree_censored, token_tree_to_syntax_node,
},
token_map::TokenMap,
};