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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 */ | 150 */ |
151 Map<String, String> _queryParameters; | 151 Map<String, String> _queryParameters; |
152 | 152 |
153 /** | 153 /** |
154 * Creates a new `Uri` object by parsing a URI string. | 154 * Creates a new `Uri` object by parsing a URI string. |
155 * | 155 * |
156 * If [start] and [end] are provided, only the substring from `start` | 156 * If [start] and [end] are provided, only the substring from `start` |
157 * to `end` is parsed as a URI. | 157 * to `end` is parsed as a URI. |
158 * | 158 * |
159 * If the string is not valid as a URI or URI reference, | 159 * If the string is not valid as a URI or URI reference, |
160 * invalid characters will be percent escaped where possible. | 160 * a [FormatException] is thrown. |
161 * The resulting `Uri` will represent a valid URI or URI reference. | |
162 */ | 161 */ |
163 static Uri parse(String uri, [int start = 0, int end]) { | 162 static Uri parse(String uri, [int start = 0, int end]) { |
164 // This parsing will not validate percent-encoding, IPv6, etc. When done | 163 // This parsing will not validate percent-encoding, IPv6, etc. |
165 // it will call `new Uri(...)` which will perform these validations. | 164 // When done splitting into parts, it will call, e.g., [_makeFragment] |
166 // This is purely splitting up the URI string into components. | 165 // to do the final parsing. |
167 // | 166 // |
168 // Important parts of the RFC 3986 used here: | 167 // Important parts of the RFC 3986 used here: |
169 // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] | 168 // URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ] |
170 // | 169 // |
171 // hier-part = "//" authority path-abempty | 170 // hier-part = "//" authority path-abempty |
172 // / path-absolute | 171 // / path-absolute |
173 // / path-rootless | 172 // / path-rootless |
174 // / path-empty | 173 // / path-empty |
175 // | 174 // |
176 // URI-reference = URI / relative-ref | 175 // URI-reference = URI / relative-ref |
(...skipping 2294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 0xafff, // 0x30 - 0x3f 1111111111110101 | 2470 0xafff, // 0x30 - 0x3f 1111111111110101 |
2472 // @ABCDEFGHIJKLMNO | 2471 // @ABCDEFGHIJKLMNO |
2473 0xffff, // 0x40 - 0x4f 1111111111111111 | 2472 0xffff, // 0x40 - 0x4f 1111111111111111 |
2474 // PQRSTUVWXYZ _ | 2473 // PQRSTUVWXYZ _ |
2475 0x87ff, // 0x50 - 0x5f 1111111111100001 | 2474 0x87ff, // 0x50 - 0x5f 1111111111100001 |
2476 // abcdefghijklmno | 2475 // abcdefghijklmno |
2477 0xfffe, // 0x60 - 0x6f 0111111111111111 | 2476 0xfffe, // 0x60 - 0x6f 0111111111111111 |
2478 // pqrstuvwxyz ~ | 2477 // pqrstuvwxyz ~ |
2479 0x47ff]; // 0x70 - 0x7f 1111111111100010 | 2478 0x47ff]; // 0x70 - 0x7f 1111111111100010 |
2480 } | 2479 } |
OLD | NEW |