Add closing bracket expectation to sequences, modified appropriate test cases.
This commit is contained in:
parent
df40e61382
commit
c1df62a760
3 changed files with 11 additions and 6 deletions
|
@ -651,7 +651,7 @@ impl<'a> Parser<'a> {
|
|||
Err(err)
|
||||
}
|
||||
} else {
|
||||
self.expect_one_of(unsafe { slice::from_raw_parts(t, 1) }, &[])
|
||||
self.expect_one_of(slice::from_ref(t), &[])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1107,7 +1107,12 @@ impl<'a> Parser<'a> {
|
|||
{
|
||||
let mut first: bool = true;
|
||||
let mut v = vec![];
|
||||
while !kets.contains(&&self.token) {
|
||||
while !kets.iter().any(|k| {
|
||||
match expect {
|
||||
TokenExpectType::Expect => self.check(k),
|
||||
TokenExpectType::NoExpect => self.token == **k,
|
||||
}
|
||||
}) {
|
||||
match self.token {
|
||||
token::CloseDelim(..) | token::Eof => break,
|
||||
_ => {}
|
||||
|
|
|
@ -10,11 +10,11 @@ note: unclosed delimiter
|
|||
LL | callback(path.as_ref(); //~ ERROR expected one of
|
||||
| ^
|
||||
|
||||
error: expected one of `,`, `.`, `?`, or an operator, found `;`
|
||||
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
|
||||
--> $DIR/token-error-correct-3.rs:24:35
|
||||
|
|
||||
LL | callback(path.as_ref(); //~ ERROR expected one of
|
||||
| ^ expected one of `,`, `.`, `?`, or an operator here
|
||||
| ^ expected one of `)`, `,`, `.`, `?`, or an operator here
|
||||
|
||||
error: expected one of `.`, `;`, `?`, `}`, or an operator, found `)`
|
||||
--> $DIR/token-error-correct-3.rs:30:9
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
error: expected one of `,`, `::`, or `as`, found `.`
|
||||
--> $DIR/similar-tokens.rs:17:10
|
||||
|
|
||||
LL | use x::{A. B}; //~ ERROR expected one of `,`, `::`, or `as`, found `.`
|
||||
| ^ expected one of `,`, `::`, or `as` here
|
||||
LL | use x::{A. B}; //~ ERROR expected one of `,`, `::`, `as`, or `}`, found `.`
|
||||
| ^ expected one of `,`, `::`, `as`, or `}` here
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue