Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/util/characters.dart

Issue 694353007: Move dart2js from sdk/lib/_internal/compiler to pkg/compiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library characters;
6
7 const int $EOF = 0;
8 const int $STX = 2;
9 const int $BS = 8;
10 const int $TAB = 9;
11 const int $LF = 10;
12 const int $VTAB = 11;
13 const int $FF = 12;
14 const int $CR = 13;
15 const int $SPACE = 32;
16 const int $BANG = 33;
17 const int $DQ = 34;
18 const int $HASH = 35;
19 const int $$ = 36;
20 const int $PERCENT = 37;
21 const int $AMPERSAND = 38;
22 const int $SQ = 39;
23 const int $OPEN_PAREN = 40;
24 const int $CLOSE_PAREN = 41;
25 const int $STAR = 42;
26 const int $PLUS = 43;
27 const int $COMMA = 44;
28 const int $MINUS = 45;
29 const int $PERIOD = 46;
30 const int $SLASH = 47;
31 const int $0 = 48;
32 const int $1 = 49;
33 const int $2 = 50;
34 const int $3 = 51;
35 const int $4 = 52;
36 const int $5 = 53;
37 const int $6 = 54;
38 const int $7 = 55;
39 const int $8 = 56;
40 const int $9 = 57;
41 const int $COLON = 58;
42 const int $SEMICOLON = 59;
43 const int $LT = 60;
44 const int $EQ = 61;
45 const int $GT = 62;
46 const int $QUESTION = 63;
47 const int $AT = 64;
48 const int $A = 65;
49 const int $B = 66;
50 const int $C = 67;
51 const int $D = 68;
52 const int $E = 69;
53 const int $F = 70;
54 const int $G = 71;
55 const int $H = 72;
56 const int $I = 73;
57 const int $J = 74;
58 const int $K = 75;
59 const int $L = 76;
60 const int $M = 77;
61 const int $N = 78;
62 const int $O = 79;
63 const int $P = 80;
64 const int $Q = 81;
65 const int $R = 82;
66 const int $S = 83;
67 const int $T = 84;
68 const int $U = 85;
69 const int $V = 86;
70 const int $W = 87;
71 const int $X = 88;
72 const int $Y = 89;
73 const int $Z = 90;
74 const int $OPEN_SQUARE_BRACKET = 91;
75 const int $BACKSLASH = 92;
76 const int $CLOSE_SQUARE_BRACKET = 93;
77 const int $CARET = 94;
78 const int $_ = 95;
79 const int $BACKPING = 96;
80 const int $a = 97;
81 const int $b = 98;
82 const int $c = 99;
83 const int $d = 100;
84 const int $e = 101;
85 const int $f = 102;
86 const int $g = 103;
87 const int $h = 104;
88 const int $i = 105;
89 const int $j = 106;
90 const int $k = 107;
91 const int $l = 108;
92 const int $m = 109;
93 const int $n = 110;
94 const int $o = 111;
95 const int $p = 112;
96 const int $q = 113;
97 const int $r = 114;
98 const int $s = 115;
99 const int $t = 116;
100 const int $u = 117;
101 const int $v = 118;
102 const int $w = 119;
103 const int $x = 120;
104 const int $y = 121;
105 const int $z = 122;
106 const int $OPEN_CURLY_BRACKET = 123;
107 const int $BAR = 124;
108 const int $CLOSE_CURLY_BRACKET = 125;
109 const int $TILDE = 126;
110 const int $DEL = 127;
111 const int $NBSP = 160;
112 const int $LS = 0x2028;
113 const int $PS = 0x2029;
114
115 const int $FIRST_SURROGATE = 0xd800;
116 const int $LAST_SURROGATE = 0xdfff;
117 const int $LAST_CODE_POINT = 0x10ffff;
118
119 bool isHexDigit(int characterCode) {
120 if (characterCode <= $9) return $0 <= characterCode;
121 characterCode |= $a ^ $A;
122 return ($a <= characterCode && characterCode <= $f);
123 }
124
125 int hexDigitValue(int hexDigit) {
126 assert(isHexDigit(hexDigit));
127 // hexDigit is one of '0'..'9', 'A'..'F' and 'a'..'f'.
128 if (hexDigit <= $9) return hexDigit - $0;
129 return (hexDigit | ($a ^ $A)) - ($a - 10);
130 }
131
132 bool isUnicodeScalarValue(int value) {
133 return value < $FIRST_SURROGATE ||
134 (value > $LAST_SURROGATE && value <= $LAST_CODE_POINT);
135 }
136
137 bool isUtf16LeadSurrogate(int value) {
138 return value >= 0xd800 && value <= 0xdbff;
139 }
140
141 bool isUtf16TrailSurrogate(int value) {
142 return value >= 0xdc00 && value <= 0xdfff;
143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698