diff options
author | Araq <rumpf_a@web.de> | 2011-05-14 01:13:44 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-05-14 01:13:44 +0200 |
commit | 3e9dcc8be5d1286e3647e8f665f456966aa02437 (patch) | |
tree | 8bc3b42f28feba6f93c0bd3c386dcb82eabff484 /compiler | |
parent | 32241aa9fe1a22f388124a6e5db8fb0517f01789 (diff) | |
download | Nim-3e9dcc8be5d1286e3647e8f665f456966aa02437.tar.gz |
deprecated system.copy: use system.substr instead
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/cgen.nim | 10 | ||||
-rwxr-xr-x | compiler/commands.nim | 4 | ||||
-rwxr-xr-x | compiler/docgen.nim | 6 | ||||
-rwxr-xr-x | compiler/filter_tmpl.nim | 6 | ||||
-rwxr-xr-x | compiler/llstream.nim | 2 | ||||
-rwxr-xr-x | compiler/nimrod.nim | 4 | ||||
-rwxr-xr-x | compiler/nstrtabs.nim | 6 | ||||
-rwxr-xr-x | compiler/options.nim | 8 | ||||
-rwxr-xr-x | compiler/pragmas.nim | 8 | ||||
-rwxr-xr-x | compiler/renderer.nim | 2 | ||||
-rwxr-xr-x | compiler/ropes.nim | 2 | ||||
-rwxr-xr-x | compiler/semfold.nim | 4 | ||||
-rwxr-xr-x | compiler/sigmatch.nim | 4 | ||||
-rwxr-xr-x | compiler/syntaxes.nim | 2 |
14 files changed, 34 insertions, 34 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 619caf250..61cd36c42 100755 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -210,7 +210,7 @@ proc ropecg(m: BModule, frmt: TFormatStr, args: openarray[PRope]): PRope = inc(i) var j = i while frmt[j] in IdentChars: inc(j) - var ident = copy(frmt, i, j-1) + var ident = substr(frmt, i, j-1) i = j app(result, cgsym(m, ident)) elif frmt[i] == '#' and frmt[i+1] == '$': @@ -225,7 +225,7 @@ proc ropecg(m: BModule, frmt: TFormatStr, args: openarray[PRope]): PRope = if frmt[i] != '$' and frmt[i] != '#': inc(i) else: break if i - 1 >= start: - app(result, copy(frmt, start, i - 1)) + app(result, substr(frmt, start, i - 1)) proc appcg(m: BModule, c: var PRope, frmt: TFormatStr, args: openarray[PRope]) = @@ -489,9 +489,9 @@ proc libCandidates(s: string, dest: var TStringSeq) = var le = strutils.find(s, '(') var ri = strutils.find(s, ')', le+1) if le >= 0 and ri > le: - var prefix = copy(s, 0, le - 1) - var suffix = copy(s, ri + 1) - for middle in split(copy(s, le + 1, ri - 1), '|'): + var prefix = substr(s, 0, le - 1) + var suffix = substr(s, ri + 1) + for middle in split(substr(s, le + 1, ri - 1), '|'): libCandidates(prefix & middle & suffix, dest) else: add(dest, s) diff --git a/compiler/commands.nim b/compiler/commands.nim index d3eaf94a9..a4763d6b2 100755 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -172,7 +172,7 @@ proc splitSwitch(switch: string, cmd, arg: var string, pass: TCmdLinePass, else: break inc(i) if i >= len(switch): arg = "" - elif switch[i] in {':', '=', '['}: arg = copy(switch, i + 1) + elif switch[i] in {':', '=', '['}: arg = substr(switch, i + 1) else: InvalidCmdLineOption(pass, switch, info) proc ProcessOnOffSwitch(op: TOptions, arg: string, pass: TCmdlinePass, @@ -215,7 +215,7 @@ proc ProcessSpecificNote(arg: string, state: TSpecialWord, pass: TCmdlinePass, var x = findStr(msgs.WarningsToStr, id) if x >= 0: n = TNoteKind(x + ord(warnMin)) else: InvalidCmdLineOption(pass, arg, info) - case whichKeyword(copy(arg, i)) + case whichKeyword(substr(arg, i)) of wOn: incl(gNotes, n) of wOff: excl(gNotes, n) else: LocalError(info, errOnOrOffExpectedButXFound, arg) diff --git a/compiler/docgen.nim b/compiler/docgen.nim index eeb40f256..64973cddd 100755 --- a/compiler/docgen.nim +++ b/compiler/docgen.nim @@ -156,7 +156,7 @@ proc ropeFormatNamedVars(frmt: TFormatStr, varnames: openarray[string], while i < L: if (frmt[i] != '$'): inc(i) else: break - if i - 1 >= start: app(result, copy(frmt, start, i - 1)) + if i - 1 >= start: app(result, substr(frmt, start, i - 1)) proc addXmlChar(dest: var string, c: Char) = case c @@ -581,10 +581,10 @@ proc renderCodeBlock(d: PDoc, n: PRstNode): PRope = case g.kind of gtEof: break of gtNone, gtWhitespace: - app(result, copy(m.text, g.start + 0, g.length + g.start - 1 + 0)) + app(result, substr(m.text, g.start + 0, g.length + g.start - 1)) else: dispA(result, "<span class=\"$2\">$1</span>", "\\span$2{$1}", [ - toRope(esc(copy(m.text, g.start + 0, g.length + g.start - 1 + 0))), + toRope(esc(substr(m.text, g.start + 0, g.length + g.start - 1))), toRope(tokenClassToStr[g.kind])]) deinitGeneralTokenizer(g) if result != nil: diff --git a/compiler/filter_tmpl.nim b/compiler/filter_tmpl.nim index 0bb402874..e56a08552 100755 --- a/compiler/filter_tmpl.nim +++ b/compiler/filter_tmpl.nim @@ -93,14 +93,14 @@ proc parseLine(p: var TTmplParser) = of wIf, wWhen, wTry, wWhile, wFor, wBlock, wCase, wProc, wIterator, wConverter, wMacro, wTemplate, wMethod: LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, copy(p.x, d)) + LLStreamWrite(p.outp, substr(p.x, d)) inc(p.indent, 2) of wElif, wOf, wElse, wExcept, wFinally: LLStreamWrite(p.outp, repeatChar(p.indent - 2)) - LLStreamWrite(p.outp, copy(p.x, d)) + LLStreamWrite(p.outp, substr(p.x, d)) else: LLStreamWrite(p.outp, repeatChar(p.indent)) - LLStreamWrite(p.outp, copy(p.x, d)) + LLStreamWrite(p.outp, substr(p.x, d)) p.state = psDirective else: # data line diff --git a/compiler/llstream.nim b/compiler/llstream.nim index 8dfa1e78e..2da56bccd 100755 --- a/compiler/llstream.nim +++ b/compiler/llstream.nim @@ -216,7 +216,7 @@ proc LLStreamReadAll(s: PLLStream): string = result = "" of llsString: if s.rd == 0: result = s.s - else: result = copy(s.s, s.rd + 0) + else: result = substr(s.s, s.rd) s.rd = len(s.s) of llsFile: result = newString(bufSize) diff --git a/compiler/nimrod.nim b/compiler/nimrod.nim index d9580d955..e4a9d8827 100755 --- a/compiler/nimrod.nim +++ b/compiler/nimrod.nim @@ -33,8 +33,8 @@ proc ProcessCmdLine(pass: TCmdLinePass, command, filename: var string) = # we fix this here var bracketLe = strutils.find(p.key, '[') if bracketLe >= 0: - var key = copy(p.key, 0, bracketLe - 1) - var val = copy(p.key, bracketLe + 1) & ':' & p.val + var key = substr(p.key, 0, bracketLe - 1) + var val = substr(p.key, bracketLe + 1) & ':' & p.val ProcessSwitch(key, val, pass, cmdLineInfo) else: ProcessSwitch(p.key, p.val, pass, cmdLineInfo) diff --git a/compiler/nstrtabs.nim b/compiler/nstrtabs.nim index 811e461cc..cd30887c5 100755 --- a/compiler/nstrtabs.nim +++ b/compiler/nstrtabs.nim @@ -153,13 +153,13 @@ proc `%`(f: string, t: PStringTable, flags: TFormatFlags = {}): string = of '{': var j = i + 1 while (j <= len(f) + 0 - 1) and (f[j] != '}'): inc(j) - var key = copy(f, i + 2 + 0 - 1, j - 1 + 0 - 1) + var key = substr(f, i + 2 + 0 - 1, j - 1 + 0 - 1) add(result, getValue(t, flags, key)) i = j + 1 of 'a'..'z', 'A'..'Z', '\x80'..'\xFF', '_': var j = i + 1 while (j <= len(f) + 0 - 1) and (f[j] in PatternChars): inc(j) - var key = copy(f, i + 1 + 0 - 1, j - 1 + 0 - 1) + var key = substr(f, i + 1 + 0 - 1, j - 1 + 0 - 1) add(result, getValue(t, flags, key)) i = j else: @@ -168,4 +168,4 @@ proc `%`(f: string, t: PStringTable, flags: TFormatFlags = {}): string = else: add(result, f[i]) inc(i) - \ No newline at end of file + diff --git a/compiler/options.nim b/compiler/options.nim index 9dec04475..b4ee8cf67 100755 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -138,19 +138,19 @@ proc shortenDir(dir: string): string = # returns the interesting part of a dir var prefix = getPrefixDir() & dirSep if startsWith(dir, prefix): - return copy(dir, len(prefix)) + return substr(dir, len(prefix)) prefix = getCurrentDir() & dirSep if startsWith(dir, prefix): - return copy(dir, len(prefix)) + return substr(dir, len(prefix)) prefix = projectPath & dirSep #writeln(output, prefix); #writeln(output, dir); if startsWith(dir, prefix): - return copy(dir, len(prefix)) + return substr(dir, len(prefix)) result = dir proc removeTrailingDirSep*(path: string): string = if (len(path) > 0) and (path[len(path) - 1] == dirSep): - result = copy(path, 0, len(path) - 2) + result = substr(path, 0, len(path) - 2) else: result = path diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index c94b8b68b..7c78570e2 100755 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -119,7 +119,7 @@ proc processMagic(c: PContext, n: PNode, s: PSym) = # treat them as imported, instead of modifing a lot of working code # BUGFIX: magic does not imply ``lfNoDecl`` anymore! for m in countup(low(TMagic), high(TMagic)): - if copy($m, 1) == v: + if substr($m, 1) == v: s.magic = m return Message(n.info, warnUnknownMagic, v) @@ -333,12 +333,12 @@ proc semAsmOrEmit*(con: PContext, n: PNode, marker: char): PNode = var a = 0 while true: var b = strutils.find(str, marker, a) - var sub = if b < 0: copy(str, a) else: copy(str, a, b - 1) + var sub = if b < 0: substr(str, a) else: substr(str, a, b - 1) if sub != "": addSon(result, newStrNode(nkStrLit, sub)) if b < 0: break var c = strutils.find(str, marker, b + 1) - if c < 0: sub = copy(str, b + 1) - else: sub = copy(str, b + 1, c - 1) + if c < 0: sub = substr(str, b + 1) + else: sub = substr(str, b + 1, c - 1) if sub != "": var e = SymtabGet(con.tab, getIdent(sub)) if e != nil: diff --git a/compiler/renderer.nim b/compiler/renderer.nim index 2167c8e5d..3ee8450b2 100755 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -1106,7 +1106,7 @@ proc getNextTok(r: var TSrcGen, kind: var TTokType, literal: var string) = if r.idx < len(r.tokens): kind = r.tokens[r.idx].kind var length = r.tokens[r.idx].length - literal = copy(r.buf, r.pos + 0, r.pos + 0 + length - 1) + literal = substr(r.buf, r.pos + 0, r.pos + 0 + length - 1) inc(r.pos, length) inc(r.idx) else: diff --git a/compiler/ropes.nim b/compiler/ropes.nim index 9c4c5e700..01ca5c81e 100755 --- a/compiler/ropes.nim +++ b/compiler/ropes.nim @@ -328,7 +328,7 @@ proc ropef(frmt: TFormatStr, args: openarray[PRope]): PRope = if (frmt[i] != '$'): inc(i) else: break if i - 1 >= start: - app(result, copy(frmt, start, i - 1)) + app(result, substr(frmt, start, i - 1)) assert(RopeInvariant(result)) proc appf(c: var PRope, frmt: TFormatStr, args: openarray[PRope]) = diff --git a/compiler/semfold.nim b/compiler/semfold.nim index 5b7f5603d..dbd5d34e5 100755 --- a/compiler/semfold.nim +++ b/compiler/semfold.nim @@ -189,9 +189,9 @@ proc evalOp(m: TMagic, n, a, b, c: PNode): PNode = of mBoolToStr: if getOrdValue(a) == 0: result = newStrNodeT("false", n) else: result = newStrNodeT("true", n) - of mCopyStr: result = newStrNodeT(copy(getStr(a), int(getOrdValue(b))), n) + of mCopyStr: result = newStrNodeT(substr(getStr(a), int(getOrdValue(b))), n) of mCopyStrLast: - result = newStrNodeT(copy(getStr(a), int(getOrdValue(b)), + result = newStrNodeT(substr(getStr(a), int(getOrdValue(b)), int(getOrdValue(c))), n) of mFloatToStr: result = newStrNodeT($(getFloat(a)), n) of mCStrToStr, mCharToStr: result = newStrNodeT(getStrOrChar(a), n) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index a6c5092b8..5b397167a 100755 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -14,7 +14,7 @@ import ast, astalgo, semdata, types, msgs, renderer, lookups, semtypinst, magicsys -type +type TCandidateState* = enum csEmpty, csMatch, csNoMatch TCandidate* {.final.} = object @@ -222,7 +222,7 @@ proc typeRel(mapping: var TIdTable, f, a: PType): TTypeRelation = of tyFloat64: result = handleFloatRange(f, a) of tyFloat128: result = handleFloatRange(f, a) of tyVar: - if (a.kind == f.kind): result = typeRel(mapping, base(f), base(a)) + if a.kind == f.kind: result = typeRel(mapping, base(f), base(a)) else: result = typeRel(mapping, base(f), a) of tyArray, tyArrayConstr: # tyArrayConstr cannot happen really, but diff --git a/compiler/syntaxes.nim b/compiler/syntaxes.nim index b098e4817..14f7d7f03 100755 --- a/compiler/syntaxes.nim +++ b/compiler/syntaxes.nim @@ -98,7 +98,7 @@ proc parsePipe(filename: string, inputStream: PLLStream): PNode = inc(i, 2) while line[i] in WhiteSpace: inc(i) var q: TParser - OpenParser(q, filename, LLStreamOpen(copy(line, i))) + OpenParser(q, filename, LLStreamOpen(substr(line, i))) result = parser.parseAll(q) CloseParser(q) LLStreamClose(s) |