| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of dart.core; | 5 part of dart.core; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A parsed URI, such as a URL. | 8 * A parsed URI, such as a URL. |
| 9 * | 9 * |
| 10 * **See also:** | 10 * **See also:** |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1095 return buffer.toString(); | 1095 return buffer.toString(); |
| 1096 } | 1096 } |
| 1097 | 1097 |
| 1098 /** | 1098 /** |
| 1099 * Validates scheme characters and does case-normalization. | 1099 * Validates scheme characters and does case-normalization. |
| 1100 * | 1100 * |
| 1101 * Schemes are converted to lower case. They cannot contain escapes. | 1101 * Schemes are converted to lower case. They cannot contain escapes. |
| 1102 */ | 1102 */ |
| 1103 static String _makeScheme(String scheme, int end) { | 1103 static String _makeScheme(String scheme, int end) { |
| 1104 if (end == 0) return ""; | 1104 if (end == 0) return ""; |
| 1105 int char = scheme.codeUnitAt(0); | 1105 final int firstCodeUnit = scheme.codeUnitAt(0); |
| 1106 if (!_isAlphabeticCharacter(char)) { | 1106 if (!_isAlphabeticCharacter(firstCodeUnit)) { |
| 1107 _fail(scheme, 0, "Scheme not starting with alphabetic character"); | 1107 _fail(scheme, 0, "Scheme not starting with alphabetic character"); |
| 1108 } | 1108 } |
| 1109 bool allLowercase = char >= _LOWER_CASE_A; | 1109 bool allLowercase = firstCodeUnit >= _LOWER_CASE_A; |
| 1110 for (int i = 0; i < end; i++) { | 1110 for (int i = 0; i < end; i++) { |
| 1111 int codeUnit = scheme.codeUnitAt(i); | 1111 final int codeUnit = scheme.codeUnitAt(i); |
| 1112 if (!_isSchemeCharacter(codeUnit)) { | 1112 if (!_isSchemeCharacter(codeUnit)) { |
| 1113 _fail(scheme, i, "Illegal scheme character"); | 1113 _fail(scheme, i, "Illegal scheme character"); |
| 1114 } | 1114 } |
| 1115 if (_LOWER_CASE_A <= char && _LOWER_CASE_Z >= char) { | 1115 if (codeUnit < _LOWER_CASE_A || codeUnit > _LOWER_CASE_Z) { |
| 1116 allLowercase = false; | 1116 allLowercase = false; |
| 1117 } | 1117 } |
| 1118 } | 1118 } |
| 1119 scheme = scheme.substring(0, end); | 1119 scheme = scheme.substring(0, end); |
| 1120 if (!allLowercase) scheme = scheme.toLowerCase(); | 1120 if (!allLowercase) scheme = scheme.toLowerCase(); |
| 1121 return scheme; | 1121 return scheme; |
| 1122 } | 1122 } |
| 1123 | 1123 |
| 1124 static String _makeUserInfo(String userInfo, int start, int end) { | 1124 static String _makeUserInfo(String userInfo, int start, int end) { |
| 1125 if (userInfo == null) return ""; | 1125 if (userInfo == null) return ""; |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 0xafff, // 0x30 - 0x3f 1111111111110101 | 2368 0xafff, // 0x30 - 0x3f 1111111111110101 |
| 2369 // @ABCDEFGHIJKLMNO | 2369 // @ABCDEFGHIJKLMNO |
| 2370 0xffff, // 0x40 - 0x4f 1111111111111111 | 2370 0xffff, // 0x40 - 0x4f 1111111111111111 |
| 2371 // PQRSTUVWXYZ _ | 2371 // PQRSTUVWXYZ _ |
| 2372 0x87ff, // 0x50 - 0x5f 1111111111100001 | 2372 0x87ff, // 0x50 - 0x5f 1111111111100001 |
| 2373 // abcdefghijklmno | 2373 // abcdefghijklmno |
| 2374 0xfffe, // 0x60 - 0x6f 0111111111111111 | 2374 0xfffe, // 0x60 - 0x6f 0111111111111111 |
| 2375 // pqrstuvwxyz ~ | 2375 // pqrstuvwxyz ~ |
| 2376 0x47ff]; // 0x70 - 0x7f 1111111111100010 | 2376 0x47ff]; // 0x70 - 0x7f 1111111111100010 |
| 2377 } | 2377 } |
| OLD | NEW |