This module handles the reading of config file(s).
- ..note:: Even though this module is very effectful in its processing of a
- config file and updating a ConfigRef, it must not assume that it's handling a 'canonical' ConfigRef for the current program and is not at liberty to output error messages and the like. That must be handled by the caller.
Types
ConfigFileEvent = object case kind*: ConfigFileEventKind of cekParseExpectedX, cekParseExpectedCloseX, cekParseExpectedIdent, cekInvalidDirective, cekWriteConfig, cekProgressPathAdded: location*: TLineInfo ## diagnostic location of cekInternalError, cekLexerErrorDiag, cekLexerWarningDiag: lexerDiag*: LexerDiag of cekFlagError: flagResult*: ProcSwitchResult flagInfo*: TLineInfo of cekProgressConfStart: nil instLoc*: InstantiationInfo ## instantiation in this module's source msg*: string
- Source Edit
ConfigFileEventKind = enum cekInternalError, cekLexerErrorDiag, ## lexer error being forwarded cekParseExpectedX, ## expected some token cekParseExpectedCloseX, ## expected closing ')', ']', etc cekParseExpectedIdent, ## expected an identifier cekInvalidDirective, cekFlagError, ## error from flag processing cekLexerWarningDiag, ## warning from the lexer cekWriteConfig, ## write out the config cekProgressConfStart = "Conf", cekProgressPathAdded = "Path"
- events/errors arising from parsing and processing a compiler config file Source Edit
NimConfEvtWriter = proc (config: ConfigRef; evt: ConfigFileEvent; writeFrom: InstantiationInfo): void
- Source Edit
Procs
proc getSystemConfigPath(conf: ConfigRef; filename: RelativeFile): AbsoluteFile {. ...raises: [OSError], tags: [ReadIOEffect, ReadDirEffect].}
- Source Edit
proc getUserConfigPath(filename: RelativeFile): AbsoluteFile {. ...raises: [OSError], tags: [ReadEnvEffect, ReadIOEffect].}
- Source Edit
proc loadConfigs(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; evtHandler: NimConfEvtWriter; stopOnError: bool = true): bool {. inline, ...raises: [OSError, IOError, Exception, KeyError, EOFError, ValueError, ERecoverableError, CancelConfigProcessing], tags: [ ReadIOEffect, ReadDirEffect, ReadEnvEffect, RootEffect, WriteEnvEffect, WriteDirEffect, WriteIOEffect].}
- Source Edit
proc readConfigFile(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef; evtHandler: NimConfEvtWriter): bool {.inline, ...raises: [ IOError, Exception, KeyError, EOFError, ValueError, OSError, ERecoverableError], tags: [ReadIOEffect, RootEffect, ReadDirEffect, ReadEnvEffect, WriteEnvEffect, WriteDirEffect, WriteIOEffect].}
- Source Edit