OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
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. | |
4 | |
5 library front_end.src.scanner.reader; | |
6 | |
7 /** | |
8 * An object used by the scanner to read the characters to be scanned. | |
9 */ | |
10 abstract class CharacterReader { | |
Brian Wilkerson
2016/11/08 20:53:23
Seems odd to not have a concrete implementation in
Paul Berry
2016/11/08 21:47:06
Acknowledged. Concrete implementations will be mo
| |
11 /** | |
12 * The current offset relative to the beginning of the source. Return the | |
13 * initial offset if the scanner has not yet scanned the source code, and one | |
14 * (1) past the end of the source code if the entire source code has been | |
15 * scanned. | |
16 */ | |
17 int get offset; | |
18 | |
19 /** | |
20 * Set the current offset relative to the beginning of the source to the given | |
21 * [offset]. The new offset must be between the initial offset and one (1) | |
22 * past the end of the source code. | |
23 */ | |
24 void set offset(int offset); | |
25 | |
26 /** | |
27 * Advance the current position and return the character at the new current | |
28 * position. | |
29 */ | |
30 int advance(); | |
31 | |
32 /** | |
33 * Return the substring of the source code between the [start] offset and the | |
34 * modified current position. The current position is modified by adding the | |
35 * [endDelta], which is the number of characters after the current location to | |
36 * be included in the string, or the number of characters before the current | |
37 * location to be excluded if the offset is negative. | |
38 */ | |
39 String getString(int start, int endDelta); | |
40 | |
41 /** | |
42 * Return the character at the current position without changing the current | |
43 * position. | |
44 */ | |
45 int peek(); | |
46 } | |
OLD | NEW |