FileSource
class FileSource
Represents a source of characters from a file, with support for lookahead and seeking.
constructor FileSource(Symbol filename)
| Parameter | Description |
|---|---|
filename |
TYPE: |
method void expand_location(Location &location)
Expand a location within the file to include the current location.
If the location is not within the file, it will be left unchanged.
| Parameter | Description |
|---|---|
location |
The location to expand. TYPE: |
method Symbol filename()
Get the name of the file.
| Returns | Description |
|---|---|
Symbol |
The name of the file. |
method int get()
Get the next character from the file. Returns EOF if the end of the file is reached.
| Returns | Description |
|---|---|
int |
The next character from the file, or |
method Location location()
Get the current location in the file.
| Returns | Description |
|---|---|
Location |
The current location in the file. |
method void reset_to(const Location &new_location)
Reset the current position to a new location.
| Parameter | Description |
|---|---|
new_location |
The new location to reset to. TYPE: |
| Throws | Description |
|---|---|
Exception |
If the new location is not within the file. |
method void unget()
Unget the last character read from the file. The next call to get() will return the same character again.
| Throws | Description |
|---|---|
Exception |
If at the beginning of the file. |