Index: compiler/java/com/google/dart/compiler/parser/DartParser.java |
=================================================================== |
--- compiler/java/com/google/dart/compiler/parser/DartParser.java (revision 474) |
+++ compiler/java/com/google/dart/compiler/parser/DartParser.java (working copy) |
@@ -183,7 +183,7 @@ |
private DartParser(Source source, DartCompilerListener listener) throws IOException { |
this(source, source.getSourceReader(), listener); |
} |
- |
+ |
private DartParser(Source source, |
Reader sourceReader, |
DartCompilerListener listener) throws IOException { |
@@ -274,7 +274,7 @@ |
/** |
* A version of the parser which only parses the directives of a library. |
- * |
+ * |
* TODO(jbrosenberg): consider parsing the whole file here, in order to avoid |
* duplicate work. Probably requires removing use of LibraryUnit's, etc. |
* Also, this minimal parse does have benefit in the incremental compilation |
@@ -636,7 +636,7 @@ |
/** |
* Parse a field or method, which may be inside a class or at the top level. |
- * |
+ * |
* <pre> |
* // This rule is organized in a way that may not be most readable, but |
* // gives the best error messages. |
@@ -726,7 +726,7 @@ |
* | NEGATE |
* ; |
* </pre> |
- * |
+ * |
* @param allowStatic true if the static modifier is allowed |
* @return a {@link DartNode} representing the grammar fragment above |
*/ |
@@ -2761,6 +2761,10 @@ |
++parenCount; |
break; |
+ case EOS: |
+ reportErrorWithoutAdvancing(DartCompilerErrorCode.UNEXPECTED_TOKEN); |
+ return; |
+ |
case LBRACE: |
case SEMICOLON: |
return; |
@@ -2819,7 +2823,7 @@ |
* <p> |
* Note that this is a crude heuristic that needs to be improved for better |
* error recovery. |
- * |
+ * |
* @return a {@link DartSyntheticErrorStatement} |
*/ |
private DartStatement parseErrorStatement() { |
@@ -2874,7 +2878,7 @@ |
break; |
} |
- while (true) { |
+ while (true) { |
switch (peek(0)) { |
case EOS: |
return; |
@@ -2892,7 +2896,7 @@ |
return; |
} |
break; |
- |
+ |
case LBRACE: |
++braceCount; |
//$FALL-THROUGH$ |
@@ -2905,7 +2909,7 @@ |
/** |
* Report an error without advancing past the next token. |
- * |
+ * |
* @param errCode the error code to report, which may take a string parameter |
* containing the actual token found |
*/ |
@@ -3178,7 +3182,7 @@ |
done = true; |
done(null); |
} else { |
- if (peek(0) != Token.EOS) { |
+ if (peek(0) != Token.EOS) { |
members.add(parseDefaultMember(label)); |
} |
expectCloseBrace(); |