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

Side by Side Diff: frog/leg/util/characters.dart

Issue 9271037: Inserted string validation as separate task in compiler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments. Created 8 years, 11 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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("characters");
6 6
7 final int $EOF = 0; 7 final int $EOF = 0;
8 final int $STX = 2; 8 final int $STX = 2;
9 final int $TAB = 9; 9 final int $TAB = 9;
10 final int $LF = 10; 10 final int $LF = 10;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 final int $w = 119; 99 final int $w = 119;
100 final int $x = 120; 100 final int $x = 120;
101 final int $y = 121; 101 final int $y = 121;
102 final int $z = 122; 102 final int $z = 122;
103 final int $OPEN_CURLY_BRACKET = 123; 103 final int $OPEN_CURLY_BRACKET = 123;
104 final int $BAR = 124; 104 final int $BAR = 124;
105 final int $CLOSE_CURLY_BRACKET = 125; 105 final int $CLOSE_CURLY_BRACKET = 125;
106 final int $TILDE = 126; 106 final int $TILDE = 126;
107 final int $DEL = 127; 107 final int $DEL = 127;
108 final int $LS = 0x2028; 108 final int $LS = 0x2028;
109 final int $PS = 0x2029; 109 final int $PS = 0x2029;
110
111 final int $FIRST_SURROGATE = 0xd800;
112 final int $LAST_SURROGATE = 0xdfff;
113 final int $LAST_CODE_POINT = 0x10ffff;
114
115 bool isHexDigit(int characterCode) {
116 if (characterCode <= $9) return $0 <= characterCode;
117 characterCode |= $a ^ $A;
118 return ($a <= characterCode && characterCode <= $f);
119 }
120
121 int hexDigitValue(int hexDigit) {
122 assert(isHexDigit(hexDigit));
123 // hexDigit is one of '0'..'9', 'A'..'F' and 'a'..'f'.
124 if (hexDigit <= $9) return hexDigit - $0;
125 return (hexDigit | ($a ^ $A)) - ($a - 10);
126 }
127
128 bool isUnicodeScalarValue(int value) {
129 return value < $FIRST_SURROGATE ||
130 (value > $LAST_SURROGATE && value <= $LAST_CODE_POINT);
131 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698