| 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 class ScannerTask extends CompilerTask { | 5 class ScannerTask extends CompilerTask { |
| 6 ScannerTask(Compiler compiler) : super(compiler); | 6 ScannerTask(Compiler compiler) : super(compiler); |
| 7 String get name => 'Scanner'; | 7 String get name => 'Scanner'; |
| 8 | 8 |
| 9 void scanLibrary(LibraryElement library) { | 9 void scanLibrary(LibraryElement library) { |
| 10 var compilationUnit = library.entryCompilationUnit; | 10 var compilationUnit = library.entryCompilationUnit; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 tag, | 108 tag, |
| 109 compilationUnit); | 109 compilationUnit); |
| 110 return resolved; | 110 return resolved; |
| 111 } | 111 } |
| 112 | 112 |
| 113 void scanElements(CompilationUnitElement compilationUnit) { | 113 void scanElements(CompilationUnitElement compilationUnit) { |
| 114 Script script = compilationUnit.script; | 114 Script script = compilationUnit.script; |
| 115 Token tokens; | 115 Token tokens; |
| 116 try { | 116 try { |
| 117 tokens = new StringScanner(script.text).tokenize(); | 117 tokens = new StringScanner(script.text).tokenize(); |
| 118 } catch (MalformedInputException ex) { | 118 } on MalformedInputException catch (ex) { |
| 119 Token token; | 119 Token token; |
| 120 var message; | 120 var message; |
| 121 if (ex.position is num) { | 121 if (ex.position is num) { |
| 122 // TODO(ahe): Always use tokens in MalformedInputException. | 122 // TODO(ahe): Always use tokens in MalformedInputException. |
| 123 token = new Token(EOF_INFO, ex.position); | 123 token = new Token(EOF_INFO, ex.position); |
| 124 } else { | 124 } else { |
| 125 token = ex.position; | 125 token = ex.position; |
| 126 } | 126 } |
| 127 compiler.cancel(ex.message, token: token); | 127 compiler.cancel(ex.message, token: token); |
| 128 } | 128 } |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 static const int RESOURCE = 4; | 226 static const int RESOURCE = 4; |
| 227 | 227 |
| 228 /** Next state. */ | 228 /** Next state. */ |
| 229 static const List<int> NEXT = | 229 static const List<int> NEXT = |
| 230 const <int>[NO_TAG_SEEN, | 230 const <int>[NO_TAG_SEEN, |
| 231 IMPORT, // Only one library tag is allowed. | 231 IMPORT, // Only one library tag is allowed. |
| 232 IMPORT, | 232 IMPORT, |
| 233 SOURCE, | 233 SOURCE, |
| 234 RESOURCE]; | 234 RESOURCE]; |
| 235 } | 235 } |
| OLD | NEW |