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

Support ES2023 hashbang grammer #1274

Closed
p-bakker opened this issue Oct 30, 2022 · 4 comments · Fixed by #1417
Closed

Support ES2023 hashbang grammer #1274

p-bakker opened this issue Oct 30, 2022 · 4 comments · Fixed by #1417
Labels
feature Issues considered a new feature
Milestone

Comments

@p-bakker
Copy link
Collaborator

See https://github.com/tc39/proposal-hashbang

@p-bakker p-bakker added the feature Issues considered a new feature label Oct 30, 2022
@p-bakker p-bakker added this to the ES2023 milestone Oct 30, 2022
@CanadaHonk
Copy link

This is already supported for the most part with a few minor test262 edgecase failures. Just fixed 2 in #1341 :)

@tuchida
Copy link
Contributor

tuchida commented Jun 12, 2023

I have two questions.

  1. HashbangComment is supposed to start with #! according to the ECMA262 specification.
    https://tc39.es/ecma262/2023/#sec-hashbang
    However, Rhino only checks #. I thought they were not ES2023 compliant.

    // Support the executable script #! syntax: If
    // the first line begins with a '#', treat the whole
    // line as a comment.
    if (strSrc.length() > 0 && strSrc.charAt(0) == '#') {

  2. The feature of the org.mozilla.javascript.tools.shell.Main class is only enable in shell mode. Should HashbangComment be enabled when using Rhino from Java source code?

@CanadaHonk
Copy link

CanadaHonk commented Jun 12, 2023

Good catch, I didn't spot that on a quick first look. It should check the next char and be copied into the main parser (most likely).

@p-bakker
Copy link
Collaborator Author

p-bakker commented Jul 1, 2023

Agree with @tuchida that Hashbang should also work when using the Rhino engine directly, so not through the Shell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Issues considered a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants