Skip to content

Follow token checking is too restrictive. #21545

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

Closed
vadimcn opened this issue Jan 23, 2015 · 4 comments
Closed

Follow token checking is too restrictive. #21545

vadimcn opened this issue Jan 23, 2015 · 4 comments
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)

Comments

@vadimcn
Copy link
Contributor

vadimcn commented Jan 23, 2015

macro_rules! foo {
    ( $x:ident $(: $y:ident )* ) => ( $x $(: $y )* )
}
<anon>:2:16: 2:30 error: `$x:ident` is followed by a sequence repetition, which is not allowed for `ident` fragments
<anon>:2     ( $x:ident $(: $y:ident )* ) => ( $x $(: $y )* )

The RFC says that ident may be followed by any token, so why repetition of any tokens would be invalid?

@vadimcn
Copy link
Contributor Author

vadimcn commented Jan 23, 2015

cc @cmr

@emberian
Copy link
Member

The follow sets are only for real tokens, not complex NTs. To extend this properly, the algorithm will need to compute the FIRST of the following token to ensure that it is a subset of the FOLLOW set for that token.

@kmcallister kmcallister added the A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) label Jan 23, 2015
@vadimcn
Copy link
Contributor Author

vadimcn commented Jan 24, 2015

Created PR to amend the RFC.

@steveklabnik
Copy link
Member

Traige: the RFC was pursued, so closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
Projects
None yet
Development

No branches or pull requests

4 participants