dlang-community / Pegged

A Parsing Expression Grammar (PEG) module, using the D programming language.
534 stars 66 forks source link

Recognize keyword-starting identifier correctly #307

Closed Bolpat closed 2 years ago

Bolpat commented 2 years ago

Identifiers can start with a keyword, e.g. fortune starts with for. Because IdentPattern did not allow for digits, valid identifiers like auto0 were rejected. A question not addressed by this is that all identifiers starting with __ or _ and uppercase are reserved.