Skip to content

grammar expects regex to not end after a #comment with /x #173

Open
@dannybrian

Description

@dannybrian

The current comment grammar eats up the slash and flags after a comment when using the x flag:

const re = `/
      # A regular expression for date.
      (?<year>\d{4})-    # year part of a date
      (?<month>\d{2})-   # month part of a date
      (?<day>\d{2})      # day part of a date /x`; //  \/\w* shouldn't get eaten

This yields "SyntaxError: Unexpected end of input". See pull request for fix and changed test to match. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions