mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 10:54:42 +00:00
nimgrep compiles again
This commit is contained in:
@@ -98,6 +98,9 @@ proc handleCmdLine() =
|
||||
processCmdLine(passCmd2, "")
|
||||
mainCommand()
|
||||
|
||||
when compileOption("gc", "v2") or compileOption("gc", "refc"):
|
||||
GC_disableMarkAndSweep()
|
||||
|
||||
condsyms.initDefines()
|
||||
defineSymbol "nimfix"
|
||||
handleCmdline()
|
||||
|
||||
@@ -12,7 +12,7 @@ import
|
||||
|
||||
const
|
||||
Version = "0.9"
|
||||
Usage = "nimgrep - Nim Grep Utility Version " & version & """
|
||||
Usage = "nimgrep - Nim Grep Utility Version " & Version & """
|
||||
|
||||
(c) 2012 Andreas Rumpf
|
||||
Usage:
|
||||
@@ -58,7 +58,7 @@ proc ask(msg: string): string =
|
||||
stdout.write(msg)
|
||||
result = stdin.readLine()
|
||||
|
||||
proc Confirm: TConfirmEnum =
|
||||
proc confirm: TConfirmEnum =
|
||||
while true:
|
||||
case normalize(ask(" [a]bort; [y]es, a[l]l, [n]o, non[e]: "))
|
||||
of "a", "abort": return ceAbort
|
||||
@@ -81,20 +81,20 @@ proc countLines(s: string, first, last: int): int =
|
||||
proc beforePattern(s: string, first: int): int =
|
||||
result = first-1
|
||||
while result >= 0:
|
||||
if s[result] in newlines: break
|
||||
if s[result] in Newlines: break
|
||||
dec(result)
|
||||
inc(result)
|
||||
|
||||
proc afterPattern(s: string, last: int): int =
|
||||
result = last+1
|
||||
while result < s.len:
|
||||
if s[result] in newlines: break
|
||||
if s[result] in Newlines: break
|
||||
inc(result)
|
||||
dec(result)
|
||||
|
||||
proc writeColored(s: string) =
|
||||
if useWriteStyled:
|
||||
terminal.WriteStyled(s, {styleUnderscore, styleBright})
|
||||
terminal.writeStyled(s, {styleUnderscore, styleBright})
|
||||
else:
|
||||
stdout.write(s)
|
||||
|
||||
@@ -171,7 +171,7 @@ proc processFile(filename: string) =
|
||||
r = replace(wholeMatch, rep, replacement % matches)
|
||||
if optConfirm in options:
|
||||
highlight(buffer, wholeMatch, r, t, line, showRepl=true)
|
||||
case Confirm()
|
||||
case confirm()
|
||||
of ceAbort: quit(0)
|
||||
of ceYes: reallyReplace = true
|
||||
of ceAll:
|
||||
@@ -234,8 +234,8 @@ proc styleInsensitive(s: string): string =
|
||||
while s[i] != '>' and s[i] != '\0': addx()
|
||||
of '\\':
|
||||
addx()
|
||||
if s[i] in strutils.digits:
|
||||
while s[i] in strutils.digits: addx()
|
||||
if s[i] in strutils.Digits:
|
||||
while s[i] in strutils.Digits: addx()
|
||||
else:
|
||||
addx()
|
||||
else: addx()
|
||||
|
||||
Reference in New Issue
Block a user