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

Side by Side Diff: dart/lib/compiler/implementation/scanner/scanner_task.dart

Issue 10913176: Reject non-ASCII identifiers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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 // 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 LibraryElement importedLibrary = loadLibrary(resolved, argument, resolved); 105 LibraryElement importedLibrary = loadLibrary(resolved, argument, resolved);
106 importLibrary(compilationUnit.getLibrary(), 106 importLibrary(compilationUnit.getLibrary(),
107 importedLibrary, 107 importedLibrary,
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 = new StringScanner(script.text).tokenize();
116 try {
117 tokens = new StringScanner(script.text).tokenize();
118 } on MalformedInputException catch (ex) {
119 Token token;
120 var message;
121 if (ex.position is num) {
122 // TODO(ahe): Always use tokens in MalformedInputException.
123 token = new Token(EOF_INFO, ex.position);
124 } else {
125 token = ex.position;
126 }
127 compiler.cancel(ex.message, token: token);
128 }
129 compiler.dietParser.dietParse(compilationUnit, tokens); 116 compiler.dietParser.dietParse(compilationUnit, tokens);
130 } 117 }
131 118
132 LibraryElement loadLibrary(Uri uri, Node node, Uri canonicalUri) { 119 LibraryElement loadLibrary(Uri uri, Node node, Uri canonicalUri) {
133 bool newLibrary = false; 120 bool newLibrary = false;
134 LibraryElement library = 121 LibraryElement library =
135 compiler.libraries.putIfAbsent(uri.toString(), () { 122 compiler.libraries.putIfAbsent(uri.toString(), () {
136 newLibrary = true; 123 newLibrary = true;
137 Script script = compiler.readScript(uri, node); 124 Script script = compiler.readScript(uri, node);
138 LibraryElement element = new LibraryElement(script, canonicalUri); 125 LibraryElement element = new LibraryElement(script, canonicalUri);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 static const int RESOURCE = 4; 213 static const int RESOURCE = 4;
227 214
228 /** Next state. */ 215 /** Next state. */
229 static const List<int> NEXT = 216 static const List<int> NEXT =
230 const <int>[NO_TAG_SEEN, 217 const <int>[NO_TAG_SEEN,
231 IMPORT, // Only one library tag is allowed. 218 IMPORT, // Only one library tag is allowed.
232 IMPORT, 219 IMPORT,
233 SOURCE, 220 SOURCE,
234 RESOURCE]; 221 RESOURCE];
235 } 222 }
OLDNEW
« no previous file with comments | « dart/lib/compiler/implementation/scanner/scanner.dart ('k') | dart/lib/compiler/implementation/scanner/token.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698