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

Loops grammar #139

Merged
merged 3 commits into from
Dec 1, 2017
Merged

Loops grammar #139

merged 3 commits into from
Dec 1, 2017

Conversation

brauliobz
Copy link
Contributor

Part of #84.

A `while let` loop is semantically similar to a `while` loop but in place of a
condition expression it expects the keyword `let` followed by a refutable
pattern, an `=` and an expression. If the value of the expression on the right
pattern, an `=` and a block expression. If the value of the expression on the right
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...an =, an expression and a block expression.

@@ -44,10 +67,15 @@ while i < 10 {

## `while let` loops

> **<sup>Syntax</sup>**
> [_WhileLetExpression_] :
> &nbsp;&nbsp; `while` `let` _Pattern_ `=` [_Expression_]<sub>except struct expression</sub>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of the other loop expressions are named after what they do. So shouldn't this one be called PredicatePatternLoopExpression?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -61,6 +89,11 @@ while let Some(y) = x.pop() {

## Iterator loops

> **<sup>Syntax</sup>**
> _IteratorLoopExpression_ :
> &nbsp;&nbsp; `for` _Pattern_ `in` [_Expression_]<sub>except struct expression</sub>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like if, we probably want to link to struct expressions here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still deciding how I'll do this (the "no struct expression" thing) to make it clear. But yeah, I agree a link to it will be needed.

@Havvy Havvy merged commit bbec462 into rust-lang:master Dec 1, 2017
@Havvy
Copy link
Contributor

Havvy commented Dec 1, 2017

💟 Thanks!

@brauliobz brauliobz deleted the grammar_loop_expr branch January 5, 2018 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants