diff --git a/spec.html b/spec.html index 867d93c24c..4106ec9658 100644 --- a/spec.html +++ b/spec.html @@ -35838,42 +35838,13 @@

Regular Expressions Patterns

Syntax

Term[U] :: - [~U] ExtendedTerm [+U] Assertion[U] [+U] Atom[U] [+U] Atom[U] Quantifier - - ExtendedTerm :: - Assertion - AtomNoBrace Quantifier - Atom - QuantifiableAssertion Quantifier - - AtomNoBrace :: - PatternCharacterNoBrace - `.` - `\` AtomEscape - CharacterClass - `(` Disjunction `)` - `(` `?` `:` Disjunction `)` - - Atom[U] :: - PatternCharacter - `.` - `\` AtomEscape[?U] - CharacterClass[?U] - `(` Disjunction[?U] `)` - `(` `?` `:` Disjunction[?U] `)` - - PatternCharacterNoBrace :: - SourceCharacter but not one of `^` `$` `\` `.` `*` `+` `?` `(` `)` `[` `]` `{` `}` `|` - - PatternCharacter :: - SourceCharacter but not one of `^` `$` `\` `.` `*` `+` `?` `(` `)` `[` `]` `|` - - QuantifiableAssertion :: - `(` `?` `=` Disjunction `)` - `(` `?` `!` Disjunction `)` + [~U] QuantifiableAssertion Quantifier + [~U] Assertion + [~U] ExtendedAtom Quantifier + [~U] ExtendedAtom Assertion[U] :: `^` @@ -35884,6 +35855,27 @@

Syntax

[+U] `(` `?` `!` Disjunction[U] `)` [~U] QuantifiableAssertion + QuantifiableAssertion :: + `(` `?` `=` Disjunction `)` + `(` `?` `!` Disjunction `)` + + ExtendedAtom :: + `.` + `\` AtomEscape + CharacterClass + `(` Disjunction `)` + `(` `?` `:` Disjunction `)` + InvalidBracedQuantifier + ExtendedPatternCharacter + + InvalidBracedQuantifier :: + `{` DecimalDigits `}` + `{` DecimalDigits `,` `}` + `{` DecimalDigits `,` DecimalDigits `}` + + ExtendedPatternCharacter :: + SourceCharacter but not one of `^` `$` `.` `*` `+` `?` `(` `)` `[` `|` + AtomEscape[U] :: [+U] DecimalEscape [+U] CharacterEscape[U] @@ -35922,27 +35914,31 @@

Syntax

ClassAtomNoDash[?U] ClassAtomNoDash[U] :: - SourceCharacter but not one of `\` or `]` or `-` `\` ClassEscape[?U] + SourceCharacter but not one of `\` or `]` or `-` ClassAtomInRange :: `-` ClassAtomNoDashInRange ClassAtomNoDashInRange :: + `\` ClassEscape SourceCharacter but not one of `\` or `]` or `-` - `\` ClassEscape but only if ClassEscape evaluates to a CharSet with exactly one character - `\` IdentityEscape ClassEscape[U] :: + `b` [+U] DecimalEscape [+U] CharacterEscape[U] [+U] CharacterClassEscape [+U] `-` - [~U] DecimalEscape - `b` + [~U] DecimalEscape but only if the integer value of DecimalEscape is 0 [~U] CharacterClassEscape + [~U] `c` ClassControlLetter [~U] CharacterEscape + + ClassControlLetter :: + DecimalDigit + `_`

When the same left hand sides occurs with both [+U] and [\~U] guards it is to control the disambiguation priority.

@@ -35952,25 +35948,88 @@

Syntax

Pattern Semantics

The semantics of is extended as follows:

-

Within reference to “Atom :: `(` Disjunction `)` ” are to be interpreted as meaning “Atom :: `(` Disjunction `)` ” or “AtomNoBrace :: `(` Disjunction `)` ”.

-

Term () includes the following additional evaluation rule:

+

Within reference to “Atom :: `(` Disjunction `)` ” are to be interpreted as meaning “Atom :: `(` Disjunction `)` ” or “ExtendedAtom :: `(` Disjunction `)` ”.

+ +

Term () includes the following additional evaluation rules:

The production Term :: QuantifiableAssertion Quantifier evaluates the same as the production Term :: Atom Quantifier but with |QuantifiableAssertion| substituted for |Atom|.

-

Atom () evaluation rules for the |Atom| productions except for Atom :: PatternCharacter are also used for the |AtomNoBrace| productions, but with |AtomNoBrace| substituted for |Atom|. The following evaluation rule is also added:

-

The production AtomNoBrace :: PatternCharacterNoBrace evaluates as follows:

+

The production Term :: ExtendedAtom Quantifier evaluates the same as the production Term :: Atom Quantifier but with |ExtendedAtom| substituted for |Atom|.

+

The production Term :: ExtendedAtom evaluates the same as the production Term :: Atom but with |ExtendedAtom| substituted for |Atom|.

+ +

Assertion () includes the following additional evaluation rule:

+

The production Assertion :: QuantifiableAssertion evaluates by evaluating |QuantifiableAssertion| to obtain a Matcher and returning that Matcher.

+ +

Assertion () evaluation rules for the Assertion :: `(` `?` `=` Disjunction `)` and Assertion :: `(` `?` `!` Disjunction `)` productions are also used for the |QuantifiableAssertion| productions, but with |QuantifiableAssertion| substituted for |Assertion|.

+ +

Atom () evaluation rules for the |Atom| productions except for Atom :: PatternCharacter are also used for the |ExtendedAtom| productions, but with |ExtendedAtom| substituted for |Atom|. The following evaluation rules are also added:

+

The production ExtendedAtom :: InvalidBracedQuantifier evaluates as follows:

+ + 1. Throw a *SyntaxError* exception. + +

The production ExtendedAtom :: ExtendedPatternCharacter evaluates as follows:

- 1. Let _ch_ be the character represented by |PatternCharacterNoBrace|. + 1. Let _ch_ be the character represented by |ExtendedPatternCharacter|. 1. Let _A_ be a one-element CharSet containing the character _ch_. 1. Call CharacterSetMatcher(_A_, *false*) and return its Matcher result. +

CharacterEscape () includes the following additional evaluation rule:

The production CharacterEscape :: LegacyOctalEscapeSequence evaluates by evaluating the SV of the |LegacyOctalEscapeSequence| (see ) and returning its character result.

+ +

NonemptyClassRanges () includes the following additional evaluation rule:

+

The production NonemptyClassRanges :: ClassAtomInRange `-` ClassAtomInRange ClassRanges evaluates as follows:

+ + 1. Evaluate the first |ClassAtomInRange| to obtain a CharSet _A_. + 1. Evaluate the second |ClassAtomInRange| to obtain a CharSet _B_. + 1. Evaluate |ClassRanges| to obtain a CharSet _C_. + 1. Call CharacterRangeOrUnion(_A_, _B_) and let _D_ be the resulting CharSet. + 1. Return the union of CharSets _D_ and _C_. + + +

NonemptyClassRangesNoDash () includes the following additional evaluation rule:

+

The production NonemptyClassRangesNoDash :: ClassAtomNoDashInRange `-` ClassAtomInRange ClassRanges evaluates as follows:

+ + 1. Evaluate |ClassAtomNoDashInRange| to obtain a CharSet _A_. + 1. Evaluate |ClassAtomInRange| to obtain a CharSet _B_. + 1. Evaluate |ClassRanges| to obtain a CharSet _C_. + 1. Call CharacterRangeOrUnion(_A_, _B_) and let _D_ be the resulting CharSet. + 1. Return the union of CharSets _D_ and _C_. + +

ClassAtom () includes the following additional evaluation rules:

The production ClassAtomInRange :: `-` evaluates by returning the CharSet containing the one character `-`.

The production ClassAtomInRange :: ClassAtomNoDashInRange evaluates by evaluating |ClassAtomNoDashInRange| to obtain a CharSet and returning that CharSet.

+

ClassAtomNoDash () includes the following additional evaluation rules:

-

The production ClassAtomNoDashInRange :: SourceCharacter but not one of `\` or `]` or `-` evaluates by returning a one-element CharSet containing the character represented by |SourceCharacter|.

-

The production ClassAtomNoDashInRange :: `\` ClassEscape but only if…, evaluates by evaluating |ClassEscape| to obtain a CharSet and returning that CharSet.

-

The production ClassAtomNoDashInRange :: `\` IdentityEscape evaluates by returning the character represented by |IdentityEscape|.

+

The production ClassAtomNoDash :: SourceCharacter but not one of `]` or `-` evaluates by returning a one-element CharSet containing the character represented by |SourceCharacter|.

+

The production ClassAtomNoDashInRange :: `\` ClassEscape evaluates by evaluating |ClassEscape| to obtain a CharSet and returning that CharSet.

+

The production ClassAtomNoDashInRange :: SourceCharacter but not one of `]` or `-` evaluates by returning a one-element CharSet containing the character represented by |SourceCharacter|.

+ +

ClassEscape () includes the following additional evaluation rules:

+

The production ClassEscape :: DecimalEscape but only if … evaluates as follows:

+ + 1. Evaluate |DecimalEscape| to obtain an EscapeValue _E_. + 1. Assert: _E_ is a character. + 1. Let _ch_ be _E_'s character. + 1. Return the one-element CharSet containing the character _ch_. + +

The production ClassEscape :: `c` ClassControlLetter evaluates as follows:

+ + 1. Let _ch_ be the character matched by |ClassControlLetter|. + 1. Let _i_ be _ch_'s character value. + 1. Let _j_ be the remainder of dividing _i_ by 32. + 1. Return the character whose character value is _j_. + + + +

Runtime Semantics: CharacterRangeOrUnion Abstract Operation

+

The abstract operation CharacterRangeOrUnion takes two CharSet parameters _A_ and _B_ and performs the following steps:

+ + 1. If _A_ does not contain exactly one character or _B_ does not contain exactly one character, then + 1. Let _C_ be the CharSet containing the single character - U+002D (HYPEN-MINUS). + 1. Return the union of CharSets _A_, _B_ and _C_. + 1. Return CharacterRange(_A_, _B_). + +