Auto merge of #16786 - pksunkara:improve-readability, r=lnicola

internal: Improve readability of the parser code

The code is basically equivalent to the previous version, but it improves the readability by making it much more simpler and concise.
This commit is contained in:
bors 2024-03-08 12:21:18 +00:00
commit 2b7b44bf27
10 changed files with 38 additions and 63 deletions

View file

@ -416,14 +416,12 @@ fn delimited(
if !parser(p) {
break;
}
if !p.at(delim) {
if !p.eat(delim) {
if p.at_ts(first_set) {
p.error(format!("expected {:?}", delim));
} else {
break;
}
} else {
p.bump(delim);
}
}
p.expect(ket);