mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-22 19:28:01 +00:00
Update syntex to 0.37
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
use std::rc::Rc;
|
||||
|
||||
use syntax::ast::{self, TokenTree};
|
||||
use syntax::attr;
|
||||
use syntax::ast;
|
||||
use syntax::attr::{self, HasAttrs};
|
||||
use syntax::codemap::{Span, Spanned, respan};
|
||||
use syntax::ext::base::ExtCtxt;
|
||||
use syntax::fold::Folder;
|
||||
@@ -10,6 +8,7 @@ use syntax::parse::token::{self, InternedString};
|
||||
use syntax::parse;
|
||||
use syntax::print::pprust::{lit_to_string, meta_item_to_string};
|
||||
use syntax::ptr::P;
|
||||
use syntax::tokenstream::{self, TokenTree};
|
||||
|
||||
// This module handles parsing of `#[serde(...)]` attributes. The entrypoints
|
||||
// are `attr::Item::from_ast`, `attr::Variant::from_ast`, and
|
||||
@@ -518,33 +517,33 @@ struct Respanner<'a, 'b: 'a> {
|
||||
}
|
||||
|
||||
impl<'a, 'b> Folder for Respanner<'a, 'b> {
|
||||
fn fold_tt(&mut self, tt: &TokenTree) -> TokenTree {
|
||||
match *tt {
|
||||
fn fold_tt(&mut self, tt: TokenTree) -> TokenTree {
|
||||
match tt {
|
||||
TokenTree::Token(span, ref tok) => {
|
||||
TokenTree::Token(
|
||||
self.new_span(span),
|
||||
self.fold_token(tok.clone())
|
||||
)
|
||||
}
|
||||
TokenTree::Delimited(span, ref delimed) => {
|
||||
TokenTree::Delimited(span, delimed) => {
|
||||
TokenTree::Delimited(
|
||||
self.new_span(span),
|
||||
Rc::new(ast::Delimited {
|
||||
tokenstream::Delimited {
|
||||
delim: delimed.delim,
|
||||
open_span: delimed.open_span,
|
||||
tts: self.fold_tts(&delimed.tts),
|
||||
tts: self.fold_tts(delimed.tts),
|
||||
close_span: delimed.close_span,
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
TokenTree::Sequence(span, ref seq) => {
|
||||
TokenTree::Sequence(span, seq) => {
|
||||
TokenTree::Sequence(
|
||||
self.new_span(span),
|
||||
Rc::new(ast::SequenceRepetition {
|
||||
tts: self.fold_tts(&seq.tts),
|
||||
tokenstream::SequenceRepetition {
|
||||
tts: self.fold_tts(seq.tts),
|
||||
separator: seq.separator.clone().map(|tok| self.fold_token(tok)),
|
||||
..**seq
|
||||
})
|
||||
..seq
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -590,7 +589,7 @@ fn parse_string_via_tts<T, F>(cx: &ExtCtxt, name: &str, string: String, action:
|
||||
cx.parse_sess()));
|
||||
|
||||
// Respan the spans to say they are all coming from this macro.
|
||||
let tts = Respanner { cx: cx }.fold_tts(&tts);
|
||||
let tts = Respanner { cx: cx }.fold_tts(tts);
|
||||
|
||||
let mut parser = parse::new_parser_from_tts(cx.parse_sess(), cx.cfg(), tts);
|
||||
|
||||
|
||||
@@ -5,10 +5,14 @@
|
||||
#[cfg(feature = "with-syntex")]
|
||||
#[macro_use]
|
||||
extern crate syntex_syntax as syntax;
|
||||
#[cfg(feature = "with-syntex")]
|
||||
extern crate syntex_errors as errors;
|
||||
|
||||
#[cfg(not(feature = "with-syntex"))]
|
||||
#[macro_use]
|
||||
extern crate syntax;
|
||||
#[cfg(not(feature = "with-syntex"))]
|
||||
extern crate rustc_errors as errors;
|
||||
|
||||
pub mod ast;
|
||||
pub mod attr;
|
||||
|
||||
Reference in New Issue
Block a user