diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-01-07 15:39:07 -0800 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2020-01-08 00:39:07 +0100 |
commit | 15043d35b88ab0c37f7d007b09eddf1cbe85fa31 (patch) | |
tree | 6d0d1ba6a29710a95966c587a7509763d02b4adb /testament | |
parent | 871d5e79b1dc54c1657a1d7f85788e8bd8f4fb28 (diff) | |
download | Nim-15043d35b88ab0c37f7d007b09eddf1cbe85fa31.tar.gz |
make SuccessX show project file + output file (#13043)
* make SuccessX show project file + output file * address comments * fix test and add `result.err = reNimcCrash` otherwise hard to see where reNimcCrash used * address comments
Diffstat (limited to 'testament')
-rw-r--r-- | testament/testament.nim | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/testament/testament.nim b/testament/testament.nim index 976218f43..a0486cee9 100644 --- a/testament/testament.nim +++ b/testament/testament.nim @@ -74,11 +74,14 @@ let 'template/generic instantiation' ( ' of `' [^`]+ '`' )? ' from here' .* """ pegOtherError = peg"'Error:' \s* {.*}" - pegSuccess = peg"'Hint: operation successful'.*" pegOfInterest = pegLineError / pegOtherError var gTargets = {low(TTarget)..high(TTarget)} +proc isSuccess(input: string): bool = + # not clear how to do the equivalent of pkg/regex's: re"FOO(.*?)BAR" in pegs + input.startsWith("Hint: ") and input.endsWith("[SuccessX]") + proc normalizeMsg(s: string): string = result = newStringOfCap(s.len+1) for x in splitLines(s): @@ -157,7 +160,7 @@ proc callCompiler(cmdTemplate, filename, options, nimcache: string, elif x =~ pegLineTemplate and err == "": # `tmpl` contains the last template expansion before the error tmpl = x - elif x =~ pegSuccess: + elif x.isSuccess: suc = x elif not running(p): break @@ -170,6 +173,7 @@ proc callCompiler(cmdTemplate, filename, options, nimcache: string, result.tfile = "" result.tline = 0 result.tcolumn = 0 + result.err = reNimcCrash if tmpl =~ pegLineTemplate: result.tfile = extractFilename(matches[0]) result.tline = parseInt(matches[1]) @@ -181,7 +185,7 @@ proc callCompiler(cmdTemplate, filename, options, nimcache: string, result.msg = matches[3] elif err =~ pegOtherError: result.msg = matches[0] - elif suc =~ pegSuccess: + elif suc.isSuccess: result.err = reSuccess proc callCCompiler(cmdTemplate, filename, options: string, |