| Index: compiler/java/com/google/dart/compiler/parser/DartScanner.java
|
| ===================================================================
|
| --- compiler/java/com/google/dart/compiler/parser/DartScanner.java (revision 13022)
|
| +++ compiler/java/com/google/dart/compiler/parser/DartScanner.java (working copy)
|
| @@ -4,8 +4,10 @@
|
|
|
| package com.google.dart.compiler.parser;
|
|
|
| +import com.google.dart.compiler.DartCompilationError;
|
| import com.google.dart.compiler.DartCompilerListener;
|
| import com.google.dart.compiler.Source;
|
| +import com.google.dart.compiler.common.SourceInfo;
|
| import com.google.dart.compiler.metrics.DartEventType;
|
| import com.google.dart.compiler.metrics.Tracer;
|
| import com.google.dart.compiler.metrics.Tracer.TraceEvent;
|
| @@ -878,11 +880,7 @@
|
| advance();
|
| switch (c) {
|
| case '\n':
|
| - if (!multiLine) {
|
| - // TODO(zundel): better way to report error?
|
| - internalState.resetModes();
|
| - return Token.ILLEGAL;
|
| - }
|
| + reportError(position() - 1, ParserErrorCode.ESCAPED_NEWLINE);
|
| c = '\n';
|
| break;
|
| case 'b':
|
| @@ -1215,13 +1213,8 @@
|
| // Raw strings.
|
| advance();
|
| if (is('\'') || is('"')) {
|
| -// int offset = position() - 1;
|
| Token token = scanString(true);
|
| -// if (listener != null) {
|
| -// listener.onError(new DartCompilationError(
|
| -// new SourceInfo(sourceReference, offset, position() - offset),
|
| -// ParserErrorCode.DEPRECATED_RAW_STRING));
|
| -// }
|
| +// reportError(position() - 1, ParserErrorCode.DEPRECATED_RAW_STRING);
|
| return token;
|
| } else {
|
| return Token.AT;
|
| @@ -1255,6 +1248,14 @@
|
| }
|
| }
|
|
|
| + private void reportError(int offset, ParserErrorCode errorCode) {
|
| + if (listener != null) {
|
| + listener.onError(new DartCompilationError(
|
| + new SourceInfo(sourceReference, offset, position() - offset),
|
| + errorCode));
|
| + }
|
| + }
|
| +
|
| /**
|
| * Scan for #library, #import, #source, and #resource directives
|
| */
|
|
|