| OLD | NEW |
| 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 part of vmservice_io; | 5 part of vmservice_io; |
| 6 | 6 |
| 7 _log(msg) { | 7 _log(msg) { |
| 8 print("% $msg"); | 8 print("% $msg"); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Identify split within the line and end of the line. | 163 // Identify split within the line and end of the line. |
| 164 var separator = -1; | 164 var separator = -1; |
| 165 var end = len; | 165 var end = len; |
| 166 // Verifying validity of package name while scanning the line. | 166 // Verifying validity of package name while scanning the line. |
| 167 var nonDot = false; | 167 var nonDot = false; |
| 168 var invalidPackageName = false; | 168 var invalidPackageName = false; |
| 169 | 169 |
| 170 // Scan to the end of the line or data. | 170 // Scan to the end of the line or data. |
| 171 while (index < len) { | 171 while (index < len) { |
| 172 char = data[index++]; | 172 char = data[index++]; |
| 173 // If we have not reached the separator yet, determine whether we are |
| 174 // scanning legal package name characters. |
| 173 if (separator == -1) { | 175 if (separator == -1) { |
| 174 if ((char == _COLON)) { | 176 if ((char == _COLON)) { |
| 175 // The first colon on a line is the separator between package name and | 177 // The first colon on a line is the separator between package name and |
| 176 // related URI. | 178 // related URI. |
| 177 separator = index - 1; | 179 separator = index - 1; |
| 178 } else { | 180 } else { |
| 179 // Still scanning the package name part. Check for the validity of | 181 // Still scanning the package name part. Check for the validity of |
| 180 // the characters. | 182 // the characters. |
| 181 nonDot = nonDot || (char != _DOT); | 183 nonDot = nonDot || (char != _DOT); |
| 182 invalidPackageName = invalidPackageName || | 184 invalidPackageName = invalidPackageName || |
| 183 (char < _SPACE) || (char > _DEL) || | 185 (char < _SPACE) || (char > _DEL) || |
| 184 _invalidPackageNameChars[char - _SPACE]; | 186 _invalidPackageNameChars[char - _SPACE]; |
| 185 } | 187 } |
| 186 } else if ((char == _CR) || (char == _LF)) { | 188 } |
| 187 // Identify end of line. | 189 // Identify end of line. |
| 190 if ((char == _CR) || (char == _LF)) { |
| 188 end = index - 1; | 191 end = index - 1; |
| 189 break; | 192 break; |
| 190 } | 193 } |
| 191 } | 194 } |
| 192 | 195 |
| 193 // No further handling needed for comment lines. | 196 // No further handling needed for comment lines. |
| 194 if (data[start] == _HASH) { | 197 if (data[start] == _HASH) { |
| 195 if (traceLoading) { | 198 if (traceLoading) { |
| 196 _log("Skipping comment in $packagesFile:\n" | 199 _log("Skipping comment in $packagesFile:\n" |
| 197 "${new String.fromCharCodes(data, start, end)}"); | 200 "${new String.fromCharCodes(data, start, end)}"); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 assert(id != null); | 381 assert(id != null); |
| 379 String resource = request[3]; | 382 String resource = request[3]; |
| 380 assert(resource != null); | 383 assert(resource != null); |
| 381 var uri = Uri.parse(resource); | 384 var uri = Uri.parse(resource); |
| 382 if (id >= 0) { | 385 if (id >= 0) { |
| 383 _handleResourceRequest(sp, traceLoading, id, uri); | 386 _handleResourceRequest(sp, traceLoading, id, uri); |
| 384 } else { | 387 } else { |
| 385 _handlePackagesRequest(sp, traceLoading, id, uri); | 388 _handlePackagesRequest(sp, traceLoading, id, uri); |
| 386 } | 389 } |
| 387 } | 390 } |
| OLD | NEW |