Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: pkg/front_end/lib/src/fasta/parser/parser_main.dart

Issue 2722223006: Move all main methods to tool/. (Closed)
Patch Set: Update tools/patch_sdk.dart. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/main.dart ('k') | pkg/front_end/lib/src/fasta/run.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.parser.main; 5 library fasta.parser.main;
6 6
7 import 'dart:convert' show LineSplitter, UTF8; 7 import 'dart:convert' show LineSplitter, UTF8;
8 8
9 import 'dart:io' show File; 9 import 'dart:io' show File;
10 10
(...skipping 12 matching lines...) Expand all
23 class DebugListener extends Listener { 23 class DebugListener extends Listener {
24 void handleIdentifier(Token token, IdentifierContext context) { 24 void handleIdentifier(Token token, IdentifierContext context) {
25 logEvent("Identifier: ${token.value}"); 25 logEvent("Identifier: ${token.value}");
26 } 26 }
27 27
28 void logEvent(String name) { 28 void logEvent(String name) {
29 print(name); 29 print(name);
30 } 30 }
31 } 31 }
32 32
33 main(List<String> arguments) async { 33 mainEntryPoint(List<String> arguments) async {
34 for (String argument in arguments) { 34 for (String argument in arguments) {
35 if (argument.startsWith("@")) { 35 if (argument.startsWith("@")) {
36 Uri uri = Uri.base.resolve(argument.substring(1)); 36 Uri uri = Uri.base.resolve(argument.substring(1));
37 await for (String file in new File.fromUri(uri) 37 await for (String file in new File.fromUri(uri)
38 .openRead() 38 .openRead()
39 .transform(UTF8.decoder) 39 .transform(UTF8.decoder)
40 .transform(const LineSplitter())) { 40 .transform(const LineSplitter())) {
41 outLine(uri.resolve(file)); 41 outLine(uri.resolve(file));
42 } 42 }
43 } else { 43 } else {
44 outLine(Uri.base.resolve(argument)); 44 outLine(Uri.base.resolve(argument));
45 } 45 }
46 } 46 }
47 } 47 }
48 48
49 void outLine(Uri uri) { 49 void outLine(Uri uri) {
50 new TopLevelParser(new DebugListener()) 50 new TopLevelParser(new DebugListener())
51 .parseUnit(scan(readBytesFromFileSync(uri)).tokens); 51 .parseUnit(scan(readBytesFromFileSync(uri)).tokens);
52 } 52 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/parser/main.dart ('k') | pkg/front_end/lib/src/fasta/run.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698