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

Side by Side Diff: pkg/analyzer/example/scanner_driver.dart

Issue 156763002: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
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 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:analyzer/src/generated/scanner.dart'; 9 import 'package:analyzer/src/generated/scanner.dart';
10 import 'package:analyzer/src/generated/java_core.dart' show CharSequence;
11 10
12 main(List<String> args) { 11 main(List<String> args) {
13 12
14 print('working dir ${new File('.').resolveSymbolicLinksSync()}'); 13 print('working dir ${new File('.').resolveSymbolicLinksSync()}');
15 14
16 if (args.length == 0) { 15 if (args.length == 0) {
17 print('Usage: scanner_driver [files_to_scan]'); 16 print('Usage: scanner_driver [files_to_scan]');
18 exit(0); 17 exit(0);
19 } 18 }
20 19
21 for (var arg in args) { 20 for (var arg in args) {
22 _scan(new File(arg)); 21 _scan(new File(arg));
23 } 22 }
24 23
25 } 24 }
26 25
27 _scan(File file) { 26 _scan(File file) {
28 var src = file.readAsStringSync(); 27 var src = file.readAsStringSync();
29 var reader = new CharSequenceReader(new CharSequence(src)); 28 var reader = new CharSequenceReader(src);
30 var scanner = new Scanner(null, reader, null); 29 var scanner = new Scanner(null, reader, 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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698