File: identity-escape.js

package info (click to toggle)
qtdeclarative-opensource-src 5.15.2%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 259,220 kB
  • sloc: javascript: 512,396; cpp: 493,894; xml: 8,892; python: 3,304; ansic: 2,764; sh: 206; makefile: 59; php: 27
file content (46 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download | duplicates (11)
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
// 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: B.1.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)'
);