-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
suffix "opt" are missing in one line grammar (ex. 13.7.4.5) #908
Comments
Another example for Note2In 13.3.3.2 Static Semantics: ContainsExpression
Here you can insert 'opt' suffix after 'Initializer' without any formal contradiction on the spec, but it produces an unexpected specification. |
jmdyck
added a commit
to jmdyck/ecmarkup
that referenced
this issue
Dec 17, 2019
In practice, an `<emu-mods>` contains an `<emu-params>` and/or an `<emu-opt>`. My guess is that this rule was introduced with only `<emu-params>` in mind, as there are situations in which you might reasonably want to suppress the display of `<emu-params>`, but you should never suppress an `<emu-opt>`. --- An alternative to removing the rule (and, if my above guess is correct, a solution that would be more in line with the original intent) would be to change its selector from: `emu-production[collapsed] emu-mods` to: `emu-production[collapsed] emu-params` I.e., in a collapsed production, suppress the display of *only* the grammatical parameters (GPs). However, I didn't propose that solution because it's incomplete in 3 ways: - It doesn't suppress GPs in all contexts where we want to suppress them. (Generally we want to suppress GPs in any non-defining production, which includes all the collapsed production, but also includes lots of non-collapsed productions.) - It doesn't suppress all the annotations we typically want to suppress (e.g. lookahead restrictions and no-LineTerminator-here annotations) because those don't occur in `<emu-mods>`. - It doesn't allow for the rare cases where we *don't* want to suppress GPs (and annotations). Instead (in ecma262 at least), we explicitly remove unnecessary GPs and annotations from all productions where we don't want them to appear. (Note that this also has the benefit of making the source easier to read.) So even with the suggested modification, the rule would be basically pointless. Better to just delete it. --- This resolves issue tc39#108, and also: - tc39/ecma262#536 - tc39/ecma262#908 - tc39/ecma262#1139 - tc39/ecma262#1663
ljharb
pushed a commit
to jmdyck/ecmarkup
that referenced
this issue
Jan 17, 2020
In practice, an `<emu-mods>` contains an `<emu-params>` and/or an `<emu-opt>`. My guess is that this rule was introduced with only `<emu-params>` in mind, as there are situations in which you might reasonably want to suppress the display of `<emu-params>`, but you should never suppress an `<emu-opt>`. --- An alternative to removing the rule (and, if my above guess is correct, a solution that would be more in line with the original intent) would be to change its selector from: `emu-production[collapsed] emu-mods` to: `emu-production[collapsed] emu-params` I.e., in a collapsed production, suppress the display of *only* the grammatical parameters (GPs). However, I didn't propose that solution because it's incomplete in 3 ways: - It doesn't suppress GPs in all contexts where we want to suppress them. (Generally we want to suppress GPs in any non-defining production, which includes all the collapsed production, but also includes lots of non-collapsed productions.) - It doesn't suppress all the annotations we typically want to suppress (e.g. lookahead restrictions and no-LineTerminator-here annotations) because those don't occur in `<emu-mods>`. - It doesn't allow for the rare cases where we *don't* want to suppress GPs (and annotations). Instead (in ecma262 at least), we explicitly remove unnecessary GPs and annotations from all productions where we don't want them to appear. (Note that this also has the benefit of making the source easier to read.) So even with the suggested modification, the rule would be basically pointless. Better to just delete it. --- This resolves issue tc39#108, and also: - tc39/ecma262#536 - tc39/ecma262#908 - tc39/ecma262#1139 - tc39/ecma262#1663
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Summary
For example, in 13.7.4.5
current draft and ES7 displays one line grammar as
If it is read literally, it does not define anything on the following grammar.
This is not what we intend.
On the other hand, ES6 displays:
This is more comprehensive because "opt" is expanded as shown in "5.1.5 Grammar Notation".
NOTE1: How are "opt" suffixes dropped ?
Actually, in the raw html document, these Expressions are given opt suffix,
but they are not displayed because of "ecmarkup.css" line 249:
Here "collapsed" attributes on "emu-production" are given in the build process.
Precisely, they are given in grammarkdown/out/lib/emitter/ecmarkup.js line 36:
where grammarkdown is a npm module called from ecmarkup build tool.
By the way, opt suffixes are DISPLAYED in multiline grammars (ex. 13.7.4.4)
because node.body.kind === tokens_1.SyntaxKind.RightHandSideList.
Anyway, I think the specification contents must be self-contained except for its displaying formats (fonts, etc). Outside format tools must not change the specification contents.
Note2
You can not say "opt suffix is automatically inserted when the corresponding Syntax has it."
because expanded grammars may be referred separately.
For example, In 13.3.2.4
Here we can not insert opt suffix after Initializer
although the corresponding Syntax has it.
The text was updated successfully, but these errors were encountered: