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

Side by Side Diff: lib/src/scan.dart

Issue 1950183003: Remove deprecated APIs. (Closed) Base URL: git@github.com:dart-lang/http_parser@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « lib/src/media_type.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// A library for broadly-useful functions and regular expressions for scanning 5 /// A library for broadly-useful functions and regular expressions for scanning
6 /// HTTP entities. 6 /// HTTP entities.
7 /// 7 ///
8 /// Many of the regular expressions come from [section 2.2 of the HTTP 8 /// Many of the regular expressions come from [section 2.2 of the HTTP
9 /// spec][spec]. 9 /// spec][spec].
10 /// 10 ///
(...skipping 19 matching lines...) Expand all
30 final whitespace = new RegExp("(?:${_lws.pattern})*"); 30 final whitespace = new RegExp("(?:${_lws.pattern})*");
31 31
32 /// Parses a list of elements, as in `1#element` in the HTTP spec. 32 /// Parses a list of elements, as in `1#element` in the HTTP spec.
33 /// 33 ///
34 /// [scanner] is used to parse the elements, and [parseElement] is used to parse 34 /// [scanner] is used to parse the elements, and [parseElement] is used to parse
35 /// each one individually. The values returned by [parseElement] are collected 35 /// each one individually. The values returned by [parseElement] are collected
36 /// in a list and returned. 36 /// in a list and returned.
37 /// 37 ///
38 /// Once this is finished, [scanner] will be at the next non-LWS character in 38 /// Once this is finished, [scanner] will be at the next non-LWS character in
39 /// the string, or the end of the string. 39 /// the string, or the end of the string.
40 List parseList(StringScanner scanner, parseElement()) { 40 List/*<T>*/ parseList/*<T>*/(StringScanner scanner, /*=T*/ parseElement()) {
41 var result = []; 41 var result = /*<T>*/[];
42 42
43 // Consume initial empty values. 43 // Consume initial empty values.
44 while (scanner.scan(",")) { 44 while (scanner.scan(",")) {
45 scanner.scan(whitespace); 45 scanner.scan(whitespace);
46 } 46 }
47 47
48 result.add(parseElement()); 48 result.add(parseElement());
49 scanner.scan(whitespace); 49 scanner.scan(whitespace);
50 50
51 while (scanner.scan(",")) { 51 while (scanner.scan(",")) {
(...skipping 14 matching lines...) Expand all
66 /// If [name] is passed, it's used to describe the expected value if it's not 66 /// If [name] is passed, it's used to describe the expected value if it's not
67 /// found. 67 /// found.
68 String expectQuotedString(StringScanner scanner, {String name}) { 68 String expectQuotedString(StringScanner scanner, {String name}) {
69 if (name == null) name = "quoted string"; 69 if (name == null) name = "quoted string";
70 scanner.expect(_quotedString, name: name); 70 scanner.expect(_quotedString, name: name);
71 var string = scanner.lastMatch[0]; 71 var string = scanner.lastMatch[0];
72 return string 72 return string
73 .substring(1, string.length - 1) 73 .substring(1, string.length - 1)
74 .replaceAllMapped(_quotedPair, (match) => match[1]); 74 .replaceAllMapped(_quotedPair, (match) => match[1]);
75 } 75 }
OLDNEW
« no previous file with comments | « lib/src/media_type.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698