OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 parser_helper; | 5 library parser_helper; |
6 | 6 |
7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 | 8 |
9 import "package:compiler/src/elements/elements.dart"; | 9 import "package:compiler/src/elements/elements.dart"; |
10 import "package:compiler/src/tree/tree.dart"; | 10 import "package:compiler/src/tree/tree.dart"; |
11 import "package:compiler/src/scanner/listener.dart"; | 11 import "package:compiler/src/parser/listener.dart"; |
12 import "package:compiler/src/scanner/parser.dart"; | 12 import "package:compiler/src/parser/parser.dart"; |
13 import "package:compiler/src/scanner/partial_parser.dart"; | 13 import "package:compiler/src/parser/partial_parser.dart"; |
14 import "package:compiler/src/scanner/string_scanner.dart"; | 14 import "package:compiler/src/scanner/string_scanner.dart"; |
15 import "package:compiler/src/scanner/token.dart"; | 15 import "package:compiler/src/tokens/token.dart"; |
16 import "package:compiler/src/io/source_file.dart"; | 16 import "package:compiler/src/io/source_file.dart"; |
17 import "package:compiler/src/util/util.dart"; | 17 import "package:compiler/src/util/util.dart"; |
18 | 18 |
19 import "package:compiler/src/elements/modelx.dart" | 19 import "package:compiler/src/elements/modelx.dart" |
20 show CompilationUnitElementX, ElementX, LibraryElementX; | 20 show CompilationUnitElementX, ElementX, LibraryElementX; |
21 | 21 |
22 import "package:compiler/src/compiler.dart"; | 22 import "package:compiler/src/compiler.dart"; |
23 import "package:compiler/src/diagnostics/source_span.dart"; | 23 import "package:compiler/src/diagnostics/source_span.dart"; |
24 import "package:compiler/src/diagnostics/spannable.dart"; | 24 import "package:compiler/src/diagnostics/spannable.dart"; |
25 import "package:compiler/src/diagnostics/diagnostic_listener.dart"; | 25 import "package:compiler/src/diagnostics/diagnostic_listener.dart"; |
26 import "package:compiler/src/diagnostics/messages.dart"; | 26 import "package:compiler/src/diagnostics/messages.dart"; |
27 import "package:compiler/src/script.dart"; | 27 import "package:compiler/src/script.dart"; |
28 | 28 |
29 export "package:compiler/src/diagnostics/diagnostic_listener.dart"; | 29 export "package:compiler/src/diagnostics/diagnostic_listener.dart"; |
30 export 'package:compiler/src/scanner/listener.dart'; | 30 export 'package:compiler/src/parser/listener.dart'; |
31 export 'package:compiler/src/scanner/parser.dart'; | 31 export 'package:compiler/src/parser/parser.dart'; |
32 export 'package:compiler/src/scanner/partial_parser.dart'; | 32 export 'package:compiler/src/parser/partial_parser.dart'; |
33 export "package:compiler/src/scanner/token.dart"; | 33 export "package:compiler/src/tokens/token.dart"; |
34 | 34 |
35 class LoggerCanceler implements DiagnosticListener { | 35 class LoggerCanceler implements DiagnosticListener { |
36 void log(message) { | 36 void log(message) { |
37 print(message); | 37 print(message); |
38 } | 38 } |
39 | 39 |
40 void internalError(node, String message) { | 40 void internalError(node, String message) { |
41 log(message); | 41 log(message); |
42 } | 42 } |
43 | 43 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 ElementListener listener = new ElementListener(compiler, unit, () => id++); | 133 ElementListener listener = new ElementListener(compiler, unit, () => id++); |
134 PartialParser parser = new PartialParser(listener); | 134 PartialParser parser = new PartialParser(listener); |
135 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); | 135 compiler.withCurrentElement(unit, () => parser.parseUnit(tokens)); |
136 return unit.localMembers; | 136 return unit.localMembers; |
137 } | 137 } |
138 | 138 |
139 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { | 139 NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) { |
140 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), | 140 return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens), |
141 diagnosticHandler: diagnosticHandler); | 141 diagnosticHandler: diagnosticHandler); |
142 } | 142 } |
OLD | NEW |