Skip to content

Feature request: Support (optional) bigint during parsing #95

Open
@neko-para

Description

@neko-para

Currently, number literal will be parsed by the following code:

case SyntaxKind.NumericLiteral:
const tokenValue = _scanner.getTokenValue();
let value = Number(tokenValue);
if (isNaN(value)) {

It would be better to add a feature that allow detecting the number and parsing it with BigInt, like:

// -9007199254740991 ~ 9007199254740991
// More precise checking could be used, here's only a demo
if (/^-?\d{16,}$/.test(tokenValue)) {
  value = BigInt(tokenValue)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions