Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit f1da953

Browse files
committed
feat(rustup): Update aster and syntex versions
1 parent df3a4ab commit f1da953

File tree

7 files changed

+65
-24
lines changed

7 files changed

+65
-24
lines changed

quasi/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "quasi"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
authors = ["Erick Tryzelaar <[email protected]>"]
55
license = "MIT/Apache-2.0"
66
description = "A quasi-quoting macro system"
@@ -10,4 +10,4 @@ repository = "https://github.com/erickt/rust-quasi"
1010
with-syntex = ["syntex_syntax"]
1111

1212
[dependencies]
13-
syntex_syntax = { version = "^0.20.0", optional = true }
13+
syntex_syntax = { version = "^0.22.0", optional = true }

quasi/src/lib.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ use syntax::ast::{self, TokenTree, Generics, Expr};
2222
use syntax::codemap::{DUMMY_SP, Spanned, dummy_spanned};
2323
use syntax::ext::base::ExtCtxt;
2424
use syntax::parse::{self, classify, parse_tts_from_source_str, token};
25+
use syntax::parse::parser::Parser;
2526
use syntax::print::pprust;
2627
use syntax::ptr::P;
2728

@@ -326,3 +327,40 @@ impl<'a> ExtParseUtils for ExtCtxt<'a> {
326327
self.parse_sess())
327328
}
328329
}
330+
331+
macro_rules! panictry {
332+
($e:expr) => ({
333+
match $e {
334+
Ok(e) => e,
335+
Err(err) => panic!(err)
336+
}
337+
})
338+
}
339+
340+
pub fn parse_expr_panic(parser: &mut Parser) -> P<ast::Expr> {
341+
panictry!(parser.parse_expr())
342+
}
343+
344+
pub fn parse_item_panic(parser: &mut Parser) -> Option<P<ast::Item>> {
345+
panictry!(parser.parse_item())
346+
}
347+
348+
pub fn parse_pat_panic(parser: &mut Parser) -> P<ast::Pat> {
349+
panictry!(parser.parse_pat())
350+
}
351+
352+
pub fn parse_arm_panic(parser: &mut Parser) -> ast::Arm {
353+
panictry!(parser.parse_arm())
354+
}
355+
356+
pub fn parse_ty_panic(parser: &mut Parser) -> P<ast::Ty> {
357+
panictry!(parser.parse_ty())
358+
}
359+
360+
pub fn parse_stmt_panic(parser: &mut Parser) -> Option<P<ast::Stmt>> {
361+
panictry!(parser.parse_stmt())
362+
}
363+
364+
pub fn parse_attribute_panic(parser: &mut Parser, permit_inner: bool) -> ast::Attribute {
365+
panictry!(parser.parse_attribute(permit_inner))
366+
}

quasi_codegen/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "quasi_codegen"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
authors = ["Erick Tryzelaar <[email protected]>"]
55
license = "MIT/Apache-2.0"
66
description = "A quasi-quoting macro system"
@@ -11,6 +11,6 @@ default = ["with-syntex"]
1111
with-syntex = ["syntex", "syntex_syntax", "aster/with-syntex"]
1212

1313
[dependencies]
14-
aster = { version = "^0.7.0", default-features = false }
15-
syntex = { version = "^0.17.0", optional = true }
16-
syntex_syntax = { version = "^0.20.0", optional = true }
14+
aster = { version = "^0.8.0", default-features = false }
15+
syntex = { version = "^0.22.0", optional = true }
16+
syntex_syntax = { version = "^0.22.0", optional = true }

quasi_codegen/src/lib.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn expand_quote_ty<'cx>(
5757
let expanded = expand_parse_call(
5858
cx,
5959
sp,
60-
&["syntax", "parse", "parser", "Parser", "parse_ty_panic"],
60+
&["quasi", "parse_ty_panic"],
6161
vec!(),
6262
tts);
6363
base::MacEager::expr(expanded)
@@ -71,7 +71,7 @@ fn expand_quote_expr<'cx>(
7171
let expanded = expand_parse_call(
7272
cx,
7373
sp,
74-
&["syntax", "parse", "parser", "Parser", "parse_expr_panic"],
74+
&["quasi", "parse_expr_panic"],
7575
Vec::new(),
7676
tts);
7777
base::MacEager::expr(expanded)
@@ -85,7 +85,7 @@ fn expand_quote_stmt<'cx>(
8585
let expanded = expand_parse_call(
8686
cx,
8787
sp,
88-
&["syntax", "parse", "parser", "Parser", "parse_stmt_panic"],
88+
&["quasi", "parse_stmt_panic"],
8989
vec!(),
9090
tts);
9191
base::MacEager::expr(expanded)
@@ -101,7 +101,7 @@ fn expand_quote_attr<'cx>(
101101
let expanded = expand_parse_call(
102102
cx,
103103
sp,
104-
&["syntax", "parse", "parser", "Parser", "parse_attribute_panic"],
104+
&["quasi", "parse_attribute_panic"],
105105
vec![builder.expr().bool(true)],
106106
tts);
107107

@@ -135,7 +135,7 @@ fn expand_quote_pat<'cx>(
135135
let expanded = expand_parse_call(
136136
cx,
137137
sp,
138-
&["syntax", "parse", "parser", "Parser", "parse_pat_panic"],
138+
&["quasi", "parse_pat_panic"],
139139
vec!(),
140140
tts);
141141
base::MacEager::expr(expanded)
@@ -149,7 +149,7 @@ fn expand_quote_arm<'cx>(
149149
let expanded = expand_parse_call(
150150
cx,
151151
sp,
152-
&["syntax", "parse", "parser", "Parser", "parse_arm_panic"],
152+
&["quasi", "parse_arm_panic"],
153153
vec!(),
154154
tts);
155155
base::MacEager::expr(expanded)
@@ -177,7 +177,7 @@ fn expand_quote_item<'cx>(
177177
let expanded = expand_parse_call(
178178
cx,
179179
sp,
180-
&["syntax", "parse", "parser", "Parser", "parse_item_panic"],
180+
&["quasi", "parse_item_panic"],
181181
vec!(),
182182
tts);
183183
base::MacEager::expr(expanded)
@@ -583,7 +583,10 @@ fn parse_arguments_to_quote(cx: &ExtCtxt, tts: &[ast::TokenTree])
583583
let mut p = cx.new_parser_from_tts(tts);
584584
p.quote_depth += 1;
585585

586-
let cx_expr = p.parse_expr_panic();
586+
let cx_expr = match p.parse_expr() {
587+
Ok(expr) => expr,
588+
Err(err) => panic!(err),
589+
};
587590
if !p.eat(&token::Comma).ok().unwrap() {
588591
let _ = p.fatal("expected token `,`");
589592
}

quasi_macros/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "quasi_macros"
3-
version = "0.3.7"
3+
version = "0.3.8"
44
authors = ["Erick Tryzelaar <[email protected]>"]
55
license = "MIT/Apache-2.0"
66
description = "A quasi-quoting macro system"
@@ -14,5 +14,5 @@ plugin = true
1414
quasi_codegen = { version = "*", path = "../quasi_codegen", default-features = false }
1515

1616
[dev-dependencies]
17-
aster = "^0.7.0"
17+
aster = "^0.8.0"
1818
quasi = { version = "*", path = "../quasi" }

quasi_tests/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ build = "build.rs"
99

1010
[build-dependencies]
1111
quasi_codegen = { version = "*", path = "../quasi_codegen" }
12-
syntex = { version = "^0.17.0" }
12+
syntex = { version = "^0.22.0" }
1313

1414
[dev-dependencies]
15-
aster = { version = "^0.7.0", features = ["with-syntex"] }
15+
aster = { version = "^0.8.0", features = ["with-syntex"] }
1616
quasi = { version = "*", path = "../quasi", features = ["with-syntex"] }
17-
syntex = { version = "^0.17.0" }
18-
syntex_syntax = { version = "^0.20.0" }
17+
syntex = { version = "^0.22.0" }
18+
syntex_syntax = { version = "^0.22.0" }

quasi_tests/tests/test.rs.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ fn test_quote_with_macro() {
205205
s == "{\n macro_rules! value(( ) => 6);\n value!{ }\n}");
206206

207207
// Make sure we don't expand macros in the quote.
208-
macro_rules! value { () => 5 }
208+
macro_rules! value { () => { 5i32 } }
209209
let block = quote_block!(&cx, { value!() }).ok().unwrap();
210210

211211
// FIXME: Rust 1.2 and nightly pretty print slightly differently.
212-
//assert_eq!(pprust::block_to_string(&block), "{ value!() }");
213-
let s = pprust::block_to_string(&block);
214-
assert!(s == "{ value!() }" || s == "{ value!{ } }");
212+
assert_eq!(pprust::block_to_string(&block), "{ value!() }");
213+
//let s = pprust::block_to_string(&block);
214+
//assert!(s == "{ value!() }" || s == "{ value!{ } }");
215215
}
216216

217217
#[test]

0 commit comments

Comments
 (0)