diff options
author | Araq <rumpf_a@web.de> | 2018-12-06 16:37:56 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2018-12-11 21:23:23 +0100 |
commit | 3b783f7e131c6b5be5057127985d8ccb699d6d06 (patch) | |
tree | 2d1b08daa8b7a42912fd415bdc0242ee512c9558 /lib | |
parent | 8896770f8f9fa7057a11598b64160e7bce6a4266 (diff) | |
download | Nim-3b783f7e131c6b5be5057127985d8ccb699d6d06.tar.gz |
Testament: refactoring; makes the test joiner green
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/parsecfg.nim | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/pure/parsecfg.nim b/lib/pure/parsecfg.nim index efe679d67..b991dd57f 100644 --- a/lib/pure/parsecfg.nim +++ b/lib/pure/parsecfg.nim @@ -386,6 +386,17 @@ proc warningStr*(c: CfgParser, msg: string): string {.rtl, extern: "npc$1".} = result = `%`("$1($2, $3) Warning: $4", [c.filename, $getLine(c), $getColumn(c), msg]) +proc ignoreMsg*(c: CfgParser, e: CfgEvent): string {.rtl, extern: "npc$1".} = + ## returns a properly formatted warning message containing that + ## an entry is ignored. + case e.kind + of cfgSectionStart: result = c.warningStr("section ignored: " & e.section) + of cfgKeyValuePair: result = c.warningStr("key ignored: " & e.key) + of cfgOption: + result = c.warningStr("command ignored: " & e.key & ": " & e.value) + of cfgError: result = e.msg + of cfgEof: result = "" + proc getKeyValPair(c: var CfgParser, kind: CfgEventKind): CfgEvent = if c.tok.kind == tkSymbol: result.kind = kind |