xfrp/codeinfos

Additional information about XFRP codes.

Types

CodePos = tuple[col, line: int]
Location in a code.   Source Edit
CodeLine = string
  Source Edit
WithCodeInfo[T] = object
  val: T
  startPos, endPos: CodePos
  line: CodeLine
A value and the code fragment which represents the value. It must satisfy startPos < endPos.   Source Edit
CodeInfo = object
  startPos, endPos: CodePos
  line: CodeLine
A code fragment. It must satisfy startPos < endPos.   Source Edit

Funcs

func `$`(pos: CodePos): string {...}{.raises: [], tags: [].}
  Source Edit
func `<`(x, y: CodePos): bool {...}{.raises: [], tags: [].}
  Source Edit
func pretty(line: CodeLine; startPos, endPos: CodePos): string {...}{.raises: [],
    tags: [].}
  Source Edit
func val[T](t: WithCodeInfo[T]): T
  Source Edit
func startPos[T](t: WithCodeInfo[T]): CodePos
  Source Edit
func endPos[T](t: WithCodeInfo[T]): CodePos
  Source Edit
func line[T](t: WithCodeInfo[T]): CodeLine
  Source Edit
func attachCodeInfo[T](val: T; info: CodeInfo): WithCodeInfo[T]
Attach a code fragment to a value.   Source Edit
func codeInfo(startPos, endPos: CodePos; line: CodeLine): CodeInfo {...}{.raises: [],
    tags: [].}
Construct a code fragment.   Source Edit
func codeInfo[T](src: WithCodeInfo[T]): CodeInfo
Extract a code fragment from a value with code information.   Source Edit
func codeInfo(x: CodeInfo): CodeInfo {...}{.raises: [], tags: [].}
Extract a code fragment. This function is actually the identity function.   Source Edit
func pretty(info: CodeInfo): string {...}{.raises: [], tags: [].}
  Source Edit
func pretty[T](data: WithCodeInfo[T]): string
  Source Edit
func `..`[T, U](x: WithCodeInfo[T]; y: WithCodeInfo[U]): CodeInfo
Construct a code fragment from x to y.   Source Edit
func `from`[T](data: T; info: CodeInfo): WithCodeInfo[T]

The same as attachCodeInfo(data, info).

See also:

  Source Edit
func `from`[T, U](data: T; infoSrc: WithCodeInfo[U]): WithCodeInfo[T]

The same as attachCodeInfo(data, infoSrc.codeInfo).

See also:

  Source Edit