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

Side by Side Diff: pkg/compiler/lib/src/js/characters.dart

Issue 917033002: Redo "Steps towards making dart2js JS AST templates an indepentent library." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « pkg/compiler/lib/src/js/builder.dart ('k') | pkg/compiler/lib/src/js/js.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library characters; 5 library js_character_codes;
6 6
7 const int $EOF = 0; 7 const int $EOF = 0;
8 const int $STX = 2; 8 const int $STX = 2;
9 const int $BS = 8; 9 const int $BS = 8;
10 const int $TAB = 9; 10 const int $TAB = 9;
11 const int $LF = 10; 11 const int $LF = 10;
12 const int $VTAB = 11; 12 const int $VTAB = 11;
13 const int $FF = 12; 13 const int $FF = 12;
14 const int $CR = 13; 14 const int $CR = 13;
15 const int $SPACE = 32; 15 const int $SPACE = 32;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 const int $CLOSE_CURLY_BRACKET = 125; 108 const int $CLOSE_CURLY_BRACKET = 125;
109 const int $TILDE = 126; 109 const int $TILDE = 126;
110 const int $DEL = 127; 110 const int $DEL = 127;
111 const int $NBSP = 160; 111 const int $NBSP = 160;
112 const int $LS = 0x2028; 112 const int $LS = 0x2028;
113 const int $PS = 0x2029; 113 const int $PS = 0x2029;
114 114
115 const int $FIRST_SURROGATE = 0xd800; 115 const int $FIRST_SURROGATE = 0xd800;
116 const int $LAST_SURROGATE = 0xdfff; 116 const int $LAST_SURROGATE = 0xdfff;
117 const int $LAST_CODE_POINT = 0x10ffff; 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
« no previous file with comments | « pkg/compiler/lib/src/js/builder.dart ('k') | pkg/compiler/lib/src/js/js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698