From 0fa24f3636a5db0353b1c084c069561e5c169384 Mon Sep 17 00:00:00 2001 From: Bastien Orivel Date: Wed, 17 Oct 2018 00:05:06 +0200 Subject: [PATCH] Update syn and bump version --- Cargo.toml | 4 ++-- build/match_byte.rs | 25 ++++++++++++++++--------- macros/Cargo.toml | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b12a1158..df4e7ab7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cssparser" -version = "0.25.0" +version = "0.25.1" authors = [ "Simon Sapin " ] description = "Rust implementation of CSS Syntax Level 3" @@ -30,7 +30,7 @@ serde = {version = "1.0", optional = true} smallvec = "0.6" [build-dependencies] -syn = { version = "0.14", features = ["extra-traits", "fold", "full"] } +syn = { version = "0.15.12", features = ["extra-traits", "fold", "full"] } quote = "0.6" proc-macro2 = "0.4" diff --git a/build/match_byte.rs b/build/match_byte.rs index 801dfdee..5160e7f5 100644 --- a/build/match_byte.rs +++ b/build/match_byte.rs @@ -8,6 +8,7 @@ use std::io::{Read, Write}; use std::path::Path; use syn; use syn::fold::Fold; +use syn::parse::{Parse, ParseStream, Result}; use proc_macro2::{Span, TokenStream}; @@ -30,17 +31,23 @@ struct MatchByte { arms: Vec, } -impl syn::synom::Synom for MatchByte { - named!(parse -> Self, do_parse!( - expr: syn!(syn::Expr) >> - punct!(,) >> - arms: many0!(syn!(syn::Arm)) >> ( - MatchByte { - expr, +impl Parse for MatchByte { + fn parse(input: ParseStream) -> Result { + Ok(MatchByte { + expr: { + let expr = input.parse()?; + input.parse::()?; + expr + }, + arms: { + let mut arms = Vec::new(); + while !input.is_empty() { + arms.push(input.call(syn::Arm::parse)?); + } arms } - ) - )); + }) + } } fn get_byte_from_expr_lit(expr: &Box) -> u8 { diff --git a/macros/Cargo.toml b/macros/Cargo.toml index ee3ddc72..05166438 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -15,5 +15,5 @@ proc-macro = true procedural-masquerade = {path = "../procedural-masquerade", version = "0.1"} phf_codegen = "0.7" quote = "0.6" -syn = {version = "0.14", features = ["full", "extra-traits"]} +syn = {version = "0.15.12", features = ["full", "extra-traits"]} proc-macro2 = "0.4"