diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-08-08 16:08:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-08 16:08:16 +0800 |
commit | 4c6be40b340e3ce70b3ed2207db276cb9c661dbe (patch) | |
tree | 5a51f37532c683a78e6e2be13d049fd15df445bf | |
parent | 37d8f32ae9ead55a065ae42636e88265ea17ce4a (diff) | |
download | Nim-4c6be40b340e3ce70b3ed2207db276cb9c661dbe.tar.gz |
modernize compiler/filter_tmpl.nim (#22407)
-rw-r--r-- | compiler/filter_tmpl.nim | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/compiler/filter_tmpl.nim b/compiler/filter_tmpl.nim index 84ed99164..d04388b96 100644 --- a/compiler/filter_tmpl.nim +++ b/compiler/filter_tmpl.nim @@ -201,17 +201,15 @@ proc parseLine(p: var TTmplParser) = proc filterTmpl*(conf: ConfigRef, stdin: PLLStream, filename: AbsoluteFile, call: PNode): PLLStream = - var p: TTmplParser - p.config = conf - p.info = newLineInfo(conf, filename, 0, 0) - p.outp = llStreamOpen("") - p.inp = stdin - p.subsChar = charArg(conf, call, "subschar", 1, '$') - p.nimDirective = charArg(conf, call, "metachar", 2, '#') - p.emit = strArg(conf, call, "emit", 3, "result.add") - p.conc = strArg(conf, call, "conc", 4, " & ") - p.toStr = strArg(conf, call, "tostring", 5, "$") - p.x = newStringOfCap(120) + var p = TTmplParser(config: conf, info: newLineInfo(conf, filename, 0, 0), + outp: llStreamOpen(""), inp: stdin, + subsChar: charArg(conf, call, "subschar", 1, '$'), + nimDirective: charArg(conf, call, "metachar", 2, '#'), + emit: strArg(conf, call, "emit", 3, "result.add"), + conc: strArg(conf, call, "conc", 4, " & "), + toStr: strArg(conf, call, "tostring", 5, "$"), + x: newStringOfCap(120) + ) # do not process the first line which contains the directive: if llStreamReadLine(p.inp, p.x): inc p.info.line |