The abstract operation EscapeRegExpPattern takes arguments _P_ and _F_. It performs the following steps when called:
Regular Expressions Patterns
The syntax of 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.
- 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.
+ This alternative pattern grammar and semantics only changes the syntax and semantics of BMP patterns. The following grammar extensions include productions parameterized with the [UnicodeFlag] parameter. However, none of these extensions change the syntax of Unicode patterns recognized when parsing with the [UnicodeFlag] parameter present on the goal symbol.
Syntax
Term[U, N] ::
- [+U] Assertion[+U, ?N]
- [+U] Atom[+U, ?N] Quantifier
- [+U] Atom[+U, ?N]
- [~U] QuantifiableAssertion[?N] Quantifier
- [~U] Assertion[~U, ?N]
- [~U] ExtendedAtom[?N] Quantifier
- [~U] ExtendedAtom[?N]
+ [+UnicodeFlag] Assertion[+UnicodeFlag, ?N]
+ [+UnicodeFlag] Atom[+UnicodeFlag, ?N] Quantifier
+ [+UnicodeFlag] Atom[+UnicodeFlag, ?N]
+ [~UnicodeFlag] QuantifiableAssertion[?N] Quantifier
+ [~UnicodeFlag] Assertion[~UnicodeFlag, ?N]
+ [~UnicodeFlag] ExtendedAtom[?N] Quantifier
+ [~UnicodeFlag] ExtendedAtom[?N]
Assertion[U, N] ::
`^`
`$`
`\` `b`
`\` `B`
- [+U] `(` `?` `=` Disjunction[+U, ?N] `)`
- [+U] `(` `?` `!` Disjunction[+U, ?N] `)`
- [~U] QuantifiableAssertion[?N]
+ [+UnicodeFlag] `(` `?` `=` Disjunction[+UnicodeFlag, ?N] `)`
+ [+UnicodeFlag] `(` `?` `!` Disjunction[+UnicodeFlag, ?N] `)`
+ [~UnicodeFlag] QuantifiableAssertion[?N]
`(` `?` `<=` Disjunction[?U, ?N] `)`
`(` `?` `<!` Disjunction[?U, ?N] `)`
QuantifiableAssertion[N] ::
- `(` `?` `=` Disjunction[~U, ?N] `)`
- `(` `?` `!` Disjunction[~U, ?N] `)`
+ `(` `?` `=` Disjunction[~UnicodeFlag, ?N] `)`
+ `(` `?` `!` Disjunction[~UnicodeFlag, ?N] `)`
ExtendedAtom[N] ::
`.`
- `\` AtomEscape[~U, ?N]
+ `\` AtomEscape[~UnicodeFlag, ?N]
`\` [lookahead == `c`]
- CharacterClass[~U]
- `(` Disjunction[~U, ?N] `)`
- `(` `?` `:` Disjunction[~U, ?N] `)`
+ CharacterClass[~UnicodeFlag]
+ `(` Disjunction[~UnicodeFlag, ?N] `)`
+ `(` `?` `:` Disjunction[~UnicodeFlag, ?N] `)`
InvalidBracedQuantifier
ExtendedPatternCharacter
@@ -41961,25 +41961,25 @@ Syntax
SourceCharacter but not one of `^` `$` `\` `.` `*` `+` `?` `(` `)` `[` `|`
AtomEscape[U, N] ::
- [+U] DecimalEscape
- [~U] DecimalEscape [> but only if the CapturingGroupNumber of |DecimalEscape| is ≤ _NcapturingParens_]
- CharacterClassEscape[?U]
+ [+UnicodeFlag] DecimalEscape
+ [~UnicodeFlag] DecimalEscape [> but only if the CapturingGroupNumber of |DecimalEscape| is ≤ _NcapturingParens_]
+ CharacterClassEscape[?UnicodeFlag]
CharacterEscape[?U, ?N]
- [+N] `k` GroupName[?U]
+ [+N] `k` GroupName[?UnicodeFlag]
CharacterEscape[U, N] ::
ControlEscape
`c` ControlLetter
`0` [lookahead <! DecimalDigit]
HexEscapeSequence
- RegExpUnicodeEscapeSequence[?U]
- [~U] LegacyOctalEscapeSequence
+ RegExpUnicodeEscapeSequence[?UnicodeFlag]
+ [~UnicodeFlag] LegacyOctalEscapeSequence
IdentityEscape[?U, ?N]
IdentityEscape[U, N] ::
- [+U] SyntaxCharacter
- [+U] `/`
- [~U] SourceCharacterIdentityEscape[?N]
+ [+UnicodeFlag] SyntaxCharacter
+ [+UnicodeFlag] `/`
+ [~UnicodeFlag] SourceCharacterIdentityEscape[?N]
SourceCharacterIdentityEscape[N] ::
[~N] SourceCharacter but not `c`
@@ -41992,9 +41992,9 @@ Syntax
ClassEscape[U, N] ::
`b`
- [+U] `-`
- [~U] `c` ClassControlLetter
- CharacterClassEscape[?U]
+ [+UnicodeFlag] `-`
+ [~UnicodeFlag] `c` ClassControlLetter
+ CharacterClassEscape[?UnicodeFlag]
CharacterEscape[?U, ?N]
ClassControlLetter ::
@@ -42002,7 +42002,7 @@ Syntax
`_`
- When the same left hand sides occurs with both [+U] and [\~U] guards it is to control the disambiguation priority.
+ When the same left hand sides occurs with both [+UnicodeFlag] and [\~U] guards it is to control the disambiguation priority.
@@ -42018,7 +42018,7 @@ Static Semantics: Early Errors
NonemptyClassRanges :: ClassAtom `-` ClassAtom ClassRanges
-
- It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *true* or IsCharacterClass of the second |ClassAtom| is *true* and this production has a [U] parameter.
+ It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *true* or IsCharacterClass of the second |ClassAtom| is *true* and this production has a [UnicodeFlag] parameter.
-
It is a Syntax Error if IsCharacterClass of the first |ClassAtom| is *false* and IsCharacterClass of the second |ClassAtom| is *false* and the CharacterValue of the first |ClassAtom| is larger than the CharacterValue of the second |ClassAtom|.
@@ -42027,7 +42027,7 @@
Static Semantics: Early Errors
NonemptyClassRangesNoDash :: ClassAtomNoDash `-` ClassAtom ClassRanges
-
- It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *true* or IsCharacterClass of |ClassAtom| is *true* and this production has a [U] parameter.
+ It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *true* or IsCharacterClass of |ClassAtom| is *true* and this production has a [UnicodeFlag] parameter.
-
It is a Syntax Error if IsCharacterClass of |ClassAtomNoDash| is *false* and IsCharacterClass of |ClassAtom| is *false* and the CharacterValue of |ClassAtomNoDash| is larger than the CharacterValue of |ClassAtom|.