Skip to content

Commit a86233c

Browse files
committed
Editorial: Eliminate order-disambiguation from Annex B Pattern-grammar
1 parent 80efe41 commit a86233c

1 file changed

Lines changed: 19 additions & 12 deletions

File tree

spec.html

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ <h1>Grammar Notation</h1>
715715
`9`
716716
</emu-grammar>
717717
<p>If the phrase &ldquo;[empty]&rdquo; appears as the right-hand side of a production, it indicates that the production's right-hand side contains no terminals or nonterminals.</p>
718-
<p>If the phrase &ldquo;[lookahead = _seq_]&rdquo; appears in the right-hand side of a production, it indicates that the production may only be used if the token sequence _seq_ is a prefix of the immediately following input token sequence. Similarly, &ldquo;[lookahead &isin; _set_]&rdquo;, where _set_ is a finite nonempty set of token sequences, indicates that the production may only be used if some element of _set_ is a prefix of the immediately following token sequence. For convenience, the set can also be written as a nonterminal, in which case it represents the set of all token sequences to which that nonterminal could expand. It is considered an editorial error if the nonterminal could expand to infinitely many distinct token sequences.</p>
718+
<p>If the phrase &ldquo;[lookahead = _seq_]&rdquo; appears in the right-hand side of a production, it indicates that the production may only be used if the token sequence _seq_ is a prefix of the immediately following input token sequence. Similarly, &ldquo;[lookahead &isin; _set_]&rdquo;, where _set_ is a finite nonempty set of token sequences, indicates that the production may only be used if some element of _set_ is a prefix of the immediately following token sequence. For convenience, the set can also be written as a nonterminal, in which case it represents the set of all token sequences to which that nonterminal could expand. It is considered an editorial error if the nonterminal could expand to infinitely many distinct token sequences. [Need to loosen these restrictions for some of the productions in <emu-xref href="#sec-regular-expressions-patterns"></emu-xref>: maybe allow specification of _set_ via sentential form (not just a nonterminal), and allow infinite-but-regular sets.]</p>
719719
<p>These conditions may be negated. &ldquo;[lookahead &ne; _seq_]&rdquo; indicates that the containing production may only be used if _seq_ is <em>not</em> a prefix of the immediately following input token sequence, and &ldquo;[lookahead &notin; _set_]&rdquo; indicates that the production may only be used if <em>no</em> element of _set_ is a prefix of the immediately following token sequence.</p>
720720
<p>As an example, given the definitions:</p>
721721
<emu-grammar type="definition" example>
@@ -41752,7 +41752,7 @@ <h2>Syntax</h2>
4175241752

4175341753
<emu-annex id="sec-regular-expressions-patterns">
4175441754
<h1>Regular Expressions Patterns</h1>
41755-
<p>The syntax of <emu-xref href="#sec-patterns"></emu-xref> is modified and extended as follows. These changes introduce ambiguities that are broken by the ordering of grammar productions and by contextual information. When parsing using the following grammar, each alternative is considered only if previous production alternatives do not match.</p>
41755+
<p>The syntax of <emu-xref href="#sec-patterns"></emu-xref> is modified and extended as follows.</p>
4175641756
<p>This alternative pattern grammar and semantics only changes the syntax and semantics of BMP patterns. The following grammar extensions include productions parameterized with the [U] parameter. However, none of these extensions change the syntax of Unicode patterns recognized when parsing with the [U] parameter present on the goal symbol.</p>
4175741757
<h2>Syntax</h2>
4175841758
<emu-grammar type="definition">
@@ -41782,13 +41782,13 @@ <h2>Syntax</h2>
4178241782

4178341783
ExtendedAtom[N] ::
4178441784
`.`
41785-
`\` AtomEscape[~U, ?N]
41786-
`\` [lookahead == `c`]
41785+
`\` [lookahead &lt;! {`b`, `B`}] AtomEscape[~U, ?N]
41786+
`\` [lookahead == `c`] [lookahead &lt;! `c` ControlLetter]
4178741787
CharacterClass[~U]
4178841788
`(` Disjunction[~U, ?N] `)`
4178941789
`(` `?` `:` Disjunction[~U, ?N] `)`
4179041790
InvalidBracedQuantifier
41791-
ExtendedPatternCharacter
41791+
[lookahead &lt;! InvalidBracedQuantifier] ExtendedPatternCharacter
4179241792

4179341793
InvalidBracedQuantifier ::
4179441794
`{` DecimalDigits[~Sep] `}`
@@ -41800,40 +41800,47 @@ <h2>Syntax</h2>
4180041800

4180141801
AtomEscape[U, N] ::
4180241802
[+U] DecimalEscape
41803-
[~U] DecimalEscape [> but only if the CapturingGroupNumber of |DecimalEscape| is &le; _NcapturingParens_]
41803+
[~U] ConstrainedDecimalEscape
4180441804
CharacterClassEscape[?U]
41805-
CharacterEscape[?U, ?N]
41805+
[+U] CharacterEscape[?U, ?N]
41806+
[~U] [lookahead &lt;! ConstrainedDecimalEscape] CharacterEscape[?U, ?N]
4180641807
[+N] `k` GroupName[?U]
4180741808

41809+
ConstrainedDecimalEscape ::
41810+
DecimalEscape [> but only if the CapturingGroupNumber of |DecimalEscape| is &le; _NcapturingParens_]
41811+
4180841812
CharacterEscape[U, N] ::
4180941813
ControlEscape
4181041814
`c` ControlLetter
4181141815
`0` [lookahead &lt;! DecimalDigit]
4181241816
HexEscapeSequence
4181341817
RegExpUnicodeEscapeSequence[?U]
4181441818
[~U] LegacyOctalEscapeSequence
41815-
IdentityEscape[?U, ?N]
41819+
[lookahead &lt;! HexEscapeSequence] [lookahead &lt;! RegExpUnicodeEscapeSequence] IdentityEscape[?U, ?N]
4181641820

4181741821
IdentityEscape[U, N] ::
4181841822
[+U] SyntaxCharacter
4181941823
[+U] `/`
4182041824
[~U] SourceCharacterIdentityEscape[?N]
4182141825

4182241826
SourceCharacterIdentityEscape[N] ::
41823-
[~N] SourceCharacter but not `c`
41824-
[+N] SourceCharacter but not one of `c` or `k`
41827+
[~N] SourceCharacter but not one of `0` `1` `2` `3` `4` `5` `6` `7` `c` `f` `n` `r` `t` `v` `d` `s` `w` `D` `S` `W`
41828+
[+N] SourceCharacter but not one of `0` `1` `2` `3` `4` `5` `6` `7` `c` `f` `n` `r` `t` `v` `d` `s` `w` `D` `S` `W` `k`
41829+
`or`
41830+
[~N] SourceCharacter but not one of OctalDigit or ControlEscape or CharacterClassEscape or `c`
41831+
[+N] SourceCharacter but not one of OctalDigit or ControlEscape or CharacterClassEscape or `c` or `k`
4182541832

4182641833
ClassAtomNoDash[U, N] ::
4182741834
SourceCharacter but not one of `\` or `]` or `-`
4182841835
`\` ClassEscape[?U, ?N]
41829-
`\` [lookahead == `c`]
41836+
`\` [lookahead == `c`] [lookahead &lt;! `c` ClassControlLetter] [lookahead &lt;! `c` ControlLetter]
4183041837

4183141838
ClassEscape[U, N] ::
4183241839
`b`
4183341840
[+U] `-`
4183441841
[~U] `c` ClassControlLetter
4183541842
CharacterClassEscape[?U]
41836-
CharacterEscape[?U, ?N]
41843+
[lookahead != `b`] CharacterEscape[?U, ?N]
4183741844

4183841845
ClassControlLetter ::
4183941846
DecimalDigit

0 commit comments

Comments
 (0)