1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
// Copyright (C) 2015 André Bargull. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: B.1.4 is not applied for Unicode RegExp - Octal escape sequences
info: |
The compatibility extensions defined in B.1.4 Regular Expressions Patterns
are not applied for Unicode RegExp.
Tested extension: "CharacterEscape[U] :: [~U] LegacyOctalEscapeSequence"
es6id: 21.1.2
---*/
// DecimalEscape without leading 0 in AtomEscape.
//
// AtomEscape[U] :: DecimalEscape
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
assert.throws(SyntaxError, function() {
RegExp("\\1", "u");
}, 'RegExp("\\1", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\2", "u");
}, 'RegExp("\\2", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\3", "u");
}, 'RegExp("\\3", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\4", "u");
}, 'RegExp("\\4", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\5", "u");
}, 'RegExp("\\5", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\6", "u");
}, 'RegExp("\\6", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\7", "u");
}, 'RegExp("\\7", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\8", "u");
}, 'RegExp("\\8", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\9", "u");
}, 'RegExp("\\9", "u"): ');
// DecimalEscape without leading 0 in ClassEscape.
//
// ClassEscape[U] :: DecimalEscape
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
assert.throws(SyntaxError, function() {
RegExp("[\\1]", "u");
}, 'RegExp("[\\1]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\2]", "u");
}, 'RegExp("[\\2]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\3]", "u");
}, 'RegExp("[\\3]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\4]", "u");
}, 'RegExp("[\\4]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\5]", "u");
}, 'RegExp("[\\5]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\6]", "u");
}, 'RegExp("[\\6]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\7]", "u");
}, 'RegExp("[\\7]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\8]", "u");
}, 'RegExp("[\\8]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\9]", "u");
}, 'RegExp("[\\9]", "u"): ');
// DecimalEscape with leading 0 in AtomEscape.
//
// Atom[U] :: DecimalEscape
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
assert.throws(SyntaxError, function() {
RegExp("\\00", "u");
}, 'RegExp("\\00", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\01", "u");
}, 'RegExp("\\01", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\02", "u");
}, 'RegExp("\\02", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\03", "u");
}, 'RegExp("\\03", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\04", "u");
}, 'RegExp("\\04", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\05", "u");
}, 'RegExp("\\05", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\06", "u");
}, 'RegExp("\\06", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\07", "u");
}, 'RegExp("\\07", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\08", "u");
}, 'RegExp("\\08", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("\\09", "u");
}, 'RegExp("\\09", "u"): ');
// DecimalEscape with leading 0 in ClassEscape.
//
// ClassEscape[U] :: DecimalEscape
// DecimalEscape :: DecimalIntegerLiteral [lookahead /= DecimalDigit]
assert.throws(SyntaxError, function() {
RegExp("[\\00]", "u");
}, 'RegExp("[\\00]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\01]", "u");
}, 'RegExp("[\\01]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\02]", "u");
}, 'RegExp("[\\02]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\03]", "u");
}, 'RegExp("[\\03]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\04]", "u");
}, 'RegExp("[\\04]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\05]", "u");
}, 'RegExp("[\\05]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\06]", "u");
}, 'RegExp("[\\06]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\07]", "u");
}, 'RegExp("[\\07]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\08]", "u");
}, 'RegExp("[\\08]", "u"): ');
assert.throws(SyntaxError, function() {
RegExp("[\\09]", "u");
}, 'RegExp("[\\09]", "u"): ');
reportCompare(0, 0);
|