B.1 Additional Syntax
B.1.1 HTML-like Comments
The syntax and semantics of
Syntax
Similar to a
B.1.2 Regular Expressions Patterns
The syntax of
This alternative pattern grammar and semantics only changes the syntax and semantics of BMP patterns. The following grammar extensions include productions parameterized with the [UnicodeMode] parameter. However, none of these extensions change the syntax of Unicode patterns recognized when parsing with the [UnicodeMode] parameter present on the
Syntax
When the same left-hand sides occurs with both [+UnicodeMode] and [~UnicodeMode] guards it is to control the disambiguation priority.
B.1.2.1 Static Semantics: Early Errors
The semantics of
- It is a Syntax Error if any source text is matched by this production.
Additionally, the rules for the following productions are modified with the addition of the highlighted text:
-
It is a Syntax Error if
IsCharacterClass of the firstClassAtom istrue orIsCharacterClass of the secondClassAtom istrue and this production has a [UnicodeMode] parameter. -
It is a Syntax Error if
IsCharacterClass of the firstClassAtom isfalse ,IsCharacterClass of the secondClassAtom isfalse , and theCharacterValue of the firstClassAtom is strictly greater than theCharacterValue of the secondClassAtom .
-
It is a Syntax Error if
IsCharacterClass ofClassAtomNoDash istrue orIsCharacterClass ofClassAtom istrue and this production has a [UnicodeMode] parameter. -
It is a Syntax Error if
IsCharacterClass ofClassAtomNoDash isfalse ,IsCharacterClass ofClassAtom isfalse , and theCharacterValue ofClassAtomNoDash is strictly greater than theCharacterValue ofClassAtom .
B.1.2.2 Static Semantics: CountLeftCapturingParensWithin and CountLeftCapturingParensBefore
In the definitions of
B.1.2.3 Static Semantics: IsCharacterClass
The semantics of
- Return
false .
B.1.2.4 Static Semantics: CharacterValue
The semantics of
- Return the numeric value of U+005C (REVERSE SOLIDUS).
- Let ch be the code point matched by
ClassControlLetter . - Let i be the numeric value of ch.
- Return the remainder of dividing i by 32.
- Return the MV of
LegacyOctalEscapeSequence (see12.9.4.3 ).
B.1.2.5 Runtime Semantics: CompileSubpattern
The semantics of
The rule for
The rule for
The rule for
B.1.2.6 Runtime Semantics: CompileAssertion
B.1.2.7 Runtime Semantics: CompileAtom
- Let A be the
CharSet containing the single character\
U+005C (REVERSE SOLIDUS). - Return
CharacterSetMatcher (rer, A,false , direction).
- Let ch be the character represented by
ExtendedPatternCharacter . - Let A be a one-element
CharSet containing the character ch. - Return
CharacterSetMatcher (rer, A,false , direction).
B.1.2.8 Runtime Semantics: CompileToCharSet
The semantics of
The following two rules replace the corresponding rules of
- Let A be
CompileToCharSet of the firstClassAtom with argument rer. - Let B be
CompileToCharSet of the secondClassAtom with argument rer. - Let C be
CompileToCharSet ofClassContents with argument rer. - Let D be
CharacterRangeOrUnion (rer, A, B). - Return the union of D and C.
- Let A be
CompileToCharSet ofClassAtomNoDash with argument rer. - Let B be
CompileToCharSet ofClassAtom with argument rer. - Let C be
CompileToCharSet ofClassContents with argument rer. - Let D be
CharacterRangeOrUnion (rer, A, B). - Return the union of D and C.
In addition, the following rules are added to
- Let cv be the
CharacterValue of thisClassEscape . - Let c be the character whose character value is cv.
- Return the
CharSet containing the single character c.
- Return the
CharSet containing the single character\
U+005C (REVERSE SOLIDUS).
\c
within a character class where it is not followed by an acceptable control character.B.1.2.8.1 CharacterRangeOrUnion ( rer, A, B )
The abstract operation CharacterRangeOrUnion takes arguments rer (a
- If
HasEitherUnicodeFlag (rer) isfalse , then - Return
CharacterRange (A, B).
B.1.2.9 Static Semantics: ParsePattern ( patternText, u, v )
The semantics of
The abstract operation
- If v is
true and u istrue , then- Let parseResult be a
List containing one or moreSyntaxError objects.
- Let parseResult be a
- Else if v is
true , then - Else if u is
true , then - Else,
- Return parseResult.