# compiler/ropes

Dark Mode

- Index

Search:
Group by:
Source Edit

# Imports

pathutils

# Types

    FormatStr = string

  Source Edit

    Rope = ref RopeObj

  Source Edit

    RopeObj {.acyclic.} = object of RootObj
      left, right: Rope
      L: int
      data*: string

  Source Edit

# Vars

    gCacheIntTries = 0

  Source Edit

    gCacheMisses = 0

  Source Edit

    gCacheTries = 0

  Source Edit

# Procs

    proc `$`(r: Rope): string {....raises: [], tags: [].}

  converts a rope back to a string. Source Edit

    proc `%`(frmt: static[FormatStr]; args: openArray[Rope]): Rope

  Source Edit

    proc `&`(a, b: Rope): Rope {....raises: [], tags: [].}

  Source Edit

    proc `&`(a: openArray[Rope]): Rope {....raises: [], tags: [].}

  the concatenation operator for an openarray of ropes. Source Edit

    proc `&`(a: Rope; b: string): Rope {....raises: [], tags: [].}

  the concatenation operator for ropes. Source Edit

    proc `&`(a: string; b: Rope): Rope {....raises: [], tags: [].}

  the concatenation operator for ropes. Source Edit

    proc add(a: var Rope; b: Rope) {....raises: [], tags: [].}

  adds `b` to the rope `a`. Source Edit

    proc add(a: var Rope; b: string) {....raises: [], tags: [].}

  adds `b` to the rope `a`. Source Edit

    proc equalsFile(r: Rope; f: File): bool {....raises: [IOError],
        tags: [ReadIOEffect].}

  returns true if the contents of the file `f` equal `r`. Source Edit

    proc equalsFile(r: Rope; filename: AbsoluteFile): bool {....raises: [IOError],
        tags: [ReadIOEffect].}

  returns true if the contents of the file `f` equal `r`. If `f` does not exist, false is returned. Source Edit

    proc len(a: Rope): int {....raises: [], tags: [].}

  the rope's length Source Edit

    proc prepend(a: var Rope; b: Rope) {....raises: [], tags: [].}

  Source Edit

    proc prepend(a: var Rope; b: string) {....raises: [], tags: [].}

  Source Edit

    proc resetRopeCache() {....raises: [], tags: [].}

  Source Edit

    proc rope(f: BiggestFloat): Rope {....raises: [], tags: [].}

  Converts a float to a rope. Source Edit

    proc rope(i: BiggestInt): Rope {....raises: [], tags: [].}

  Converts an int to a rope. Source Edit

    proc rope(s: string): Rope {....raises: [], tags: [].}

  Converts a string to a rope. Source Edit

    proc ropeConcat(a: varargs[Rope]): Rope {....raises: [], tags: [].}

  Source Edit

    proc runtimeFormat(frmt: FormatStr; args: openArray[Rope]): Rope {....raises: [],
        tags: [].}

  Source Edit

    proc writeRope(f: File; r: Rope) {....raises: [IOError], tags: [WriteIOEffect].}

  writes a rope to a file. Source Edit

    proc writeRope(head: Rope; filename: AbsoluteFile): bool {....raises: [IOError],
        tags: [WriteIOEffect].}

  Source Edit

    proc writeRopeIfNotEqual(r: Rope; filename: AbsoluteFile): bool {.
        ...raises: [IOError], tags: [ReadIOEffect, WriteIOEffect].}

  Source Edit

# Iterators

    iterator items(r: Rope): char {....raises: [], tags: [].}

  iterates over any character in the rope `r`. Source Edit

    iterator leaves(r: Rope): string {....raises: [], tags: [].}

  iterates over any leaf string in the rope `r`. Source Edit

# Templates

    template `~`(r: string): Rope

  Source Edit

    template addf(c: var Rope; frmt: FormatStr; args: openArray[Rope])

  shortcut for `add(c, frmt % args)`. Source Edit