-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Normative: Annex B Regular Expressions updates to match web reality
Fixed: - Removed invalid respecification of the PatternCharacter production (B.1.4 shouldn't affect Unicode RegExp) Changes: - Added InvalidBracedQuantifier to reject `/{1}/` (previously allowed through ExtendedTerm -> Atom -> PatternCharacter) - Added ExtendedPatternCharacter to allow forms like `/{*/`, `/}*/` `/]/` - ExtendedPatternCharacter also handles `/\c%/` by removing the `\` restriction (`/\c%/` is equivalent to writing `/\\c%/`) - Added support for `/[\c_]/` and `/[\c1]/` to ClassEscape (the extended forms `\c_` and `\c<decimal digit>` are only valid in CharacterClass) - Changed "ClassEscape :: [~U] DecimalEscape" to allow `/[\8]/` by adding the restriction "but only if the integer value of DecimalEscape is 0" [1] - Character ranges which start or end with a non-single element CharSet are now handled in a more web-conform way [2, 3] - Merged Term and ExtendedTerm to avoid adding redundant semantics for ExtendedTerm - Re-ordered some production rules for clarity and to match 21.2.1 [1] This change does not match JavaScriptCore (`/[\8]/.test('\\') == true` in JSC), but also see AtomEscape for the other case where `\8` is handled differently (`/\8/.test('8') == false` in JSC). [2] `' -a'.split('').map(s => /[\s-a]/.test(s)) == [true, true, true]` in all major browsers. The previous Annex B semantics made `/[\s-t]/` equivalent to `/[s-t]/`. [3] This change does not match Chakra (`/[\s-a-c]/.test('b') == true` in Chakra).
- Loading branch information
Showing
1 changed file
with
105 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters