tc39 / proposal-hashbang

#! for JS

Home Page:https://tc39.github.io/proposal-hashbang/out.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

editorial tweaks

jmdyck opened this issue · comments

The |InputElementHashbangOrRegExp| is used as the first token of the |Script| and |Module| syntactic grammar contexts.

  • You left out the word "goal".
  • You can't say "the first token" because it might not yield a token.
  • |Script| and |Module| aren't "syntactic grammar contexts".

It should probably be more like:

The |InputElementHashbangOrRegExp| goal is used
to obtain the first input element of a |Script| or |Module|.

or

The |InputElementHashbangOrRegExp| goal is used
at the start of a |Script| or |Module|.

The later sentence:

The InputElementRegExp goal symbol is used in all syntactic grammar contexts where a RegularExpressionLiteral is permitted but neither a TemplateMiddle, nor a TemplateTail is permitted.

is no longer true. After "contexts", you could insert "(other than the start of a |Script| or |Module|)".

BTW, the bulk of this paragraph (everything after the first 2 sentences) would probably be easier to read as a bulleted list.


InputElementHashbangOrRegExp production

All the InputElement* productions start with WhiteSpace | LineTerminator | Comment | CommonToken, and then give the alternatives that are different. So you should probably move the HashbangComment alternative to at least after CommonToken.

Also, since it's only used at the start of a |Script| or |Module|, you could presumably drop the RightBracePunctuator alternative.


There's also a list of the |InputElement*| nonterminals in The Lexical and RegExp Grammars that would need to be updated. (Might be better to change it to not enumerate the nonterminals, e.g. "starting from various goal symbols".)

These all seem like good suggestions for PRs to me. Would you be interested in writing them?

@jmdyck I've updated things, can you double check that it is suitable for your comments?

The main sentence now reads:

The |InputElementHashbangOrRegExp| goal is used as the first input element of a |Script| and |Module|.

You can't say that a nonterminal symbol "is used as" an input element -- they're different kinds of things. I fixed this in my suggested wordings, but I guess I should have stated it explicitly.

Also, "and" should be "or".

Given that the later insertion says "(other than the start of a |Script| or |Module|)", it would probably help readers to use similar wording for this sentence, so I recommend the second of my original two suggestions:

The |InputElementHashbangOrRegExp| goal is used at the start of a |Script| or |Module|.

The other changes look good.

updated

I've filed tc39/ecma262#2816 ; please post further review there.