diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-04-06 00:32:08 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-04-06 00:32:08 +0200 |
commit | 99e0fb90e0d66e706cb91f5af126413d3588c97b (patch) | |
tree | b5fea6c809173f951b61dd9daa4fb660bf5dd4d5 /compiler/msgs.nim | |
parent | caf3d9e34246954e648c78f1b95220cc1a67ae5c (diff) | |
parent | 0f131b9f46aed4bd077c2c04e63dc0cacc348930 (diff) | |
download | Nim-99e0fb90e0d66e706cb91f5af126413d3588c97b.tar.gz |
Merge pull request #2428 from arnetheduck/comp-lib-ropes
Comp lib ropes
Diffstat (limited to 'compiler/msgs.nim')
-rw-r--r-- | compiler/msgs.nim | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim index d9db1f670..7fe95f673 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -494,20 +494,16 @@ proc toCChar*(c: char): string = else: result = $(c) proc makeCString*(s: string): PRope = - # BUGFIX: We have to split long strings into many ropes. Otherwise - # this could trigger an internalError(). See the ropes module for - # further information. const MaxLineLength = 64 result = nil - var res = "\"" + var res = newStringOfCap(int(s.len.toFloat * 1.1) + 1) + add(res, "\"") for i in countup(0, len(s) - 1): if (i + 1) mod MaxLineLength == 0: add(res, '\"') add(res, tnl) - app(result, toRope(res)) # reset: - setLen(res, 1) - res[0] = '\"' + add(res, '\"') add(res, toCChar(s[i])) add(res, '\"') app(result, toRope(res)) @@ -776,7 +772,7 @@ proc rawMessage*(msg: TMsgKind, arg: string) = proc writeSurroundingSrc(info: TLineInfo) = const indent = " " - msgWriteln(indent & info.sourceLine.ropeToStr) + msgWriteln(indent & $info.sourceLine) msgWriteln(indent & spaces(info.col) & '^') proc formatMsg*(info: TLineInfo, msg: TMsgKind, arg: string): string = @@ -877,8 +873,6 @@ ropes.errorHandler = proc (err: TRopesError, msg: string, useWarning: bool) = case err of rInvalidFormatStr: internalError("ropes: invalid format string: " & msg) - of rTokenTooLong: - internalError("ropes: token too long: " & msg) of rCannotOpenFile: rawMessage(if useWarning: warnCannotOpenFile else: errCannotOpenFile, msg) |