I am curious about this lexical production, because if I understand correctly, it seems to imply either backtracking or a lookahead that isn’t made explicit.
``` MultiLineComment :: /* MultiLineCommentChars[opt] */ MultiLineCommentChars :: MultiLineNotAsteriskChar MultiLineCommentChars[opt] * PostAsteriskCommentChars[opt] PostAsteriskCommentChars :: MultiLineNotForwardSlashOrAsteriskChar MultiLineCommentChars[opt] * PostAsteriskCommentChars[opt] MultiLineNotAsteriskChar :: SourceCharacterbut not * MultiLineNotForwardSlashOrAsteriskChar :: SourceCharacterbut not one of / or * ``` In the second choices within PostAsteriskCommentChars and MultiLineCommentChars, the appearance of PostAsteriskCommentChars following the literal asterisk is optional. Because of this, a naive match will be made for PostAsteriskCommentChars against the `*` of a terminal `*/` of the MultiLineComment. While this is not ultimately ambiguous because, having made that match, the next attempt will fail and we can backtrack one step to find another way out; or, more realistically, an implementation would look ahead at whether the next character (after "*") is `/` before deciding that PostAsteriskCommentChars/2 should _really_ be matched. However it seems unusual that the grammar is written this way since elsewhere the grammar seems to carefully avoid implied backtracking, and lookaheads are rare and explicit. This section of the lexical grammar has remained unchanged since ES1, so it may be that it just hasn’t been revisited as the grammar specification style developed. Am I reading it correctly and, if so, is it actually unusual, or does this sort of thing fall within the boundaries of how the grammar is normally described?
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

