Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up parse_bottom_expr to use list parsing utility #63396

Closed
estebank opened this issue Aug 8, 2019 · 1 comment · Fixed by #66994
Closed

Clean up parse_bottom_expr to use list parsing utility #63396

estebank opened this issue Aug 8, 2019 · 1 comment · Fixed by #66994
Labels
A-frontend Area: frontend (errors, parsing and HIR) A-parser Area: The parsing of Rust source code to an AST. C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Aug 8, 2019

From #63337 (comment)

The following code should be using the common list parsing utilities:

while self.token != token::CloseDelim(token::Paren) {
es.push(match self.parse_expr() {
Ok(es) => es,
Err(err) => {
// recover from parse error in tuple list
return Ok(self.recover_seq_parse_error(token::Paren, lo, Err(err)));
}
});
recovered = self.expect_one_of(
&[],
&[token::Comma, token::CloseDelim(token::Paren)],
)?;
if self.eat(&token::Comma) {
trailing_comma = true;
} else {
trailing_comma = false;
break;
}
}

CC @Centril

@estebank estebank added C-cleanup Category: PRs that clean code up or issues documenting cleanup. A-parser Area: The parsing of Rust source code to an AST. labels Aug 8, 2019
@Centril Centril added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-frontend Area: frontend (errors, parsing and HIR) labels Aug 8, 2019
@achan1989
Copy link
Contributor

achan1989 commented Sep 1, 2019

What/where are the common list parsing utilties?
Edit: never mind, I've got it. parse_paren_comma_seq, parse_seq_to_end, etc. for anyone who's wondering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: frontend (errors, parsing and HIR) A-parser Area: The parsing of Rust source code to an AST. C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
3 participants