Skip to content

Loc[S: S]

[Source]

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


Constructors

create

[Source]

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


Public Functions

segment

[Source]

fun box segment()
: ReadSeq[S] val

Returns


index

[Source]

fun box index()
: USize val

Returns


is_in

[Source]

fun box is_in(
  seg: ReadSeq[S] val)
: Bool val

Parameters

Returns


has_value

[Source]

Returns true if there is actually an item at the location, i.e. if the location points to a valid place in the segment.

fun box has_value()
: Bool val

Returns


apply

[Source]

Returns the item at the location.

fun box apply()
: val->S ?

Returns

  • val->S ?

next

[Source]

Returns the next location in the source. May not be valid.

fun box next()
: Loc[S] val

Returns


add

[Source]

Returns a location n places further in the source. May not be valid.

fun box add(
  n: USize val)
: Loc[S] val

Parameters

Returns


values

[Source]

fun box values(
  nxt: (Loc[S] val | None val) = reference)
: Iterator[val->S] ref

Parameters

  • nxt: (Loc[S] val | None val) = reference

Returns


eq

[Source]

Returns true if the two locations point to the same spot in the same segment.

fun box eq(
  that: Loc[S] box)
: Bool val

Parameters

  • that: Loc[S] box

Returns


ne

[Source]

Returns true if the two locations do not point to the same spot in the same segment.

fun box ne(
  that: Loc[S] box)
: Bool val

Parameters

  • that: Loc[S] box

Returns


gt

[Source]

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.

fun box gt(
  that: Loc[S] box)
: Bool val

Parameters

  • that: Loc[S] box

Returns


ge

[Source]

fun box ge(
  that: Loc[S] box)
: Bool val

Parameters

  • that: Loc[S] box

Returns


lt

[Source]

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.

fun box lt(
  that: Loc[S] box)
: Bool val

Parameters

  • that: Loc[S] box

Returns


le

[Source]

fun box le(
  that: Loc[S] box)
: Bool val

Parameters

  • that: Loc[S] box

Returns


hash

[Source]

fun box hash()
: USize val

Returns


string

[Source]

fun box string()
: String iso^

Returns


compare

[Source]

fun box compare(
  that: Loc[S] val)
: (Less val | Equal val | Greater val)

Parameters

  • that: Loc[S] val

Returns