lineinfos

This module contains the TMsgKind enum as well as the TLineInfo object.

Types

TMsgKind = enum
  errUnknown, errInternal, errIllFormedAstX, errCannotOpenFile, errXExpected,
  errGridTableNotImplemented, errGeneralParseError, errNewSectionExpected,
  errInvalidDirectiveX, errProveInit, errGenerated, errUser, warnCannotOpenFile,
  warnOctalEscape, warnXIsNeverRead, warnXmightNotBeenInit, warnDeprecated,
  warnConfigDeprecated, warnSmallLshouldNotBeUsed, warnUnknownMagic,
  warnRedefinitionOfLabel, warnUnknownSubstitutionX, warnLanguageXNotSupported,
  warnFieldXNotSupported, warnCommentXIgnored, warnTypelessParam, warnUseBase,
  warnWriteToForeignHeap, warnUnsafeCode, warnUnusedImportX,
  warnInheritFromException, warnEachIdentIsTuple, warnUnsafeSetLen,
  warnUnsafeDefault, warnProveInit, warnProveField, warnProveIndex,
  warnUnreachableElse, warnUnreachableCode, warnStaticIndexCheck, warnGcUnsafe,
  warnGcUnsafe2, warnUninit, warnGcMem, warnDestructor, warnLockLevel,
  warnResultShadowed, warnInconsistentSpacing, warnCaseTransition,
  warnCycleCreated, warnObservableStores, warnUser, hintSuccess, hintSuccessX,
  hintCC, hintLineTooLong, hintXDeclaredButNotUsed, hintXCannotRaiseY,
  hintConvToBaseNotNeeded, hintConvFromXtoItselfNotNeeded, hintExprAlwaysX,
  hintQuitCalled, hintProcessing, hintCodeBegin, hintCodeEnd, hintConf,
  hintPath, hintConditionAlwaysTrue, hintConditionAlwaysFalse, hintName,
  hintPattern, hintExecuting, hintLinking, hintDependency, hintSource,
  hintPerformance, hintStackTrace, hintGCStats, hintGlobalVar, hintExpandMacro,
  hintUser, hintUserRaw, hintExtendedContext, hintMsgOrigin
  Source Edit
TNoteKind = range[warnMin .. hintMax]
  Source Edit
TNoteKinds = set[TNoteKind]
  Source Edit
TFileInfo = object
  fullPath*: AbsoluteFile
  projPath*: RelativeFile
  shortName*: string
  quotedName*: Rope
  quotedFullName*: Rope
  lines*: seq[string]
  dirtyFile*: AbsoluteFile
  hash*: string
  dirty*: bool
  when defined(nimpretty):
      fullContent*: string

  
  Source Edit
FileIndex = distinct int32
  Source Edit
TLineInfo = object
  line*: uint16
  col*: int16
  fileIndex*: FileIndex
  when defined(nimpretty):
      offsetA*, offsetB*: int
      commentOffsetA*, commentOffsetB*: int

  
  Source Edit
TErrorOutput = enum
  eStdOut, eStdErr
  Source Edit
TErrorOutputs = set[TErrorOutput]
  Source Edit
ERecoverableError = object of ValueError
  Source Edit
ESuggestDone = object of ValueError
  Source Edit
Severity {...}{.pure.} = enum
  Hint, Warning, Error
VS Code only supports these three   Source Edit
MsgConfig = object
  trackPos*: TLineInfo
  trackPosAttached*: bool    ## whether the tracking position was attached to
                             ## some close token.
  errorOutputs*: TErrorOutputs
  msgContext*: seq[tuple[info: TLineInfo, detail: string]]
  lastError*: TLineInfo
  filenameToIndexTbl*: Table[string, FileIndex]
  fileInfos*: seq[TFileInfo]
  systemFileIdx*: FileIndex
does not need to be stored in the incremental cache   Source Edit

Consts

explanationsBaseUrl = "https://nim-lang.github.io/Nim"
  Source Edit
MsgKindToStr: array[TMsgKind, string] = ["unknown error", "internal error: $1",
    "illformed AST: $1", "cannot open \'$1\'", "\'$1\' expected",
    "grid table is not implemented", "general parse error",
    "new section expected", "invalid directive: \'$1\'",
    "Cannot prove that \'$1\' is initialized.", "$1", "$1",
    "cannot open \'$1\'",
    "octal escape sequences do not exist; leading zero is ignored",
    "\'$1\' is never read", "\'$1\' might not have been initialized", "$1",
    "config file \'$1\' is deprecated",
    "\'l\' should not be used as an identifier; may look like \'1\' (one)",
    "unknown magic \'$1\' might crash the compiler",
    "redefinition of label \'$1\'", "unknown substitution \'$1\'",
    "language \'$1\' not supported", "field \'$1\' not supported",
    "comment \'$1\' ignored", "\'$1\' has no type. Typeless parameters are deprecated; only allowed for \'template\'",
    "use {.base.} for base methods; baseless methods are deprecated",
    "write to foreign heap", "unsafe code: \'$1\'",
    "imported and not used: \'$1\'", "inherit from a more precise exception type like ValueError, IOError or OSError. If these don\'t suit, inherit from CatchableError or Defect.",
    "each identifier is a tuple", "setLen can potentially expand the sequence, but the element type \'$1\' doesn\'t have a valid default value",
    "The \'$1\' type doesn\'t have a valid default value", "Cannot prove that \'$1\' is initialized. This will become a compile time error in the future.",
    "cannot prove that field \'$1\' is accessible",
    "cannot prove index \'$1\' is valid",
    "unreachable else, all cases are already covered",
    "unreachable code after \'return\' statement or \'{.noReturn.}\' proc",
    "$1", "not GC-safe: \'$1\'", "$1",
    "use explicit initialization of \'$1\' for clarity",
    "\'$1\' uses GC\'ed memory", "usage of a type with a destructor in a non destructible context. This will become a compile time error in the future.",
    "$1", "Special variable \'result\' is shadowed.",
    "Number of spaces around \'$#\' is not consistent",
    "Potential object case transition, instantiate new object instead", "$1",
    "observable stores to \'$1\'", "$1", "operation successful: $#",
    "${loc} lines; ${sec}s; $mem; $build build; proj: $project; out: $output",
    "CC: $1", "line too long", "\'$1\' is declared but not used", "$1",
    "conversion to base object is not needed",
    "conversion from $1 to itself is pointless",
    "expression evaluates always to \'$1\'", "quit() called", "$1",
    "generated code listing:", "end of listing", "used config file \'$1\'",
    "added path: \'$1\'", "condition is always true: \'$1\'",
    "condition is always false: \'$1\'", "$1", "$1", "$1", "$1", "$1", "$1",
    "$1", "$1", "$1", "global variable declared here", "expanded macro: $1",
    "$1", "$1", "$1", "$1"]
  Source Edit
WarningsToStr = ["CannotOpenFile", "OctalEscape", "XIsNeverRead",
                 "XmightNotBeenInit", "Deprecated", "ConfigDeprecated",
                 "SmallLshouldNotBeUsed", "UnknownMagic", "RedefinitionOfLabel",
                 "UnknownSubstitutionX", "LanguageXNotSupported",
                 "FieldXNotSupported", "CommentXIgnored", "TypelessParam",
                 "UseBase", "WriteToForeignHeap", "UnsafeCode", "UnusedImport",
                 "InheritFromException", "EachIdentIsTuple", "UnsafeSetLen",
                 "UnsafeDefault", "ProveInit", "ProveField", "ProveIndex",
                 "UnreachableElse", "UnreachableCode", "IndexCheck", "GcUnsafe",
                 "GcUnsafe2", "Uninit", "GcMem", "Destructor", "LockLevel",
                 "ResultShadowed", "Spacing", "CaseTransition", "CycleCreated",
                 "ObservableStores", "User"]
  Source Edit
HintsToStr = ["Success", "SuccessX", "CC", "LineTooLong", "XDeclaredButNotUsed",
              "XCannotRaiseY", "ConvToBaseNotNeeded",
              "ConvFromXtoItselfNotNeeded", "ExprAlwaysX", "QuitCalled",
              "Processing", "CodeBegin", "CodeEnd", "Conf", "Path", "CondTrue",
              "CondFalse", "Name", "Pattern", "Exec", "Link", "Dependency",
              "Source", "Performance", "StackTrace", "GCStats", "GlobalVar",
              "ExpandMacro", "User", "UserRaw", "ExtendedContext", "MsgOrigin"]
  Source Edit
fatalMin = errUnknown
  Source Edit
fatalMax = errInternal
  Source Edit
errMin = errUnknown
  Source Edit
errMax = errUser
  Source Edit
warnMin = warnCannotOpenFile
  Source Edit
warnMax = warnUser
  Source Edit
hintMin = hintSuccess
  Source Edit
hintMax = hintMsgOrigin
  Source Edit
NotesVerbosity = [{warnCannotOpenFile..warnProveInit,
                   warnUnreachableElse..warnStaticIndexCheck, warnGcUnsafe2,
                   warnGcMem..warnCycleCreated, warnUser,
                   hintLineTooLong..hintQuitCalled,
                   hintConditionAlwaysTrue..hintName, hintPerformance,
                   hintExpandMacro..hintUserRaw}, {
    warnCannotOpenFile..warnProveInit,
    warnUnreachableElse..warnStaticIndexCheck, warnGcUnsafe2,
    warnGcMem..warnCycleCreated, warnUser..hintProcessing, hintConf,
    hintConditionAlwaysTrue..hintLinking, hintPerformance,
    hintExpandMacro..hintUserRaw}, {warnCannotOpenFile..warnGcUnsafe2,
                                    warnGcMem..warnCycleCreated,
                                    warnUser..hintPerformance,
                                    hintGCStats..hintUserRaw, hintMsgOrigin},
                  {12..49, 51..83}]
  Source Edit
errXMustBeCompileTime = "\'$1\' can only be used in compile-time context"
  Source Edit
errArgsNeedRunOption = "arguments can only be given if the \'--run\' option is selected"
  Source Edit
InvalidFileIdx = -1'i32
  Source Edit
unknownLineInfo = (line: 0'u, col: -1, fileIndex: -1)
  Source Edit
trackPosInvalidFileIdx = -2'i32
  Source Edit
commandLineIdx = -3'i32
  Source Edit

Procs

proc createDocLink(urlSuffix: string): string {...}{.raises: [], tags: [].}
  Source Edit
proc msgToStr(msg: TMsgKind): string {...}{.raises: [], tags: [].}
  Source Edit
proc `==`(a, b: FileIndex): bool {...}{.borrow.}
  Source Edit
proc hash(i: TLineInfo): Hash {...}{.raises: [], tags: [].}
  Source Edit
proc raiseRecoverableError(msg: string) {...}{.noinline, raises: [ERecoverableError],
    tags: [].}
  Source Edit
proc initMsgConfig(): MsgConfig {...}{.raises: [], tags: [].}
  Source Edit