nimgrep compiles again

This commit is contained in:
Araq 2014-09-07 02:52:15 +02:00
commit ae53d1ecc8
2 changed files with 11 additions and 8 deletions

View file

@ -98,6 +98,9 @@ proc handleCmdLine() =
processCmdLine(passCmd2, "") processCmdLine(passCmd2, "")
mainCommand() mainCommand()
when compileOption("gc", "v2") or compileOption("gc", "refc"):
GC_disableMarkAndSweep()
condsyms.initDefines() condsyms.initDefines()
defineSymbol "nimfix" defineSymbol "nimfix"
handleCmdline() handleCmdline()

View file

@ -12,7 +12,7 @@ import
const const
Version = "0.9" Version = "0.9"
Usage = "nimgrep - Nim Grep Utility Version " & version & """ Usage = "nimgrep - Nim Grep Utility Version " & Version & """
(c) 2012 Andreas Rumpf (c) 2012 Andreas Rumpf
Usage: Usage:
@ -58,7 +58,7 @@ proc ask(msg: string): string =
stdout.write(msg) stdout.write(msg)
result = stdin.readLine() result = stdin.readLine()
proc Confirm: TConfirmEnum = proc confirm: TConfirmEnum =
while true: while true:
case normalize(ask(" [a]bort; [y]es, a[l]l, [n]o, non[e]: ")) case normalize(ask(" [a]bort; [y]es, a[l]l, [n]o, non[e]: "))
of "a", "abort": return ceAbort of "a", "abort": return ceAbort
@ -81,20 +81,20 @@ proc countLines(s: string, first, last: int): int =
proc beforePattern(s: string, first: int): int = proc beforePattern(s: string, first: int): int =
result = first-1 result = first-1
while result >= 0: while result >= 0:
if s[result] in newlines: break if s[result] in Newlines: break
dec(result) dec(result)
inc(result) inc(result)
proc afterPattern(s: string, last: int): int = proc afterPattern(s: string, last: int): int =
result = last+1 result = last+1
while result < s.len: while result < s.len:
if s[result] in newlines: break if s[result] in Newlines: break
inc(result) inc(result)
dec(result) dec(result)
proc writeColored(s: string) = proc writeColored(s: string) =
if useWriteStyled: if useWriteStyled:
terminal.WriteStyled(s, {styleUnderscore, styleBright}) terminal.writeStyled(s, {styleUnderscore, styleBright})
else: else:
stdout.write(s) stdout.write(s)
@ -171,7 +171,7 @@ proc processFile(filename: string) =
r = replace(wholeMatch, rep, replacement % matches) r = replace(wholeMatch, rep, replacement % matches)
if optConfirm in options: if optConfirm in options:
highlight(buffer, wholeMatch, r, t, line, showRepl=true) highlight(buffer, wholeMatch, r, t, line, showRepl=true)
case Confirm() case confirm()
of ceAbort: quit(0) of ceAbort: quit(0)
of ceYes: reallyReplace = true of ceYes: reallyReplace = true
of ceAll: of ceAll:
@ -234,8 +234,8 @@ proc styleInsensitive(s: string): string =
while s[i] != '>' and s[i] != '\0': addx() while s[i] != '>' and s[i] != '\0': addx()
of '\\': of '\\':
addx() addx()
if s[i] in strutils.digits: if s[i] in strutils.Digits:
while s[i] in strutils.digits: addx() while s[i] in strutils.Digits: addx()
else: else:
addx() addx()
else: addx() else: addx()