B.1 Additional Syntax
B.1.1 Numeric Literals
The syntax and semantics of
Syntax
B.1.1.1 Static Semantics
-
The MV of
is the MV ofLegacyOctalIntegerLiteral :: 0 OctalDigit OctalDigit . -
The MV of
is (the MV ofLegacyOctalIntegerLiteral :: LegacyOctalIntegerLiteral OctalDigit LegacyOctalIntegerLiteral times 8) plus the MV ofOctalDigit . -
The MV of
is the MV ofDecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral NonOctalDecimalIntegerLiteral . -
The MV of
is the MV ofNonOctalDecimalIntegerLiteral :: 0 NonOctalDigit NonOctalDigit . -
The MV of
is (the MV ofNonOctalDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral NonOctalDigit LegacyOctalLikeDecimalIntegerLiteral times 10) plus the MV ofNonOctalDigit . -
The MV of
is (the MV ofNonOctalDecimalIntegerLiteral :: NonOctalDecimalIntegerLiteral DecimalDigit NonOctalDecimalIntegerLiteral times 10) plus the MV ofDecimalDigit . -
The MV of
is the MV ofLegacyOctalLikeDecimalIntegerLiteral :: 0 OctalDigit OctalDigit . -
The MV of
is (the MV ofLegacyOctalLikeDecimalIntegerLiteral :: LegacyOctalLikeDecimalIntegerLiteral OctalDigit LegacyOctalLikeDecimalIntegerLiteral times 10) plus the MV ofOctalDigit . -
The MV of
is 8.NonOctalDigit :: 8 -
The MV of
is 9.NonOctalDigit :: 9
B.1.2 String Literals
The syntax and semantics of
Syntax
This definition of
It is possible for string literals to precede a
function invalid() { "\7"; "use strict"; }
B.1.2.1 Static Semantics
-
The
SV of is the String value consisting of the code unit whose value is the MV ofEscapeSequence :: LegacyOctalEscapeSequence LegacyOctalEscapeSequence . -
The MV of
is (8 times the MV ofLegacyOctalEscapeSequence :: ZeroToThree OctalDigit ZeroToThree ) plus the MV ofOctalDigit . -
The MV of
is (8 times the MV ofLegacyOctalEscapeSequence :: FourToSeven OctalDigit FourToSeven ) plus the MV ofOctalDigit . -
The MV of
is (64 (that is, 82) times the MV ofLegacyOctalEscapeSequence :: ZeroToThree OctalDigit OctalDigit ZeroToThree ) plus (8 times the MV of the firstOctalDigit ) plus the MV of the secondOctalDigit . -
The
SV of is the String value consisting of the code unit 0x0038 (DIGIT EIGHT).NonOctalDecimalEscapeSequence :: 8 -
The
SV of is the String value consisting of the code unit 0x0039 (DIGIT NINE).NonOctalDecimalEscapeSequence :: 9 -
The MV of
is 0.ZeroToThree :: 0 -
The MV of
is 1.ZeroToThree :: 1 -
The MV of
is 2.ZeroToThree :: 2 -
The MV of
is 3.ZeroToThree :: 3 -
The MV of
is 4.FourToSeven :: 4 -
The MV of
is 5.FourToSeven :: 5 -
The MV of
is 6.FourToSeven :: 6 -
The MV of
is 7.FourToSeven :: 7
B.1.3 HTML-like Comments
The syntax and semantics of
Syntax
Similar to a
B.1.4 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 [U] parameter. However, none of these extensions change the syntax of Unicode patterns recognized when parsing with the [U] parameter present on the
Syntax
When the same left hand sides occurs with both [+U] and [~U] guards it is to control the disambiguation priority.
B.1.4.1 Static Semantics: Early Errors
The semantics of
- It is a Syntax Error if any source text matches this rule.
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 [U] parameter. -
It is a Syntax Error if
IsCharacterClass of the firstClassAtom isfalse andIsCharacterClass of the secondClassAtom isfalse and theCharacterValue of the firstClassAtom is larger than theCharacterValue of the secondClassAtom .
-
It is a Syntax Error if
IsCharacterClass ofClassAtomNoDash istrue orIsCharacterClass ofClassAtom istrue and this production has a [U] parameter. -
It is a Syntax Error if
IsCharacterClass ofClassAtomNoDash isfalse andIsCharacterClass ofClassAtom isfalse and theCharacterValue ofClassAtomNoDash is larger than theCharacterValue ofClassAtom .
B.1.4.2 Static Semantics: IsCharacterClass
The semantics of
- Return
false .
B.1.4.3 Static Semantics: CharacterValue
The semantics of
- Return the code point value of U+005C (REVERSE SOLIDUS).
- Let ch be the code point matched by
ClassControlLetter . - Let i be ch's code point value.
- Return the remainder of dividing i by 32.
- Return the MV of
LegacyOctalEscapeSequence (seeB.1.2 ).
B.1.4.4 Pattern Semantics
The semantics of
Within
Term (
The production
The production
The production
Assertion (
The production
- Evaluate
QuantifiableAssertion to obtain a Matcher m. - Return m.
Assertion (
Atom (
The production
- Let A be the CharSet containing the single character
\
U+005C (REVERSE SOLIDUS). - Return !
CharacterSetMatcher (A,false , direction).
The production
- Let ch be the character represented by
ExtendedPatternCharacter . - Let A be a one-element CharSet containing the character ch.
- Return !
CharacterSetMatcher (A,false , direction).
CharacterEscape (
The production
- Let cv be the
CharacterValue of thisCharacterEscape . - Return the character whose character value is cv.
NonemptyClassRanges (
The production
- Evaluate the first
ClassAtom to obtain a CharSet A. - Evaluate the second
ClassAtom to obtain a CharSet B. - Evaluate
ClassRanges to obtain a CharSet C. - Let D be !
CharacterRangeOrUnion (A, B). - Return the union of D and C.
NonemptyClassRangesNoDash (
The production
- Evaluate
ClassAtomNoDash to obtain a CharSet A. - Evaluate
ClassAtom to obtain a CharSet B. - Evaluate
ClassRanges to obtain a CharSet C. - Let D be !
CharacterRangeOrUnion (A, B). - Return the union of D and C.
ClassEscape (
The production
- 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.
ClassAtomNoDash (
The production
- 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.4.4.1 CharacterRangeOrUnion ( A, B )
The abstract operation CharacterRangeOrUnion takes arguments A (a CharSet) and B (a CharSet). It performs the following steps when called:
- If Unicode is
false , then- If A does not contain exactly one character or B does not contain exactly one character, then
- Let C be the CharSet containing the single character
-
U+002D (HYPHEN-MINUS). - Return the union of CharSets A, B and C.
- Let C be the CharSet containing the single character
- If A does not contain exactly one character or B does not contain exactly one character, then
- Return !
CharacterRange (A, B).