OLD | NEW |
| (Empty) |
1 #!/usr/bin/env dart | |
2 | |
3 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
4 // for details. All rights reserved. Use of this source code is governed by a | |
5 // BSD-style license that can be found in the LICENSE file. | |
6 | |
7 import 'dart:io'; | |
8 | |
9 import 'package:analyzer_experimental/src/generated/scanner.dart'; | |
10 import 'package:analyzer_experimental/src/generated/java_core.dart' show CharSeq
uence; | |
11 | |
12 main() { | |
13 | |
14 print('working dir ${new File('.').fullPathSync()}'); | |
15 | |
16 var args = new Options().arguments; | |
17 if (args.length == 0) { | |
18 print('Usage: scanner_driver [files_to_scan]'); | |
19 exit(0); | |
20 } | |
21 | |
22 for (var arg in args) { | |
23 _scan(new File(arg)); | |
24 } | |
25 | |
26 } | |
27 | |
28 _scan(File file) { | |
29 var src = file.readAsStringSync(); | |
30 var reader = new CharSequenceReader(new CharSequence(src)); | |
31 var scanner = new Scanner(null, reader, null); | |
32 var token = scanner.tokenize(); | |
33 while (token.type != TokenType.EOF) { | |
34 print(token); | |
35 token = token.next; | |
36 } | |
37 } | |
OLD | NEW |