| 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 part of scanner; | 5 part of scanner; |
| 6 | 6 |
| 7 abstract class Scanner { | 7 abstract class Scanner { |
| 8 Token tokenize(); | 8 Token tokenize(); |
| 9 | 9 |
| 10 factory Scanner(SourceFile file, {bool includeComments: false}) { | 10 factory Scanner(SourceFile file, {bool includeComments: false}) { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 | 193 |
| 194 Token tokenize() { | 194 Token tokenize() { |
| 195 while (!atEndOfFile()) { | 195 while (!atEndOfFile()) { |
| 196 int next = advance(); | 196 int next = advance(); |
| 197 while (!identical(next, $EOF)) { | 197 while (!identical(next, $EOF)) { |
| 198 next = bigSwitch(next); | 198 next = bigSwitch(next); |
| 199 } | 199 } |
| 200 if (atEndOfFile()) { | 200 if (atEndOfFile()) { |
| 201 appendEofToken(); | 201 appendEofToken(); |
| 202 } else { | 202 } else { |
| 203 error('Unexpected $EOF byte in input.'); | 203 error('Unexpected ${$EOF} byte in input.'); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 if (file != null) { | 207 if (file != null) { |
| 208 file.length = stringOffset; | 208 file.length = stringOffset; |
| 209 // One additional line start at the end, see [SourceFile.lineStarts]. | 209 // One additional line start at the end, see [SourceFile.lineStarts]. |
| 210 lineStarts.add(stringOffset + 1); | 210 lineStarts.add(stringOffset + 1); |
| 211 file.lineStarts = lineStarts; | 211 file.lineStarts = lineStarts; |
| 212 } | 212 } |
| 213 | 213 |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 // ignore the [close] token (assuming it's correct), then the error will be | 1081 // ignore the [close] token (assuming it's correct), then the error will be |
| 1082 // reported when parsing the [next] token. | 1082 // reported when parsing the [next] token. |
| 1083 | 1083 |
| 1084 Token next = new StringToken.fromString( | 1084 Token next = new StringToken.fromString( |
| 1085 BAD_INPUT_INFO, error, begin.charOffset, canonicalize: true); | 1085 BAD_INPUT_INFO, error, begin.charOffset, canonicalize: true); |
| 1086 begin.endGroup = close; | 1086 begin.endGroup = close; |
| 1087 close.next = next; | 1087 close.next = next; |
| 1088 next.next = begin.next; | 1088 next.next = begin.next; |
| 1089 } | 1089 } |
| 1090 } | 1090 } |
| OLD | NEW |