Skip to main content

Source

export interface Source {
  content: string
  getChar(i: number): string
  getPosition(i: number): [number, number]
  getWord(i: number): string
  length: number
  lineEndLocations: number[]
  moduleName?: string
  moreInfo?: string
  name: string
  pretty(): string
  project?: string
  purpose?: string
}
Source wraps a string so that it can be passed by reference.

Source can also be given additional context information, which is useful during debugging.

Source is used by textual-Uplc, IR and Helios.

Instantiate a Source instance with makeSource.

Properties

content

content: string

getChar

getChar(i: number): string

getPosition

getPosition(i: number): [number, number]

getWord

getWord(i: number): string

length

length: number
length is a separate field because of performance

lineEndLocations

lineEndLocations: number[]

moduleName

moduleName?: string
optional helios-specific script/module name, parsed from the script header

moreInfo

moreInfo?: string
optional additional info about the source

name

name: string
provided filename (or script name parsed from script header)

pretty

pretty(): string

project

project?: string
optional project name in which the module is defined

purpose

purpose?: string
optional helios-specific script purpose, parsed from the script header