type

FileLoc

src @Js
const class FileLoc : Obj

FileLoc is a location within a text file or source string. It includes an optional one-base line number and column number. This class provides a standardized API for text based tools which need to report the line/column numbers of errors.

constructors

make

Constructor for filename string

makeFile

Constructor for file

fields

col

One based line column number or zero if unknown

file

Filename location

inputs

Constant for tool input location

line

One based line number or zero if unknown

synthetic

Constant for synthetic location

unknown

Constant for an unknown location

methods

compare

Comparison operator

equals

Equality operator

hash

Hash code

isUnknown

Is this the unknown location

toStr

Return string representation as "file", "file(line)", or "file(line,col)".

Slot Details

col

src const Int col

One based line column number or zero if unknown

compare

src virtual override Int compare(Obj that)

Comparison operator

equals

src virtual override Bool equals(Obj? that)

Equality operator

file

src const Str file

Filename location

hash

src virtual override Int hash()

Hash code

inputs

src const static FileLoc inputs := FileLoc.make("inputs", 0)

Constant for tool input location

isUnknown

src Bool isUnknown()

Is this the unknown location

line

src const Int line

One based line number or zero if unknown

make

src new make(Str file, Int line := 0, Int col := 0)

Constructor for filename string

makeFile

src static new makeFile(File file, Int line := 0, Int col := 0)

Constructor for file

synthetic

src const static FileLoc synthetic := FileLoc.make("synthetic", 0)

Constant for synthetic location

toStr

src virtual override Str toStr()

Return string representation as "file", "file(line)", or "file(line,col)". This is the standard format used by the Fantom compiler.

unknown

src const static FileLoc unknown := FileLoc.make("unknown", 0)

Constant for an unknown location