mirror of https://github.com/tc39/test262.git
Add tests for Annex B extns to RegExp patterns
Remove previously-existing tests in favor of new versions that are more complete and more appropriately named.
This commit is contained in:
parent
d9d3f7cf4f
commit
43bce311db
|
@ -0,0 +1,70 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Extensions to ClassEscape
|
||||
info: |
|
||||
ClassEscape[U] ::
|
||||
b
|
||||
[+U] -
|
||||
[~U] c ClassControlLetter
|
||||
CharacterClassEscape
|
||||
CharacterEscape[?U]
|
||||
|
||||
ClassControlLetter ::
|
||||
DecimalDigit
|
||||
_
|
||||
|
||||
The production ClassEscape :: c ClassControlLetter evaluates as follows:
|
||||
|
||||
1. Let ch be the character matched by ClassControlLetter.
|
||||
2. Let i be ch's character value.
|
||||
3. Let j be the remainder of dividing i by 32.
|
||||
4. Let d be the character whose character value is j.
|
||||
5. Return the CharSet containing the single character d.
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /\c0/.exec('\x0f\x10\x11');
|
||||
assert.sameValue(match, null, '\\c0 outside of CharacterClass');
|
||||
|
||||
match = /[\c0]/.exec('\x0f\x10\x11');
|
||||
assert.sameValue(match[0], '\x10', '\\c0 within CharacterClass');
|
||||
|
||||
match = /[\c00]+/.exec('\x0f0\x10\x11');
|
||||
assert.sameValue(match[0], '0\x10', '\\c00 within CharacterClass');
|
||||
|
||||
match = /\c1/.exec('\x10\x11\x12');
|
||||
assert.sameValue(match, null, '\\c1 outside of CharacterClass');
|
||||
|
||||
match = /[\c1]/.exec('\x10\x11\x12');
|
||||
assert.sameValue(match[0], '\x11', '\\c1 within CharacterClass');
|
||||
|
||||
match = /[\c10]+/.exec('\x100\x11\x12');
|
||||
assert.sameValue(match[0], '0\x11', '\\c10 within CharacterClass');
|
||||
|
||||
match = /\c8/.exec('\x17\x18\x19');
|
||||
assert.sameValue(match, null, '\\c8 outside of CharacterClass');
|
||||
|
||||
match = /[\c8]/.exec('\x17\x18\x19');
|
||||
assert.sameValue(match[0], '\x18', '\\c8 within CharacterClass');
|
||||
|
||||
match = /[\c80]+/.exec('\x170\x18\x19');
|
||||
assert.sameValue(match[0], '0\x18', '\\c80 within CharacterClass');
|
||||
|
||||
match = /\c9/.exec('\x18\x19\x1a');
|
||||
assert.sameValue(match, null, '\\c9 outside of CharacterClass');
|
||||
|
||||
match = /[\c9]/.exec('\x18\x19\x1a');
|
||||
assert.sameValue(match[0], '\x19', '\\c9 within CharacterClass');
|
||||
|
||||
match = /[\c90]+/.exec('\x180\x19\x1a');
|
||||
assert.sameValue(match[0], '0\x19', '\\c90 within CharacterClass');
|
||||
|
||||
match = /\c_/.exec('\x1e\x1f\x20');
|
||||
assert.sameValue(match, null, '\\c_ outside of CharacterClass');
|
||||
|
||||
match = /[\c_]/.exec('\x1e\x1f\x20');
|
||||
assert.sameValue(match[0], '\x1f', '\\c_ within CharacterClass');
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Extended Pattern Characters (as distinct from Pattern Characters)
|
||||
info: |
|
||||
ExtendedPatternCharacter ::
|
||||
SourceCharacterbut not one of ^$.*+?()[|
|
||||
|
||||
The production ExtendedAtom::ExtendedPatternCharacter evaluates as follows:
|
||||
|
||||
1. Let ch be the character represented by ExtendedPatternCharacter.
|
||||
2. Let A be a one-element CharSet containing the character ch.
|
||||
3. Call CharacterSetMatcher(A, false) and return its Matcher result.
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /]/.exec(' ]{}');
|
||||
assert.sameValue(match[0], ']');
|
||||
|
||||
match = /{/.exec(' ]{}');
|
||||
assert.sameValue(match[0], '{');
|
||||
|
||||
match = /}/.exec(' ]{}');
|
||||
assert.sameValue(match[0], '}');
|
||||
|
||||
match = /x{o}x/.exec('x{o}x');
|
||||
assert.sameValue(match[0], 'x{o}x');
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Support for UnicodeIDContinue in IdentityEscape
|
||||
info: |
|
||||
IdentityEscape[U] ::
|
||||
[+U] SyntaxCharacter
|
||||
[+U] /
|
||||
[~U] SourceCharacter but not c
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /\C/.exec('ABCDE');
|
||||
assert.sameValue(match[0], 'C');
|
||||
|
||||
match = /O\PQ/.exec('MNOPQRS');
|
||||
assert.sameValue(match[0], 'OPQ');
|
||||
|
||||
match = /\8/.exec('789');
|
||||
assert.sameValue(match[0], '8');
|
||||
|
||||
match = /7\89/.exec('67890');
|
||||
assert.sameValue(match[0], '789');
|
||||
|
||||
match = /\9/.exec('890');
|
||||
assert.sameValue(match[0], '9');
|
||||
|
||||
match = /8\90/.exec('78900');
|
||||
assert.sameValue(match[0], '890');
|
||||
|
||||
match = /(.)(.)(.)(.)(.)(.)(.)(.)\8\8/.exec('0123456777');
|
||||
assert.sameValue(
|
||||
match[0],
|
||||
'0123456777',
|
||||
'DecimalEscape takes precedence over IdentityEscape (\\8)'
|
||||
);
|
||||
|
||||
match = /(.)(.)(.)(.)(.)(.)(.)(.)(.)\9\9/.exec('01234567888');
|
||||
assert.sameValue(
|
||||
match[0],
|
||||
'01234567888',
|
||||
'DecimalEscape takes precedence over IdentityEscape (\\9)'
|
||||
);
|
|
@ -0,0 +1,61 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Legacy Octal Escape Sequence
|
||||
info: |
|
||||
CharacterEscape[U]::
|
||||
ControlEscape
|
||||
c ControlLetter
|
||||
0 [lookahead ∉ DecimalDigit]
|
||||
HexEscapeSequence
|
||||
RegExpUnicodeEscapeSequence[?U]
|
||||
[~U] LegacyOctalEscapeSequence
|
||||
IdentityEscape[?U]
|
||||
|
||||
The production CharacterEscape::LegacyOctalEscapeSequence evaluates by
|
||||
evaluating the SV of the LegacyOctalEscapeSequence (see B.1.2) and
|
||||
returning its character result.
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
assert.sameValue(/\1/.exec('\x01')[0], '\x01', '\\1');
|
||||
assert.sameValue(/\2/.exec('\x02')[0], '\x02', '\\2');
|
||||
assert.sameValue(/\3/.exec('\x03')[0], '\x03', '\\3');
|
||||
assert.sameValue(/\4/.exec('\x04')[0], '\x04', '\\4');
|
||||
assert.sameValue(/\5/.exec('\x05')[0], '\x05', '\\5');
|
||||
assert.sameValue(/\6/.exec('\x06')[0], '\x06', '\\6');
|
||||
assert.sameValue(/\7/.exec('\x07')[0], '\x07', '\\7');
|
||||
|
||||
assert.sameValue(/\00/.exec('\x00')[0], '\x00', '\\00');
|
||||
assert.sameValue(/\07/.exec('\x07')[0], '\x07', '\\07');
|
||||
|
||||
assert.sameValue(/\30/.exec('\x18')[0], '\x18', '\\30');
|
||||
assert.sameValue(/\37/.exec('\x1f')[0], '\x1f', '\\37');
|
||||
|
||||
assert.sameValue(/\40/.exec('\x20')[0], '\x20', '\\40');
|
||||
assert.sameValue(/\47/.exec('\x27')[0], '\x27', '\\47');
|
||||
|
||||
assert.sameValue(/\70/.exec('\x38')[0], '\x38', '\\70');
|
||||
assert.sameValue(/\77/.exec('\x3f')[0], '\x3f', '\\77');
|
||||
|
||||
// Sequence is bounded according to the String Value (not number of characters)
|
||||
assert.sameValue(/\400/.exec('\x200')[0], '\x200', '\\400');
|
||||
assert.sameValue(/\470/.exec('\x270')[0], '\x270', '\\470');
|
||||
assert.sameValue(/\700/.exec('\x380')[0], '\x380', '\\700');
|
||||
assert.sameValue(/\770/.exec('\x3f0')[0], '\x3f0', '\\770');
|
||||
|
||||
assert.sameValue(/\000/.exec('\x00')[0], '\x00', '\\000');
|
||||
assert.sameValue(/\007/.exec('\x07')[0], '\x07', '\\007');
|
||||
assert.sameValue(/\070/.exec('\x38')[0], '\x38', '\\070');
|
||||
|
||||
assert.sameValue(/\300/.exec('\xc0')[0], '\xc0', '\\300');
|
||||
assert.sameValue(/\307/.exec('\xc7')[0], '\xc7', '\\307');
|
||||
assert.sameValue(/\370/.exec('\xf8')[0], '\xf8', '\\370');
|
||||
|
||||
match = /(.)\1/.exec('a\x01 aa');
|
||||
assert.sameValue(
|
||||
match[0], 'aa', 'DecimalEscape takes precedence over LegacyOctalEscapeSequence'
|
||||
);
|
|
@ -0,0 +1,47 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Extensions to NonemptyClassRangesNoDash production
|
||||
info: |
|
||||
The production
|
||||
NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates
|
||||
as follows:
|
||||
|
||||
1. Evaluate ClassAtomNoDash to obtain a CharSet A.
|
||||
2. Evaluate ClassAtom to obtain a CharSet B.
|
||||
3. Evaluate ClassRanges to obtain a CharSet C.
|
||||
4. Call CharacterRangeOrUnion(A, B) and let D be the resulting CharSet.
|
||||
5. Return the union of CharSets D and C.
|
||||
|
||||
B.1.4.1.1 Runtime Semantics: CharacterRangeOrUnion Abstract Operation
|
||||
|
||||
1. If Unicode is false, then
|
||||
a. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, then
|
||||
i. Let C be the CharSet containing the single character - U+002D
|
||||
(HYPHEN-MINUS).
|
||||
ii. Return the union of CharSets A, B and C.
|
||||
2. Return CharacterRange(A, B).
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /[\d-a]+/.exec(':a0123456789-:');
|
||||
assert.sameValue(match[0], 'a0123456789-');
|
||||
|
||||
match = /[\d-az]+/.exec(':a0123456789z-:');
|
||||
assert.sameValue(match[0], 'a0123456789z-');
|
||||
|
||||
match = /[%-\d]+/.exec('&%0123456789-&');
|
||||
assert.sameValue(match[0], '%0123456789-');
|
||||
|
||||
match = /[%-\dz]+/.exec('&%0123456789z-&');
|
||||
assert.sameValue(match[0], '%0123456789z-');
|
||||
|
||||
match = /[\s-\d]+/.exec('& \t0123456789-&');
|
||||
assert.sameValue(match[0], ' \t0123456789-');
|
||||
|
||||
match = /[\s-\dz]+/.exec('& \t0123456789z-&');
|
||||
assert.sameValue(match[0], ' \t0123456789z-');
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Extensions to NonemptyClassRanges production
|
||||
info: |
|
||||
The production NonemptyClassRanges :: ClassAtom-ClassAtom ClassRanges
|
||||
evaluates as follows:
|
||||
|
||||
1. Evaluate the first ClassAtom to obtain a CharSet A.
|
||||
2. Evaluate the second ClassAtom to obtain a CharSet B.
|
||||
3. Evaluate ClassRanges to obtain a CharSet C.
|
||||
4. Call CharacterRangeOrUnion(A, B) and let D be the resulting CharSet.
|
||||
5. Return the union of CharSets D and C.
|
||||
|
||||
B.1.4.1.1 Runtime Semantics: CharacterRangeOrUnion Abstract Operation
|
||||
|
||||
1. If Unicode is false, then
|
||||
a. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, then
|
||||
i. Let C be the CharSet containing the single character - U+002D
|
||||
(HYPHEN-MINUS).
|
||||
ii. Return the union of CharSets A, B and C.
|
||||
2. Return CharacterRange(A, B).
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /[--\d]+/.exec('.-0123456789-.');
|
||||
assert.sameValue(match[0], '-0123456789-');
|
||||
|
||||
match = /[--\dz]+/.exec('.-0123456789z-.');
|
||||
assert.sameValue(match[0], '-0123456789z-');
|
|
@ -0,0 +1,68 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Quantifiable assertions `?=` ("followed by")
|
||||
info: |
|
||||
Term[U] ::
|
||||
[~U] QuantifiableAssertion Quantifier
|
||||
|
||||
QuantifiableAssertion ::
|
||||
( ?= Disjunction )
|
||||
( ?! Disjunction )
|
||||
|
||||
The production Term::QuantifiableAssertionQuantifier evaluates the same as
|
||||
the production Term::AtomQuantifier but with QuantifiableAssertion
|
||||
substituted for Atom.
|
||||
|
||||
The production Assertion::QuantifiableAssertion evaluates by evaluating
|
||||
QuantifiableAssertion to obtain a Matcher and returning that Matcher.
|
||||
|
||||
Assertion (21.2.2.6) evaluation rules for the Assertion::(?=Disjunction)
|
||||
and Assertion::(?!Disjunction) productions are also used for the
|
||||
QuantifiableAssertion productions, but with QuantifiableAssertion
|
||||
substituted for Assertion.
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /.(?=Z)*/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: *');
|
||||
|
||||
match = /.(?=Z)+/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'b', 'quantifier: +');
|
||||
|
||||
match = /.(?=Z)?/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: ?');
|
||||
|
||||
match = /.(?=Z){2}/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits }');
|
||||
|
||||
match = /.(?=Z){2,}/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits , }');
|
||||
|
||||
match = /.(?=Z){2,3}/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(
|
||||
match[0], 'b', 'quantifier: { DecimalDigits , DecimalDigits }'
|
||||
);
|
||||
|
||||
match = /.(?=Z)*?/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: * ?');
|
||||
|
||||
match = /.(?=Z)+?/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'b', 'quantifier: + ?');
|
||||
|
||||
match = /.(?=Z)??/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: ? ?');
|
||||
|
||||
match = /.(?=Z){2}?/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits } ?');
|
||||
|
||||
match = /.(?=Z){2,}?/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(match[0], 'b', 'quantifier: { DecimalDigits , } ?');
|
||||
|
||||
match = /.(?=Z){2,3}?/.exec('a bZ cZZ dZZZ eZZZZ');
|
||||
assert.sameValue(
|
||||
match[0], 'b', 'quantifier: { DecimalDigits , DecimalDigits } ?'
|
||||
);
|
|
@ -0,0 +1,68 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Quantifiable assertions `?!` ("not followed by")
|
||||
info: |
|
||||
Term[U] ::
|
||||
[~U] QuantifiableAssertion Quantifier
|
||||
|
||||
QuantifiableAssertion::
|
||||
( ?= Disjunction )
|
||||
( ?! Disjunction )
|
||||
|
||||
The production Term::QuantifiableAssertionQuantifier evaluates the same as
|
||||
the production Term::AtomQuantifier but with QuantifiableAssertion
|
||||
substituted for Atom.
|
||||
|
||||
The production Assertion::QuantifiableAssertion evaluates by evaluating
|
||||
QuantifiableAssertion to obtain a Matcher and returning that Matcher.
|
||||
|
||||
Assertion (21.2.2.6) evaluation rules for the Assertion::(?=Disjunction)
|
||||
and Assertion::(?!Disjunction) productions are also used for the
|
||||
QuantifiableAssertion productions, but with QuantifiableAssertion
|
||||
substituted for Assertion.
|
||||
---*/
|
||||
|
||||
var match;
|
||||
|
||||
match = /[a-e](?!Z)*/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: *');
|
||||
|
||||
match = /[a-e](?!Z)+/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'e', 'quantifier: +');
|
||||
|
||||
match = /[a-e](?!Z)?/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: ?');
|
||||
|
||||
match = /[a-e](?!Z){2}/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits }');
|
||||
|
||||
match = /[a-e](?!Z){2,}/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits , }');
|
||||
|
||||
match = /[a-e](?!Z){2,3}/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(
|
||||
match[0], 'e', 'quantifier: { DecimalDigits , DecimalDigits }'
|
||||
);
|
||||
|
||||
match = /[a-e](?!Z)*?/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: * ?');
|
||||
|
||||
match = /[a-e](?!Z)+?/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'e', 'quantifier: + ?');
|
||||
|
||||
match = /[a-e](?!Z)??/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'a', 'quantifier: ? ?');
|
||||
|
||||
match = /[a-e](?!Z){2}?/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits } ?');
|
||||
|
||||
match = /[a-e](?!Z){2,}?/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(match[0], 'e', 'quantifier: { DecimalDigits , } ?');
|
||||
|
||||
match = /[a-e](?!Z){2,3}?/.exec('aZZZZ bZZZ cZZ dZ e');
|
||||
assert.sameValue(
|
||||
match[0], 'e', 'quantifier: { DecimalDigits , DecimalDigits } ?'
|
||||
);
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: Braced quantifier in an Atom position (exact count)
|
||||
info: |
|
||||
SyntaxCharacter :: one of
|
||||
^$\.*+?()[]{}|
|
||||
|
||||
PatternCharacter ::
|
||||
SourceCharacterbut not SyntaxCharacter
|
||||
|
||||
Although Annex B extends the definition of Term to include
|
||||
ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier
|
||||
pattern with a higher precedence. This makes the SyntaxError for such
|
||||
patterns consistent between Annex-B and non-Annex-B environments.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/{2}/;
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: Braced quantifier in an Atom position (lower-bounds)
|
||||
info: |
|
||||
SyntaxCharacter :: one of
|
||||
^$\.*+?()[]{}|
|
||||
|
||||
PatternCharacter ::
|
||||
SourceCharacterbut not SyntaxCharacter
|
||||
|
||||
Although Annex B extends the definition of Term to include
|
||||
ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier
|
||||
pattern with a higher precedence. This makes the SyntaxError for such
|
||||
patterns consistent between Annex-B and non-Annex-B environments.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/{2,}/;
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: Braced quantifier in an Atom position (range)
|
||||
info: |
|
||||
SyntaxCharacter :: one of
|
||||
^$\.*+?()[]{}|
|
||||
|
||||
PatternCharacter ::
|
||||
SourceCharacterbut not SyntaxCharacter
|
||||
|
||||
Although Annex B extends the definition of Term to include
|
||||
ExtendedPatternCharacter, it also introduces the InvalidBracedQuantifier
|
||||
pattern with a higher precedence. This makes the SyntaxError for such
|
||||
patterns consistent between Annex-B and non-Annex-B environments.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/{2,3}/;
|
|
@ -1,13 +0,0 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Invalid character escape with `u` flag
|
||||
info: >
|
||||
An unterminated character escape produces a SyntaxError when the `u` flag
|
||||
is set (regardless of Annex B extensions--see ES6 section B.1.4).
|
||||
es6id: 21.2.1
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/\c/u;
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Invalid character class range with `u` flag (lower set size > 1)
|
||||
info: >
|
||||
21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation
|
||||
|
||||
1. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, throw a SyntaxError exception.
|
||||
es6id: 21.2.2.15.1
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/[\w-a]/u;
|
|
@ -1,15 +0,0 @@
|
|||
// Copyright (C) 2015 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
description: Invalid character class range with `u` flag (upper set size > 1)
|
||||
info: >
|
||||
21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation
|
||||
|
||||
1. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, throw a SyntaxError exception.
|
||||
es6id: 21.2.2.15.1
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/[a-\w]/u;
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: >
|
||||
ClassEscape does not recognize "class control" patterns
|
||||
info: |
|
||||
ClassEscape[U] ::
|
||||
b
|
||||
[+U] -
|
||||
CharacterClassEscape
|
||||
CharacterEscape[?U]
|
||||
|
||||
The `u` flag precludes the Annex B extension that enables this pattern.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/\c0/u;
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: Quantifiable assertions disallowed with `u` flag
|
||||
info: |
|
||||
The `u` flag precludes the use of extended pattern characters irrespective
|
||||
of the presence of Annex B extensions.
|
||||
|
||||
Term[U] ::
|
||||
[~U] ExtendedAtom
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/{/u;
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: Support for UnicodeIDContinue in IdentityEscape
|
||||
info: |
|
||||
IdentityEscape[U] ::
|
||||
[+U] SyntaxCharacter
|
||||
[+U] /
|
||||
[~U] SourceCharacter but not UnicodeIDContinue
|
||||
|
||||
The `u` flag precludes the use of characters in UnicodeIDContinue
|
||||
irrespective of the presence of Annex B extensions.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/\M/u;
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-patterns
|
||||
es6id: 21.2.1
|
||||
description: Legacy Octal Escape Sequence not supported with `u` flag
|
||||
info: |
|
||||
The `u` flag precludes the use of LegacyOctalEscapeSequence irrespective
|
||||
of the presence of Annex B extensions.
|
||||
|
||||
CharacterEscape [U] ::
|
||||
ControlEscape
|
||||
c ControlLetter
|
||||
0[lookahead ∉ DecimalDigit]
|
||||
HexEscapeSequence
|
||||
RegExpUnicodeEscapeSequence[?U]
|
||||
IdentityEscape[?U]
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/\1/u;
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-pattern-semantics
|
||||
es6id: 21.2.2
|
||||
description: >
|
||||
NonEmptyClassRangesNoDash production cannot specify a multi-character set
|
||||
("A" parameter)
|
||||
info: |
|
||||
The production
|
||||
NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates
|
||||
as follows:
|
||||
|
||||
1. Evaluate ClassAtomNoDash to obtain a CharSet A.
|
||||
2. Evaluate ClassAtom to obtain a CharSet B.
|
||||
3. Evaluate ClassRanges to obtain a CharSet C.
|
||||
4. Call CharacterRange(A, B) and let D be the resulting CharSet.
|
||||
|
||||
21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation
|
||||
|
||||
1. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, throw a SyntaxError exception.
|
||||
|
||||
The `u` flag precludes the Annex B extension that enables this pattern.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/[\d-a]/u;
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-pattern-semantics
|
||||
es6id: 21.2.2
|
||||
description: >
|
||||
NonEmptyClassRangesNoDash production cannot specify a multi-character set
|
||||
(both "A" and "B" parameters)
|
||||
info: |
|
||||
The production
|
||||
NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates
|
||||
as follows:
|
||||
|
||||
1. Evaluate ClassAtomNoDash to obtain a CharSet A.
|
||||
2. Evaluate ClassAtom to obtain a CharSet B.
|
||||
3. Evaluate ClassRanges to obtain a CharSet C.
|
||||
4. Call CharacterRange(A, B) and let D be the resulting CharSet.
|
||||
|
||||
21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation
|
||||
|
||||
1. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, throw a SyntaxError exception.
|
||||
|
||||
The `u` flag precludes the Annex B extension that enables this pattern.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/[\s-\d]/u;
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-pattern-semantics
|
||||
es6id: 21.2.2
|
||||
description: >
|
||||
NonEmptyClassRangesNoDash production cannot specify a multi-character set
|
||||
("B" parameter)
|
||||
info: |
|
||||
The production
|
||||
NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates
|
||||
as follows:
|
||||
|
||||
1. Evaluate ClassAtomNoDash to obtain a CharSet A.
|
||||
2. Evaluate ClassAtom to obtain a CharSet B.
|
||||
3. Evaluate ClassRanges to obtain a CharSet C.
|
||||
4. Call CharacterRange(A, B) and let D be the resulting CharSet.
|
||||
|
||||
21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation
|
||||
|
||||
1. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, throw a SyntaxError exception.
|
||||
|
||||
The `u` flag precludes the Annex B extension that enables this pattern.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/[%-\d]/u;
|
|
@ -0,0 +1,27 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-pattern-semantics
|
||||
es6id: 21.2.2
|
||||
description: >
|
||||
NonEmptyClassRangesNoDash production cannot specify a multi-character set
|
||||
info: |
|
||||
The production
|
||||
NonemptyClassRangesNoDash::ClassAtomNoDash-ClassAtomClassRanges evaluates
|
||||
as follows:
|
||||
|
||||
1. Evaluate ClassAtomNoDash to obtain a CharSet A.
|
||||
2. Evaluate ClassAtom to obtain a CharSet B.
|
||||
3. Evaluate ClassRanges to obtain a CharSet C.
|
||||
4. Call CharacterRange(A, B) and let D be the resulting CharSet.
|
||||
|
||||
21.2.2.15.1 Runtime Semantics: CharacterRange Abstract Operation
|
||||
|
||||
1. If A does not contain exactly one character or B does not contain
|
||||
exactly one character, throw a SyntaxError exception.
|
||||
|
||||
The `u` flag precludes the Annex B extension that enables this pattern.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/[--\d]/u;
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-pattern-semantics
|
||||
es6id: 21.2.2
|
||||
description: Out-of-bounds decimal escapes
|
||||
info: |
|
||||
1. Evaluate DecimalEscape to obtain an integer n.
|
||||
2. If n>NcapturingParens, throw a SyntaxError exception.
|
||||
|
||||
When the "unicode" flag is set, this algorithm is honored irrespective of
|
||||
the presence of Annex B extensions.
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/\8/u;
|
|
@ -0,0 +1,16 @@
|
|||
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
esid: sec-regular-expressions-patterns
|
||||
es6id: B1.4
|
||||
description: Quantifiable assertions disallowed with `u` flag
|
||||
info: |
|
||||
The `u` flag precludes quantifiable assertions (even when Annex B is
|
||||
honored)
|
||||
|
||||
Term[U] ::
|
||||
[~U] QuantifiableAssertion Quantifier
|
||||
negative: SyntaxError
|
||||
---*/
|
||||
|
||||
/.(?=.)?/u;
|
Loading…
Reference in New Issue