Update and fix a few tests
This commit is contained in:
parent
302935ff2a
commit
d316874c87
@ -687,7 +687,7 @@ fn str2seg(s: &str, lo: u32, hi: u32) -> ast::PathSegment {
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
node: ast::ExprKind::Path(None, ast::Path {
|
||||
span: sp(0, 6),
|
||||
segments: vec![ast::PathSegment::crate_root(),
|
||||
segments: vec![ast::PathSegment::crate_root(sp(0, 2)),
|
||||
str2seg("a", 2, 3),
|
||||
str2seg("b", 5, 6)]
|
||||
}),
|
||||
|
@ -20,7 +20,7 @@
|
||||
/// Map a string to tts, using a made-up filename:
|
||||
pub fn string_to_stream(source_str: String) -> TokenStream {
|
||||
let ps = ParseSess::new(FilePathMapping::empty());
|
||||
filemap_to_stream(&ps, ps.codemap().new_filemap("bogofile".to_string(), source_str))
|
||||
filemap_to_stream(&ps, ps.codemap().new_filemap("bogofile".to_string(), source_str), None)
|
||||
}
|
||||
|
||||
/// Map string to parser (via tts)
|
||||
|
@ -11,7 +11,7 @@
|
||||
// no-prefer-dynamic
|
||||
|
||||
#![crate_type = "proc-macro"]
|
||||
#![feature(proc_macro, proc_macro_lib)]
|
||||
#![feature(proc_macro)]
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
@ -23,7 +23,7 @@ pub fn cond(input: TokenStream) -> TokenStream {
|
||||
let mut input = input.into_iter().peekable();
|
||||
while let Some(tree) = input.next() {
|
||||
let cond = match tree.kind {
|
||||
TokenNode::Sequence(_, cond) => cond,
|
||||
TokenNode::Group(_, cond) => cond,
|
||||
_ => panic!("Invalid input"),
|
||||
};
|
||||
let mut cond_trees = cond.clone().into_iter();
|
||||
@ -33,7 +33,7 @@ pub fn cond(input: TokenStream) -> TokenStream {
|
||||
panic!("Invalid macro usage in cond: {}", cond);
|
||||
}
|
||||
let is_else = match test.kind {
|
||||
TokenNode::Word(word) => word.as_str() == "else",
|
||||
TokenNode::Term(word) => word.as_str() == "else",
|
||||
_ => false,
|
||||
};
|
||||
conds.push(if is_else || input.peek().is_none() {
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
extern crate proc_macro;
|
||||
|
||||
use proc_macro::{TokenStream, TokenNode, OpKind, Literal, quote};
|
||||
use proc_macro::{TokenStream, TokenNode, Spacing, Literal, quote};
|
||||
|
||||
#[proc_macro]
|
||||
pub fn count_compound_ops(input: TokenStream) -> TokenStream {
|
||||
@ -27,8 +27,8 @@ fn count_compound_ops_helper(input: TokenStream) -> u32 {
|
||||
let mut count = 0;
|
||||
for token in input {
|
||||
match token.kind {
|
||||
TokenNode::Op(c, OpKind::Alone) => count += 1,
|
||||
TokenNode::Sequence(_, tokens) => count += count_compound_ops_helper(tokens),
|
||||
TokenNode::Op(c, Spacing::Alone) => count += 1,
|
||||
TokenNode::Group(_, tokens) => count += count_compound_ops_helper(tokens),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user