msgs

Imports

options, ropes, lineinfos, pathutils, strutils2

Types

InstantiationInfo = typeof(instantiationInfo())
Source Edit
FilenameOption = enum
  foAbs, foRelProject, foMagicSauce, foName, foStacktrace
Source Edit
MsgFlag = enum
  msgStdout,                ## force writing to stdout, even stderr is default
  msgSkipHook                ## skip message hook even if it is present
flags altering msgWriteln behavior Source Edit
MsgFlags = set[MsgFlag]
Source Edit
TErrorHandling = enum
  doNothing, doAbort, doRaise
Source Edit

Consts

gCmdLineInfo = (line: 1'u, col: 1, fileIndex: -3)
Source Edit
ColOffset = 1
Source Edit
commandLineDesc = "command line"
Source Edit

Procs

proc toCChar(c: char; result: var string) {...}{.raises: [], tags: [].}
Source Edit
proc makeCString(s: string): Rope {...}{.raises: [], tags: [].}
Source Edit
proc fileInfoKnown(conf: ConfigRef; filename: AbsoluteFile): bool {...}{.raises: [],
    tags: [ReadDirEffect].}
Source Edit
proc fileInfoIdx(conf: ConfigRef; filename: AbsoluteFile; isKnownFile: var bool): FileIndex {...}{.
    raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
Source Edit
proc fileInfoIdx(conf: ConfigRef; filename: AbsoluteFile): FileIndex {...}{.
    raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
Source Edit
proc newLineInfo(fileInfoIdx: FileIndex; line, col: int): TLineInfo {...}{.
    raises: [], tags: [].}
Source Edit
proc newLineInfo(conf: ConfigRef; filename: AbsoluteFile; line, col: int): TLineInfo {...}{.
    inline, raises: [KeyError, Exception], tags: [ReadDirEffect, RootEffect].}
Source Edit
proc suggestWriteln(conf: ConfigRef; s: string) {...}{.raises: [IOError, Exception],
    tags: [WriteIOEffect, RootEffect].}
Source Edit
proc msgQuit(x: int8) {...}{.raises: [], tags: [].}
Source Edit
proc msgQuit(x: string) {...}{.raises: [], tags: [].}
Source Edit
proc suggestQuit() {...}{.raises: [ESuggestDone], tags: [].}
Source Edit
proc getInfoContextLen(conf: ConfigRef): int {...}{.raises: [], tags: [].}
Source Edit
proc setInfoContextLen(conf: ConfigRef; L: int) {...}{.raises: [], tags: [].}
Source Edit
proc pushInfoContext(conf: ConfigRef; info: TLineInfo; detail: string = "") {...}{.
    raises: [], tags: [].}
Source Edit
proc popInfoContext(conf: ConfigRef) {...}{.raises: [], tags: [].}
Source Edit
proc getInfoContext(conf: ConfigRef; index: int): TLineInfo {...}{.raises: [],
    tags: [].}
Source Edit
proc toProjPath(conf: ConfigRef; fileIdx: FileIndex): string {...}{.raises: [],
    tags: [].}
Source Edit
proc toFullPath(conf: ConfigRef; fileIdx: FileIndex): string {...}{.raises: [],
    tags: [].}
Source Edit
proc setDirtyFile(conf: ConfigRef; fileIdx: FileIndex; filename: AbsoluteFile) {...}{.
    raises: [], tags: [].}
Source Edit
proc setHash(conf: ConfigRef; fileIdx: FileIndex; hash: string) {...}{.raises: [],
    tags: [].}
Source Edit
proc getHash(conf: ConfigRef; fileIdx: FileIndex): string {...}{.raises: [], tags: [].}
Source Edit
proc toFullPathConsiderDirty(conf: ConfigRef; fileIdx: FileIndex): AbsoluteFile {...}{.
    raises: [], tags: [].}
Source Edit
proc toFilenameOption(conf: ConfigRef; fileIdx: FileIndex; opt: FilenameOption): string {...}{.
    raises: [], tags: [].}
Source Edit
proc toMsgFilename(conf: ConfigRef; info: FileIndex): string {...}{.raises: [],
    tags: [].}
Source Edit
proc toLinenumber(info: TLineInfo): int {...}{.inline, raises: [], tags: [].}
Source Edit
proc toColumn(info: TLineInfo): int {...}{.inline, raises: [], tags: [].}
Source Edit
proc toFileLineCol(conf: ConfigRef; info: TLineInfo): string {...}{.inline,
    raises: [], tags: [].}
Source Edit
proc `$`(conf: ConfigRef; info: TLineInfo): string {...}{.raises: [], tags: [].}
Source Edit
proc `$`(info: TLineInfo): string {...}{.error.}
Source Edit
proc `??`(conf: ConfigRef; info: TLineInfo; filename: string): bool {...}{.
    raises: [], tags: [].}
Source Edit
proc msgWriteln(conf: ConfigRef; s: string; flags: MsgFlags = {}) {...}{.
    raises: [Exception, IOError], tags: [RootEffect, WriteIOEffect].}
Writes given message string to stderr by default. If --stdout option is given, writes to stdout instead. If message hook is present, then it is used to output message rather than stderr/stdout. This behavior can be altered by given optional flags. Source Edit
proc msgKindToString(kind: TMsgKind): string {...}{.raises: [], tags: [].}
Source Edit
proc log(s: string) {...}{.raises: [IOError],
                      tags: [ReadEnvEffect, ReadIOEffect, WriteIOEffect].}
Source Edit
proc `==`(a, b: TLineInfo): bool {...}{.raises: [], tags: [].}
Source Edit
proc exactEquals(a, b: TLineInfo): bool {...}{.raises: [], tags: [].}
Source Edit
proc numLines(conf: ConfigRef; fileIdx: FileIndex): int {...}{.raises: [],
    tags: [ReadIOEffect].}
xxx there's an off by 1 error that should be fixed; if a file ends with "foo" or "foon" it will return same number of lines (ie, a trailing empty line is discounted) Source Edit
proc sourceLine(conf: ConfigRef; i: TLineInfo): string {...}{.raises: [],
    tags: [ReadIOEffect].}
1-based index (matches editor line numbers); 1st line is for i.line = 1 last valid line is numLines inclusive Source Edit
proc formatMsg(conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string): string {...}{.
    raises: [ValueError], tags: [].}
Source Edit
proc liMessage(conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg: string;
               eh: TErrorHandling; info2: InstantiationInfo; isRaw = false) {...}{.
    noinline, raises: [Exception, ValueError, IOError, ERecoverableError],
    tags: [RootEffect, WriteIOEffect, ReadIOEffect, ReadEnvEffect].}
Source Edit
proc quotedFilename(conf: ConfigRef; i: TLineInfo): Rope {...}{.raises: [], tags: [].}
Source Edit
proc listWarnings(conf: ConfigRef) {...}{.raises: [Exception, IOError, ValueError],
                                     tags: [RootEffect, WriteIOEffect].}
Source Edit
proc listHints(conf: ConfigRef) {...}{.raises: [Exception, IOError, ValueError],
                                  tags: [RootEffect, WriteIOEffect].}
Source Edit

Templates

template toFilename(conf: ConfigRef; fileIdx: FileIndex): string
Source Edit
template toFilename(conf: ConfigRef; info: TLineInfo): string
Source Edit
template toProjPath(conf: ConfigRef; info: TLineInfo): string
Source Edit
template toFullPath(conf: ConfigRef; info: TLineInfo): string
Source Edit
template toFullPathConsiderDirty(conf: ConfigRef; info: TLineInfo): string
Source Edit
template toMsgFilename(conf: ConfigRef; info: TLineInfo): string
Source Edit
template styledMsgWriteln(args: varargs[typed])
Source Edit
template rawMessage(conf: ConfigRef; msg: TMsgKind; args: openArray[string])
Source Edit
template rawMessage(conf: ConfigRef; msg: TMsgKind; arg: string)
Source Edit
template fatal(conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg = "")
Source Edit
template globalAssert(conf: ConfigRef; cond: untyped;
                      info: TLineInfo = unknownLineInfo; arg = "")
avoids boilerplate Source Edit
template globalError(conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg = "")
local means compilation keeps going until errorMax is reached (via doNothing), global means it stops. Source Edit
template globalError(conf: ConfigRef; info: TLineInfo; arg: string)
Source Edit
template localError(conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg = "")
Source Edit
template localError(conf: ConfigRef; info: TLineInfo; arg: string)
Source Edit
template localError(conf: ConfigRef; info: TLineInfo; format: string;
                    params: openArray[string])
Source Edit
template message(conf: ConfigRef; info: TLineInfo; msg: TMsgKind; arg = "")
Source Edit
template internalError(conf: ConfigRef; info: TLineInfo; errMsg: string)
Source Edit
template internalError(conf: ConfigRef; errMsg: string)
Source Edit
template internalAssert(conf: ConfigRef; e: bool)
Source Edit
template lintReport(conf: ConfigRef; info: TLineInfo; beau, got: string)
Source Edit

© 2006–2021 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/compiler/msgs.html