Loc[S: S]¶
Represents a location in a Source at which to parse, or at which a parse has matched.
class val Loc[S: S] is
Hashable ref,
Equatable[Loc[S] val] ref,
Comparable[Loc[S] val] ref,
Stringable box
Implements¶
- Hashable ref
- Equatable[Loc[S] val] ref
- Comparable[Loc[S] val] ref
- Stringable box
Constructors¶
create¶
Create a new location in the given segment.
new val create(
segment': (Cons[ReadSeq[S] val] val | Nil[ReadSeq[S] val] val),
index': USize val = 0)
: Loc[S] val^
Parameters¶
Returns¶
- Loc[S] val^
Public Functions¶
segment¶
Returns¶
- ReadSeq[S] val
index¶
Returns¶
- USize val
is_in¶
Parameters¶
- seg: ReadSeq[S] val
Returns¶
- Bool val
has_value¶
Returns true if there is actually an item at the location, i.e. if the location points to a valid place in the segment.
Returns¶
- Bool val
apply¶
Returns the item at the location.
Returns¶
- val->S ?
next¶
Returns the next location in the source. May not be valid.
Returns¶
- Loc[S] val
add¶
Returns a location n places further in the source. May not be valid.
Parameters¶
- n: USize val
Returns¶
- Loc[S] val
values¶
Parameters¶
Returns¶
- Iterator[val->S] ref
eq¶
Returns true if the two locations point to the same spot in the same segment.
Parameters¶
- that: Loc[S] box
Returns¶
- Bool val
ne¶
Returns true if the two locations do not point to the same spot in the same segment.
Parameters¶
- that: Loc[S] box
Returns¶
- Bool val
gt¶
Returns true if this is further along in the source than that. Should be used sparingly, as it has to count up from this, possibly to the end of the source.
Parameters¶
- that: Loc[S] box
Returns¶
- Bool val
ge¶
Parameters¶
- that: Loc[S] box
Returns¶
- Bool val
lt¶
Returns true if that is further along in the source than this. Should be used sparingly, as it has to count up from that, possibly to the end of the source.
Parameters¶
- that: Loc[S] box
Returns¶
- Bool val
le¶
Parameters¶
- that: Loc[S] box
Returns¶
- Bool val
hash¶
Returns¶
- USize val
string¶
Returns¶
- String iso^
compare¶
Parameters¶
- that: Loc[S] val