| OLD | NEW |
| 1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 /// Tools for loading and parsing platform-configuration files. | 5 /// Tools for loading and parsing platform-configuration files. |
| 6 library plaform_configuration; | 6 library plaform_configuration; |
| 7 | 7 |
| 8 import "dart:async"; | 8 import "dart:async"; |
| 9 |
| 9 import "package:charcode/ascii.dart"; | 10 import "package:charcode/ascii.dart"; |
| 11 |
| 10 import "../compiler_new.dart" as api; | 12 import "../compiler_new.dart" as api; |
| 11 | 13 |
| 12 /// Parses an Ini-like format. | 14 /// Parses an Ini-like format. |
| 13 /// | 15 /// |
| 14 /// Sections are initialized with a name enclosed in brackets. | 16 /// Sections are initialized with a name enclosed in brackets. |
| 15 /// Each section contain zero or more properties of the form "name:value". | 17 /// Each section contain zero or more properties of the form "name:value". |
| 16 /// Empty lines are ignored. | 18 /// Empty lines are ignored. |
| 17 /// Lines starting with # are ignored. | 19 /// Lines starting with # are ignored. |
| 18 /// Duplicate names are not allowed. | 20 /// Duplicate names are not allowed. |
| 19 /// All keys and values will be passed through [String.trim]. | 21 /// All keys and values will be passed through [String.trim]. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return provider.readFromUri(location).then((contents) { | 136 return provider.readFromUri(location).then((contents) { |
| 135 if (contents is String) { | 137 if (contents is String) { |
| 136 contents = contents.codeUnits; | 138 contents = contents.codeUnits; |
| 137 } | 139 } |
| 138 return libraryMappings( | 140 return libraryMappings( |
| 139 parseIni(contents, | 141 parseIni(contents, |
| 140 allowedSections: allowedSections, sourceUri: location), | 142 allowedSections: allowedSections, sourceUri: location), |
| 141 location); | 143 location); |
| 142 }); | 144 }); |
| 143 } | 145 } |
| OLD | NEW |