Skip to content

Commit

Permalink
syntax: Rewrite parsing of patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Apr 2, 2015
1 parent 5e30f05 commit 35c1bdb
Show file tree
Hide file tree
Showing 10 changed files with 136 additions and 234 deletions.
352 changes: 127 additions & 225 deletions src/libsyntax/parse/parser.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22426-1.rs
Expand Up @@ -11,7 +11,7 @@
fn main() {
match 42 {
x < 7 => (),
//~^ error: unexpected token: `<`
//~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
_ => ()
}
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22426-2.rs
Expand Up @@ -9,4 +9,4 @@
// except according to those terms.

fn a(B<) {}
//~^ error: unexpected token: `<`
//~^ error: expected one of `:` or `@`, found `<`
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-22426-3.rs
Expand Up @@ -14,7 +14,7 @@ impl<T> Foo<T> {
fn foo(&self) {
match *self {
Foo<T>(x, y) => {
//~^ error: unexpected token: `<`
//~^ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
println!("Goodbye, World!")
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/issue-22647.rs
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

fn main() {
let caller<F> = |f: F| //~ ERROR unexpected token: `<`
let caller<F> = |f: F| //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
where F: Fn() -> i32
{
let x = f();
Expand Down
2 changes: 1 addition & 1 deletion src/test/parse-fail/issue-22712.rs
Expand Up @@ -13,7 +13,7 @@ struct Foo<B> {
}

fn bar() {
let Foo<Vec<u8>> //~ ERROR unexpected token: `<`
let Foo<Vec<u8>> //~ ERROR expected one of `:`, `;`, `=`, or `@`, found `<`
}

fn main() {}
2 changes: 1 addition & 1 deletion src/test/parse-fail/match-vec-invalid.rs
Expand Up @@ -11,7 +11,7 @@
fn main() {
let a = Vec::new();
match a {
[1, tail.., tail..] => {}, //~ ERROR: expected one of `!`, `,`, or `@`, found `..`
[1, tail.., tail..] => {}, //~ ERROR: expected one of `,` or `@`, found `..`
_ => ()
}
}
2 changes: 1 addition & 1 deletion src/test/parse-fail/omitted-arg-in-item-fn.rs
Expand Up @@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

fn foo(x) { //~ ERROR expected one of `!`, `:`, or `@`, found `)`
fn foo(x) { //~ ERROR expected one of `:` or `@`, found `)`
}
2 changes: 1 addition & 1 deletion src/test/parse-fail/removed-syntax-larrow-init.rs
Expand Up @@ -11,5 +11,5 @@
fn removed_moves() {
let mut x = 0;
let y <- x;
//~^ ERROR expected one of `!`, `:`, `;`, `=`, or `@`, found `<-`
//~^ ERROR expected one of `:`, `;`, `=`, or `@`, found `<-`
}
Expand Up @@ -14,7 +14,7 @@ struct Foo {

fn main() {
match Foo {
x: 3 //~ ERROR expected one of `!`, `=>`, `@`, `if`, or `|`, found `:`
x: 3 //~ ERROR expected one of `=>`, `@`, `if`, or `|`, found `:`
} {
Foo {
x: x
Expand Down

0 comments on commit 35c1bdb

Please sign in to comment.