|
|
|
|
|
Description |
Position information for syntax. Crucial for giving good error messages.
|
|
Synopsis |
|
|
|
|
Positions
|
|
|
Represents a point in the input (file, position, line, col).
Positions and line and column numbers start from 1.
If two positions have the same srcFile and posPos components,
then the final two components should be the same as well, but since
this can be hard to enforce the program should not rely too much on
the last two components; they are mainly there to improve error
messages for the user.
Note the invariant which positions have to satisfy: positionInvariant.
| Constructors | | Instances | |
|
|
|
|
|
The first position in a file: position 1, line 1, column 1.
|
|
|
Advance the position by one character.
A newline character ('\n') moves the position to the first
character in the next line. Any other character moves the
position to the next column.
|
|
|
Advance the position by a string.
movePosByString = foldl' movePos
|
|
|
Backup the position by one character.
Precondition: The character must not be '\n'.
|
|
Intervals
|
|
|
An interval. The iEnd position is not included in the interval.
Note the invariant which intervals have to satisfy: intervalInvariant.
| Constructors | | Instances | |
|
|
|
|
|
Extracts the interval corresponding to the given string, assuming
that the string starts at the beginning of the given interval.
Precondition: The string must not be too long for the interval.
|
|
|
Removes the interval corresponding to the given string from the
given interval, assuming that the string starts at the beginning of
the interval.
Precondition: The string must not be too long for the interval.
|
|
Ranges
|
|
|
A range is a list of intervals. The intervals should be
consecutive and separated.
Note the invariant which ranges have to satisfy: rangeInvariant.
| Constructors | | Instances | |
|
|
|
|
|
Ranges between two unknown positions
|
|
|
Converts two positions to a range.
|
|
|
The initial position in the range, if any.
|
|
|
The position after the final position in the range, if any.
|
|
|
Converts a range to an interval, if possible.
|
|
|
Returns the shortest continuous range containing the given one.
|
|
|
Removes gaps between intervals on the same line.
|
|
|
Things that have a range are instances of this class.
| | Methods | | | Instances | |
|
|
|
If it is also possible to set the range, this is the class.
Instances should satisfy getRange (setRange r x) == r.
| | Methods | | | Instances | |
|
|
|
Killing the range of an object sets all range information to noRange.
| | Methods | | | Instances | |
|
|
killRange1 |
|
killRange2 |
|
killRange3 |
|
killRange4 |
|
killRange5 |
|
killRange6 |
|
killRange7 |
|
|
x withRangeOf y sets the range of x to the range of y.
|
|
|
|
|
Finds a range which covers the arguments.
|
|
|
beginningOf r is an empty range (a single, empty interval)
positioned at the beginning of r. If r does not have a
beginning, then noRange is returned.
|
|
Tests
|
|
|
Test suite.
|
|
Produced by Haddock version 2.4.2 |