source: trip-planner-front/node_modules/parse5/lib/common/unicode.js@ 84d0fbb

Last change on this file since 84d0fbb was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.4 KB
Line 
1'use strict';
2
3const UNDEFINED_CODE_POINTS = [
4 0xfffe,
5 0xffff,
6 0x1fffe,
7 0x1ffff,
8 0x2fffe,
9 0x2ffff,
10 0x3fffe,
11 0x3ffff,
12 0x4fffe,
13 0x4ffff,
14 0x5fffe,
15 0x5ffff,
16 0x6fffe,
17 0x6ffff,
18 0x7fffe,
19 0x7ffff,
20 0x8fffe,
21 0x8ffff,
22 0x9fffe,
23 0x9ffff,
24 0xafffe,
25 0xaffff,
26 0xbfffe,
27 0xbffff,
28 0xcfffe,
29 0xcffff,
30 0xdfffe,
31 0xdffff,
32 0xefffe,
33 0xeffff,
34 0xffffe,
35 0xfffff,
36 0x10fffe,
37 0x10ffff
38];
39
40exports.REPLACEMENT_CHARACTER = '\uFFFD';
41
42exports.CODE_POINTS = {
43 EOF: -1,
44 NULL: 0x00,
45 TABULATION: 0x09,
46 CARRIAGE_RETURN: 0x0d,
47 LINE_FEED: 0x0a,
48 FORM_FEED: 0x0c,
49 SPACE: 0x20,
50 EXCLAMATION_MARK: 0x21,
51 QUOTATION_MARK: 0x22,
52 NUMBER_SIGN: 0x23,
53 AMPERSAND: 0x26,
54 APOSTROPHE: 0x27,
55 HYPHEN_MINUS: 0x2d,
56 SOLIDUS: 0x2f,
57 DIGIT_0: 0x30,
58 DIGIT_9: 0x39,
59 SEMICOLON: 0x3b,
60 LESS_THAN_SIGN: 0x3c,
61 EQUALS_SIGN: 0x3d,
62 GREATER_THAN_SIGN: 0x3e,
63 QUESTION_MARK: 0x3f,
64 LATIN_CAPITAL_A: 0x41,
65 LATIN_CAPITAL_F: 0x46,
66 LATIN_CAPITAL_X: 0x58,
67 LATIN_CAPITAL_Z: 0x5a,
68 RIGHT_SQUARE_BRACKET: 0x5d,
69 GRAVE_ACCENT: 0x60,
70 LATIN_SMALL_A: 0x61,
71 LATIN_SMALL_F: 0x66,
72 LATIN_SMALL_X: 0x78,
73 LATIN_SMALL_Z: 0x7a,
74 REPLACEMENT_CHARACTER: 0xfffd
75};
76
77exports.CODE_POINT_SEQUENCES = {
78 DASH_DASH_STRING: [0x2d, 0x2d], //--
79 DOCTYPE_STRING: [0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE
80 CDATA_START_STRING: [0x5b, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5b], //[CDATA[
81 SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script
82 PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4c, 0x49, 0x43], //PUBLIC
83 SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4d] //SYSTEM
84};
85
86//Surrogates
87exports.isSurrogate = function(cp) {
88 return cp >= 0xd800 && cp <= 0xdfff;
89};
90
91exports.isSurrogatePair = function(cp) {
92 return cp >= 0xdc00 && cp <= 0xdfff;
93};
94
95exports.getSurrogatePairCodePoint = function(cp1, cp2) {
96 return (cp1 - 0xd800) * 0x400 + 0x2400 + cp2;
97};
98
99//NOTE: excluding NULL and ASCII whitespace
100exports.isControlCodePoint = function(cp) {
101 return (
102 (cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) ||
103 (cp >= 0x7f && cp <= 0x9f)
104 );
105};
106
107exports.isUndefinedCodePoint = function(cp) {
108 return (cp >= 0xfdd0 && cp <= 0xfdef) || UNDEFINED_CODE_POINTS.indexOf(cp) > -1;
109};
Note: See TracBrowser for help on using the repository browser.