Closed ghaith closed 3 years ago
I'm changing the scope of the issue to only support the exponents. Supporting all keywords would be a lot of (mostly) useless work and the result might be confusing. At some point, we might want to introduce some strict flags to support only a version of the standard, and we could rethink the issue there.
Is your feature request related to a problem? Please describe. ~Keywords such as CLASS or OVERRIDE are new, and could be used as normal identifiers in some cases (oscat uses an OVERRIDE method)~ We currently cannot define variables with the names
E<Number>
as this pattern is resolved for exponents. We should allow these.Describe the solution you'd like ~As a default strategy, if we are expecting an Identifier at a certain position, then also accept any token that is marked as Keyword (but maybe not those marked as Literal or Operator) and use the slice() as the identifier.~ ~We could probably add a warning about the use of a keyword as an identifier.~ Exponents should also be allowed as identifiers (
E0
), we could solve this on the lexer side and free the "Exxx" pattern for the parser.The following code should parse
Describe alternatives you've considered ~We could require the user to change his code, but I think the proposal above is reasonable~
Additional context ~This affects our recovery strategies.~