| 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 /** | 5 /** |
| 6 * Code generation for the file "matchers.dart". | 6 * Code generation for the file "matchers.dart". |
| 7 */ | 7 */ |
| 8 library codegen.matchers; | 8 library codegen.matchers; |
| 9 | 9 |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| 11 | 11 |
| 12 import 'package:analyzer/src/codegen/tools.dart'; |
| 13 |
| 12 import 'api.dart'; | 14 import 'api.dart'; |
| 13 import 'codegen_tools.dart'; | |
| 14 import 'from_html.dart'; | 15 import 'from_html.dart'; |
| 15 import 'implied_types.dart'; | 16 import 'implied_types.dart'; |
| 16 import 'to_html.dart'; | 17 import 'to_html.dart'; |
| 17 | 18 |
| 18 final GeneratedFile target = | 19 final GeneratedFile target = new GeneratedFile( |
| 19 new GeneratedFile('../../test/integration/protocol_matchers.dart', () { | 20 'test/integration/protocol_matchers.dart', (String pkgPath) { |
| 20 CodegenMatchersVisitor visitor = new CodegenMatchersVisitor(readApi()); | 21 CodegenMatchersVisitor visitor = new CodegenMatchersVisitor(readApi(pkgPath)); |
| 21 return visitor.collectCode(visitor.visitApi); | 22 return visitor.collectCode(visitor.visitApi); |
| 22 }); | 23 }); |
| 23 | 24 |
| 24 /** | |
| 25 * Translate spec_input.html into protocol_matchers.dart. | |
| 26 */ | |
| 27 main() { | |
| 28 target.generate(); | |
| 29 } | |
| 30 | |
| 31 class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator { | 25 class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator { |
| 32 /** | 26 /** |
| 33 * Visitor used to produce doc comments. | 27 * Visitor used to produce doc comments. |
| 34 */ | 28 */ |
| 35 final ToHtmlVisitor toHtmlVisitor; | 29 final ToHtmlVisitor toHtmlVisitor; |
| 36 | 30 |
| 37 /** | 31 /** |
| 38 * Short human-readable string describing the context of the matcher being | 32 * Short human-readable string describing the context of the matcher being |
| 39 * created. | 33 * created. |
| 40 */ | 34 */ |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 for (TypeDecl choice in typeUnion.choices) { | 183 for (TypeDecl choice in typeUnion.choices) { |
| 190 if (commaNeeded) { | 184 if (commaNeeded) { |
| 191 write(', '); | 185 write(', '); |
| 192 } | 186 } |
| 193 visitTypeDecl(choice); | 187 visitTypeDecl(choice); |
| 194 commaNeeded = true; | 188 commaNeeded = true; |
| 195 } | 189 } |
| 196 write('])'); | 190 write('])'); |
| 197 } | 191 } |
| 198 } | 192 } |
| OLD | NEW |