Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

editorial tweaks #13

Closed
jmdyck opened this issue Mar 29, 2019 · 5 comments
Closed

editorial tweaks #13

jmdyck opened this issue Mar 29, 2019 · 5 comments

Comments

@jmdyck
Copy link

jmdyck commented Mar 29, 2019

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".)

@littledan
Copy link
Member

littledan commented Mar 31, 2019

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

bmeck pushed a commit that referenced this issue Aug 5, 2019
@bmeck
Copy link
Member

bmeck commented Aug 5, 2019

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

@jmdyck
Copy link
Author

jmdyck commented Aug 5, 2019

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.

@bmeck
Copy link
Member

bmeck commented Aug 6, 2019

updated

@ljharb
Copy link
Member

ljharb commented Jul 7, 2022

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

@ljharb ljharb closed this as completed Jul 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants