OLD | NEW |
| (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 final int $EOF = 0; | |
8 final int $STX = 2; | |
9 final int $BS = 8; | |
10 final int $TAB = 9; | |
11 final int $LF = 10; | |
12 final int $VTAB = 11; | |
13 final int $FF = 12; | |
14 final int $CR = 13; | |
15 final int $SPACE = 32; | |
16 final int $BANG = 33; | |
17 final int $DQ = 34; | |
18 final int $HASH = 35; | |
19 final int $$ = 36; | |
20 final int $PERCENT = 37; | |
21 final int $AMPERSAND = 38; | |
22 final int $SQ = 39; | |
23 final int $OPEN_PAREN = 40; | |
24 final int $CLOSE_PAREN = 41; | |
25 final int $STAR = 42; | |
26 final int $PLUS = 43; | |
27 final int $COMMA = 44; | |
28 final int $MINUS = 45; | |
29 final int $PERIOD = 46; | |
30 final int $SLASH = 47; | |
31 final int $0 = 48; | |
32 final int $1 = 49; | |
33 final int $2 = 50; | |
34 final int $3 = 51; | |
35 final int $4 = 52; | |
36 final int $5 = 53; | |
37 final int $6 = 54; | |
38 final int $7 = 55; | |
39 final int $8 = 56; | |
40 final int $9 = 57; | |
41 final int $COLON = 58; | |
42 final int $SEMICOLON = 59; | |
43 final int $LT = 60; | |
44 final int $EQ = 61; | |
45 final int $GT = 62; | |
46 final int $QUESTION = 63; | |
47 final int $AT = 64; | |
48 final int $A = 65; | |
49 final int $B = 66; | |
50 final int $C = 67; | |
51 final int $D = 68; | |
52 final int $E = 69; | |
53 final int $F = 70; | |
54 final int $G = 71; | |
55 final int $H = 72; | |
56 final int $I = 73; | |
57 final int $J = 74; | |
58 final int $K = 75; | |
59 final int $L = 76; | |
60 final int $M = 77; | |
61 final int $N = 78; | |
62 final int $O = 79; | |
63 final int $P = 80; | |
64 final int $Q = 81; | |
65 final int $R = 82; | |
66 final int $S = 83; | |
67 final int $T = 84; | |
68 final int $U = 85; | |
69 final int $V = 86; | |
70 final int $W = 87; | |
71 final int $X = 88; | |
72 final int $Y = 89; | |
73 final int $Z = 90; | |
74 final int $OPEN_SQUARE_BRACKET = 91; | |
75 final int $BACKSLASH = 92; | |
76 final int $CLOSE_SQUARE_BRACKET = 93; | |
77 final int $CARET = 94; | |
78 final int $_ = 95; | |
79 final int $BACKPING = 96; | |
80 final int $a = 97; | |
81 final int $b = 98; | |
82 final int $c = 99; | |
83 final int $d = 100; | |
84 final int $e = 101; | |
85 final int $f = 102; | |
86 final int $g = 103; | |
87 final int $h = 104; | |
88 final int $i = 105; | |
89 final int $j = 106; | |
90 final int $k = 107; | |
91 final int $l = 108; | |
92 final int $m = 109; | |
93 final int $n = 110; | |
94 final int $o = 111; | |
95 final int $p = 112; | |
96 final int $q = 113; | |
97 final int $r = 114; | |
98 final int $s = 115; | |
99 final int $t = 116; | |
100 final int $u = 117; | |
101 final int $v = 118; | |
102 final int $w = 119; | |
103 final int $x = 120; | |
104 final int $y = 121; | |
105 final int $z = 122; | |
106 final int $OPEN_CURLY_BRACKET = 123; | |
107 final int $BAR = 124; | |
108 final int $CLOSE_CURLY_BRACKET = 125; | |
109 final int $TILDE = 126; | |
110 final int $DEL = 127; | |
111 final int $NBSP = 160; | |
112 final int $LS = 0x2028; | |
113 final int $PS = 0x2029; | |
114 | |
115 final int $FIRST_SURROGATE = 0xd800; | |
116 final int $LAST_SURROGATE = 0xdfff; | |
117 final 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 } | |
OLD | NEW |