nimgrep compiles again
This commit is contained in:
parent
428ee0c022
commit
ae53d1ecc8
2 changed files with 11 additions and 8 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue