deps: Update syntex_syntax to 0.30.0

This bump includes ability to parse inclusive ranges (`a...b`) and the
question mark operator.

Refs #867, #890
This commit is contained in:
Kamal Marhubi 2016-03-29 00:04:44 -04:00
parent 6526533745
commit f2b5931c6d
4 changed files with 17 additions and 11 deletions

8
Cargo.lock generated
View File

@ -9,7 +9,7 @@ dependencies = [
"regex 0.1.58 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.58 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
"strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "strings 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syntex_syntax 0.29.1 (registry+https://github.com/rust-lang/crates.io-index)", "syntex_syntax 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
"term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -25,7 +25,7 @@ dependencies = [
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "0.3.3" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@ -108,10 +108,10 @@ dependencies = [
[[package]] [[package]]
name = "syntex_syntax" name = "syntex_syntax"
version = "0.29.1" version = "0.30.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -21,7 +21,7 @@ regex = "0.1.41"
term = "0.2.11" term = "0.2.11"
strings = "0.0.1" strings = "0.0.1"
diff = "0.1.8" diff = "0.1.8"
syntex_syntax = "0.29.1" syntex_syntax = "0.30"
log = "0.3.2" log = "0.3.2"
env_logger = "0.3.1" env_logger = "0.3.1"
getopts = "0.2" getopts = "0.2"

View File

@ -185,19 +185,21 @@ impl Rewrite for ast::Expr {
ast::ExprKind::Repeat(ref expr, ref repeats) => { ast::ExprKind::Repeat(ref expr, ref repeats) => {
rewrite_pair(&**expr, &**repeats, "[", "; ", "]", context, width, offset) rewrite_pair(&**expr, &**repeats, "[", "; ", "]", context, width, offset)
} }
ast::ExprKind::Range(Some(ref lhs), Some(ref rhs)) => { // TODO(#890): Handle closed ranges; rust tracking issue
// https://github.com/rust-lang/rust/issues/28237
ast::ExprKind::Range(Some(ref lhs), Some(ref rhs), _range_limits) => {
rewrite_pair(&**lhs, &**rhs, "", "..", "", context, width, offset) rewrite_pair(&**lhs, &**rhs, "", "..", "", context, width, offset)
} }
ast::ExprKind::Range(None, Some(ref rhs)) => { ast::ExprKind::Range(None, Some(ref rhs), _range_limits) => {
rewrite_unary_prefix(context, "..", &**rhs, width, offset) rewrite_unary_prefix(context, "..", &**rhs, width, offset)
} }
ast::ExprKind::Range(Some(ref lhs), None) => { ast::ExprKind::Range(Some(ref lhs), None, _range_limits) => {
Some(format!("{}..", Some(format!("{}..",
try_opt!(lhs.rewrite(context, try_opt!(lhs.rewrite(context,
try_opt!(width.checked_sub(2)), try_opt!(width.checked_sub(2)),
offset)))) offset))))
} }
ast::ExprKind::Range(None, None) => { ast::ExprKind::Range(None, None, _range_limits) => {
if width >= 2 { if width >= 2 {
Some("..".into()) Some("..".into())
} else { } else {
@ -213,6 +215,9 @@ impl Rewrite for ast::Expr {
width, width,
offset) offset)
} }
// TODO(#867): Handle type ascription; rust tracking issue
// https://github.com/rust-lang/rust/issues/31436
ast::ExprKind::Try(_) => unimplemented!(),
}; };
result.and_then(|res| recover_comment_removed(res, self.span, context, width, offset)) result.and_then(|res| recover_comment_removed(res, self.span, context, width, offset))
} }

View File

@ -381,7 +381,8 @@ pub fn format_string(input: String, config: &Config) -> FileMap {
let krate = parse::parse_crate_from_source_str(path.to_owned(), let krate = parse::parse_crate_from_source_str(path.to_owned(),
input, input,
Vec::new(), Vec::new(),
&parse_session); &parse_session)
.unwrap();
// Suppress error output after parsing. // Suppress error output after parsing.
let silent_emitter = Box::new(EmitterWriter::new(Box::new(Vec::new()), None, codemap.clone())); let silent_emitter = Box::new(EmitterWriter::new(Box::new(Vec::new()), None, codemap.clone()));
@ -412,7 +413,7 @@ pub fn format(file: &Path, config: &Config) -> FileMap {
codemap.clone()); codemap.clone());
let mut parse_session = ParseSess::with_span_handler(tty_handler, codemap.clone()); let mut parse_session = ParseSess::with_span_handler(tty_handler, codemap.clone());
let krate = parse::parse_crate_from_file(file, Vec::new(), &parse_session); let krate = parse::parse_crate_from_file(file, Vec::new(), &parse_session).unwrap();
// Suppress error output after parsing. // Suppress error output after parsing.
let silent_emitter = Box::new(EmitterWriter::new(Box::new(Vec::new()), None, codemap.clone())); let silent_emitter = Box::new(EmitterWriter::new(Box::new(Vec::new()), None, codemap.clone()));