Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Handle IDENT restrictions #39

Open
ehuss opened this issue Jun 28, 2019 · 0 comments
Open

Handle IDENT restrictions #39

ehuss opened this issue Jun 28, 2019 · 0 comments
Labels
ambiguity Potential sources of ambiguity grammar Issues with the definition of the rust grammar lexer Issues with the lexer restrictions Issues related to the permissiveness of the grammar

Comments

@ehuss
Copy link
Contributor

ehuss commented Jun 28, 2019

Currently the grammar allows restricted identifiers in IDENT. However, libsyntax does not. parse_ident_common

The following are examples rejected by libsyntax:

mod _ {}
mod as {}
mod abstract {}
mod self {}

The restriction should include all strong and reserved keywords, and _.

_ is special, it is allowed in a few places:

Where Example
const item const _: i32 = 0;
extern crate as alias extern crate c as _;
use aliases use x as _;
extern block function parameter names extern { fn f(_: i32); }
function pointer type fn(_: i32)

self is allowed for extern crate self as foo;

Paths allow several keywords: super, self, Self, and crate.

@ehuss ehuss added lexer Issues with the lexer grammar Issues with the definition of the rust grammar labels Jun 28, 2019
@eddyb eddyb added restrictions Issues related to the permissiveness of the grammar ambiguity Potential sources of ambiguity and removed restrictions Issues related to the permissiveness of the grammar labels Jul 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ambiguity Potential sources of ambiguity grammar Issues with the definition of the rust grammar lexer Issues with the lexer restrictions Issues related to the permissiveness of the grammar
Projects
None yet
Development

No branches or pull requests

2 participants