Skip to content
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

jsparser: 3in should be an error #83

Open
masnagam opened this issue Jan 22, 2024 · 1 comment
Open

jsparser: 3in should be an error #83

masnagam opened this issue Jan 22, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@masnagam
Copy link
Member

The specification said in 12.9.3 Numeric Literals:

The SourceCharacter immediately following a NumericLiteral must not be an IdentifierStart or DecimalDigit.

This cannot be handled with the following modified production rules using a lookahead term:

NumericLiteral ::
  MaybeNumericLiteral [lookahead ∉ IdentifierStart]

MaybeNumericLiteral ::
  DecimalLiteral
  DecimalBigIntegerLiteral
  NonDecimalIntegerLiteral[+Sep]
  NonDecimalIntegerLiteral[+Sep] BigIntLiteralSuffix
  LegacyOctalIntegerLiteral

Initially, we tried solving this issue in this way, but an infinite loop occurs when computing the number of lookahead characters needed. Because:

CodePoint ::
  HexDigits[~Sep] [> but only if MV of |HexDigits| ≤ 0x10FFFF]

IdentifierStart is defined with CodePoint and CodePoint can take any number of characters.

Probably, this is the reason why the specification does not use the production rules like above.

@masnagam
Copy link
Member Author

Another issue is regarding Unicode ID_Start property.

Currently, dfagen cannot process the Unicode ID_Start property. We replace it used in the lexical grammar with ASCII ID_Start by transpile.js. As a result, the geneerated automaton cannot work with Non-ASCII ID_Start (and ID_Continue). So, we need additional error handling in the lexer implementation. But this error handling does not work properly for lookahead transitions.

@masnagam masnagam added the bug Something isn't working label Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant