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

Side by Side Diff: compiler/java/com/google/dart/compiler/parser/DartParser.java

Issue 10690099: Fix a build issue w/ non-terminating builds and issues parsing dart:html. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 package com.google.dart.compiler.parser; 5 package com.google.dart.compiler.parser;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.collect.ImmutableSet; 8 import com.google.common.collect.ImmutableSet;
9 import com.google.common.io.CharStreams; 9 import com.google.common.io.CharStreams;
10 import com.google.dart.compiler.DartCompilationError; 10 import com.google.dart.compiler.DartCompilationError;
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 import com.google.dart.compiler.ast.LibraryUnit; 95 import com.google.dart.compiler.ast.LibraryUnit;
96 import com.google.dart.compiler.ast.Modifiers; 96 import com.google.dart.compiler.ast.Modifiers;
97 import com.google.dart.compiler.metrics.CompilerMetrics; 97 import com.google.dart.compiler.metrics.CompilerMetrics;
98 import com.google.dart.compiler.parser.DartScanner.Location; 98 import com.google.dart.compiler.parser.DartScanner.Location;
99 import com.google.dart.compiler.parser.DartScanner.Position; 99 import com.google.dart.compiler.parser.DartScanner.Position;
100 import com.google.dart.compiler.util.Lists; 100 import com.google.dart.compiler.util.Lists;
101 101
102 import java.io.IOException; 102 import java.io.IOException;
103 import java.io.Reader; 103 import java.io.Reader;
104 import java.math.BigInteger; 104 import java.math.BigInteger;
105 import java.net.URI;
105 import java.util.ArrayList; 106 import java.util.ArrayList;
106 import java.util.Collections; 107 import java.util.Collections;
107 import java.util.HashSet; 108 import java.util.HashSet;
108 import java.util.List; 109 import java.util.List;
109 import java.util.Set; 110 import java.util.Set;
110 111
111 /** 112 /**
112 * The Dart parser. Parses a single compilation unit and produces a {@link DartU nit}. 113 * The Dart parser. Parses a single compilation unit and produces a {@link DartU nit}.
113 * The grammar rules are taken from Dart.g revision 557. 114 * The grammar rules are taken from Dart.g revision 557.
114 */ 115 */
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 String sourceCode, 212 String sourceCode,
212 boolean isDietParse, 213 boolean isDietParse,
213 Set<String> prefixes, 214 Set<String> prefixes,
214 DartCompilerListener listener, 215 DartCompilerListener listener,
215 CompilerMetrics compilerMetrics) { 216 CompilerMetrics compilerMetrics) {
216 super(new DartParserCommentsHelper.CommentParserContext(source, sourceCode, listener, compilerMetrics)); 217 super(new DartParserCommentsHelper.CommentParserContext(source, sourceCode, listener, compilerMetrics));
217 this.source = source; 218 this.source = source;
218 this.sourceCode = sourceCode; 219 this.sourceCode = sourceCode;
219 this.isDietParse = isDietParse; 220 this.isDietParse = isDietParse;
220 this.prefixes = prefixes; 221 this.prefixes = prefixes;
221 this.corelibParse = source != null && SystemLibraryManager.isDartUri(source. getUri()); 222
223 if (source != null) {
224 URI srcUri = source.getUri();
225
226 if (srcUri.getScheme() == null) {
227 // TODO(devoncarew): find out when dart:html is being parsed as an exter nal compilation unit
228 // (and our source == a DartSourceString). We're getting hundreds of par ser errors because
229 // of native keywords in a file we don't think is a core library.
230 corelibParse = true;
231 } else {
232 corelibParse = SystemLibraryManager.isDartUri(srcUri);
233 }
234 } else {
235 corelibParse = false;
236 }
222 } 237 }
223 238
224 public static String read(Source source) throws IOException { 239 public static String read(Source source) throws IOException {
225 return read(source.getSourceReader()); 240 return read(source.getSourceReader());
226 } 241 }
227 242
228 public static String read(Reader reader) throws IOException { 243 public static String read(Reader reader) throws IOException {
229 try { 244 try {
230 return CharStreams.toString(reader); 245 return CharStreams.toString(reader);
231 } finally { 246 } finally {
(...skipping 4399 matching lines...) Expand 10 before | Expand all | Expand 10 after
4631 } 4646 }
4632 4647
4633 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen ts) { 4648 private void reportError(DartNode node, ErrorCode errorCode, Object... argumen ts) {
4634 reportError(new DartCompilationError(node, errorCode, arguments)); 4649 reportError(new DartCompilationError(node, errorCode, arguments));
4635 } 4650 }
4636 4651
4637 private boolean currentlyParsingToplevel() { 4652 private boolean currentlyParsingToplevel() {
4638 return !(isParsingInterface || isTopLevelAbstract || isParsingClass); 4653 return !(isParsingInterface || isTopLevelAbstract || isParsingClass);
4639 } 4654 }
4640 } 4655 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698