| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 pub.preprocess; | 5 library pub.preprocess; |
| 6 | 6 |
| 7 import 'package:pub_semver/pub_semver.dart'; |
| 7 import 'package:string_scanner/string_scanner.dart'; | 8 import 'package:string_scanner/string_scanner.dart'; |
| 8 | 9 |
| 9 import 'version.dart'; | |
| 10 | |
| 11 /// Runs a simple preprocessor over [input] to remove sections that are | 10 /// Runs a simple preprocessor over [input] to remove sections that are |
| 12 /// incompatible with the available barback version. | 11 /// incompatible with the available barback version. |
| 13 /// | 12 /// |
| 14 /// [versions] are the available versions of each installed package, and | 13 /// [versions] are the available versions of each installed package, and |
| 15 /// [sourceUrl] is a [String] or [Uri] indicating where [input] came from. It's | 14 /// [sourceUrl] is a [String] or [Uri] indicating where [input] came from. It's |
| 16 /// used for error reporting. | 15 /// used for error reporting. |
| 17 /// | 16 /// |
| 18 /// For the most part, the preprocessor leaves text in the source document | 17 /// For the most part, the preprocessor leaves text in the source document |
| 19 /// alone. However, it handles two types of lines specially. Lines that begin | 18 /// alone. However, it handles two types of lines specially. Lines that begin |
| 20 /// with `//>` are uncommented by the preprocessor, and lines that begin with | 19 /// with `//>` are uncommented by the preprocessor, and lines that begin with |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 _emitText(); | 134 _emitText(); |
| 136 } | 135 } |
| 137 _scanner.expect("//#"); | 136 _scanner.expect("//#"); |
| 138 _scanner.scan(new RegExp(r"[ \t]*")); | 137 _scanner.scan(new RegExp(r"[ \t]*")); |
| 139 } | 138 } |
| 140 | 139 |
| 141 _scanner.expect("end"); | 140 _scanner.expect("end"); |
| 142 if (!_scanner.isDone) _scanner.expect("\n"); | 141 if (!_scanner.isDone) _scanner.expect("\n"); |
| 143 } | 142 } |
| 144 } | 143 } |
| OLD | NEW |