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 #library('dart:uri'); | 5 #library('dart:uri'); |
6 | 6 |
7 #import('dart:math'); | 7 #import('dart:math'); |
8 #import('dart:utf'); | 8 #import('dart:utf'); |
9 | 9 |
10 #source('encode_decode.dart'); | 10 #source('encode_decode.dart'); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 static int _parseIntOrZero(String val) { | 50 static int _parseIntOrZero(String val) { |
51 if (val != null && val != '') { | 51 if (val != null && val != '') { |
52 return int.parse(val); | 52 return int.parse(val); |
53 } else { | 53 } else { |
54 return 0; | 54 return 0; |
55 } | 55 } |
56 } | 56 } |
57 | 57 |
58 // NOTE: This code was ported from: closure-library/closure/goog/uri/utils.js | 58 // NOTE: This code was ported from: closure-library/closure/goog/uri/utils.js |
59 static final RegExp _splitRe = new RegExp( | 59 static const RegExp _splitRe = const RegExp( |
60 '^' | 60 '^' |
61 '(?:' | 61 '(?:' |
62 '([^:/?#.]+)' // scheme - ignore special characters | 62 '([^:/?#.]+)' // scheme - ignore special characters |
63 // used by other URL parts such as :, | 63 // used by other URL parts such as :, |
64 // ?, /, #, and . | 64 // ?, /, #, and . |
65 ':)?' | 65 ':)?' |
66 '(?://' | 66 '(?://' |
67 '(?:([^/?#]*)@)?' // userInfo | 67 '(?:([^/?#]*)@)?' // userInfo |
68 '([\\w\\d\\-\\u0100-\\uffff.%]*)' | 68 '([\\w\\d\\-\\u0100-\\uffff.%]*)' |
69 // domain - restrict to letters, | 69 // domain - restrict to letters, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 static void _addIfNonEmpty(StringBuffer sb, String test, | 232 static void _addIfNonEmpty(StringBuffer sb, String test, |
233 String first, String second) { | 233 String first, String second) { |
234 if ("" != test) { | 234 if ("" != test) { |
235 sb.add(first == null ? "null" : first); | 235 sb.add(first == null ? "null" : first); |
236 sb.add(second == null ? "null" : second); | 236 sb.add(second == null ? "null" : second); |
237 } | 237 } |
238 } | 238 } |
239 } | 239 } |
OLD | NEW |