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