| Index: frog/leg/lib/uri_toremove.dart
|
| ===================================================================
|
| --- frog/leg/lib/uri_toremove.dart (revision 5351)
|
| +++ frog/leg/lib/uri_toremove.dart (working copy)
|
| @@ -8,6 +8,7 @@
|
| * A parsed URI, inspired by:
|
| * http://closure-library.googlecode.com/svn/docs/class_goog_Uri.html
|
| */
|
| +// TODO(ngeoffray): Remove this file once Leg support compile-time constants.
|
| class Uri {
|
| final String scheme;
|
| final String userInfo;
|
| @@ -43,25 +44,31 @@
|
| }
|
|
|
| // NOTE: This code was ported from: closure-library/closure/goog/uri/utils.js
|
| - static final RegExp _splitRe = const RegExp(
|
| - '^' +
|
| - '(?:' +
|
| - '([^:/?#.]+)' + // scheme - ignore special characters
|
| - // used by other URL parts such as :,
|
| - // ?, /, #, and .
|
| - ':)?' +
|
| - '(?://' +
|
| - '(?:([^/?#]*)@)?' + // userInfo
|
| - '([\\w\\d\\-\\u0100-\\uffff.%]*)' +
|
| - // domain - restrict to letters,
|
| - // digits, dashes, dots, percent
|
| - // escapes, and unicode characters.
|
| - '(?::([0-9]+))?' + // port
|
| - ')?' +
|
| - '([^?#]+)?' + // path
|
| - '(?:\\?([^#]*))?' + // query
|
| - '(?:#(.*))?' + // fragment
|
| - '\$');
|
| + static RegExp _regexp;
|
| + static RegExp get _splitRe() {
|
| + if (_regexp == null) {
|
| + _regexp = new RegExp(
|
| + '^' +
|
| + '(?:' +
|
| + '([^:/?#.]+)' + // scheme - ignore special characters
|
| + // used by other URL parts such as :,
|
| + // ?, /, #, and .
|
| + ':)?' +
|
| + '(?://' +
|
| + '(?:([^/?#]*)@)?' + // userInfo
|
| + '([\\w\\d\\-\\u0100-\\uffff.%]*)' +
|
| + // domain - restrict to letters,
|
| + // digits, dashes, dots, percent
|
| + // escapes, and unicode characters.
|
| + '(?::([0-9]+))?' + // port
|
| + ')?' +
|
| + '([^?#]+)?' + // path
|
| + '(?:\\?([^#]*))?' + // query
|
| + '(?:#(.*))?' + // fragment
|
| + '\$');
|
| + }
|
| + return _regexp;
|
| + }
|
|
|
| static final _COMPONENT_SCHEME = 1;
|
| static final _COMPONENT_USER_INFO = 2;
|
|
|