archives

« Bugzilla Issues Index

#4009 — nonterminal name "InputElementDiv"


In ES5, the nonterminal name "InputElementDiv" made sense, because the thing that made it distinct from the only other lexical goal symbol (InputElementRegExp) was that it derived DivPunctuator.

In ES6, that's no longer the case, since InputElementTemplateTail also derives DivPunctuator.

There isn't a clearly good name to replace it with though. If the other InputElement* are named for whether they derive RegExp and/or TemplateTail,
then this would be "InputElementNeither", which looks odd.

"InputElementOther"?

"InputElementDefault"?

-----

(A more radical approach would be to rename all the InputElement*, naming each according to how it handles
(a) solidus
(i.e., whether it derives RegularExpressionLiteral or DivPunctuator),
and
(b) right brace
(i.e., whether it derives TemplateSubstitutionTail or RightBracePunctuator)
but I'm doubtful that this is a good idea.)


Or, to proceed from the latter suggestion, you could define the single nonterminal "InputElement" with two parameters RE and TT:

InputElement[RE, TT]:
WhiteSpace
LineTerminator
Comment
Token
[~RE]DivPunctuator
[+RE]RegularExpressionLiteral
[~TT]RightBracePunctuator
[+TT]TemplateSubstitutionTail

This has the advantages of
(1) compactness and
(2) highlighting the differences between the variants of InputElement.


I kind of like the parameterized approach, but I don't want to try to rewrite the accompanying explanatory material now.

So, I'm deferring this one to ES7