Skip to content

Grammar for tuple and tuple indexing expressions #263

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

Merged
merged 2 commits into from
Mar 12, 2018

Conversation

brauliobz
Copy link
Contributor

No description provided.

Copy link
Contributor

@matthewjasper matthewjasper left a comment

Choose a reason for hiding this comment

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

Thanks for this. A couple of suggestions.

@@ -22,6 +29,10 @@ comma:

## Tuple indexing expressions

> **<sup>Syntax</sup>**
> _TupleIndexingExpression_ :
> &nbsp;&nbsp; [_Expression_] `.` [INTEGER_LITERAL]
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be TUPLE_INDEX

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. That's correct, but it's like the lexer is aware of context... which is strange. But yeah, the parser is the one that disallows prefixes, suffixes and nonzero numbers beginning in zero.

> &nbsp;&nbsp; &nbsp;&nbsp; `(` `)`
> &nbsp;&nbsp; | `(` [_Expression_] `,` `)`
> &nbsp;&nbsp; | `(` [_Expression_] (`,` [_Expression_] )<sup>\+</sup>
> `,`<sup>?</sup> `)`
Copy link
Contributor

Choose a reason for hiding this comment

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

These two can be merged into `(` [_Expression_] `,` `)` <sup>\+</sup> [_Expression_]<sup>?</sup> `)`

- use the TUPLE_INDEX token
- compacted the TupleExpression
@matthewjasper matthewjasper merged commit a8755cc into rust-lang:master Mar 12, 2018
@matthewjasper
Copy link
Contributor

Thanks again. 💟

@brauliobz brauliobz deleted the tuple_expr_grammar branch March 12, 2018 23:22
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.

2 participants