openarray/varargs split; breaks bootstrapping

This commit is contained in:
Araq 2012-08-16 08:34:33 +02:00
commit 0171566c98
29 changed files with 228 additions and 175 deletions

View file

@ -149,7 +149,7 @@ template multipleOp(k: TPegKind, localOpt: expr) =
if result.len == 1:
result = result.sons[0]
proc `/`*(a: openArray[TPeg]): TPeg {.
proc `/`*(a: varargs[TPeg]): TPeg {.
nosideEffect, rtl, extern: "npegsOrderedChoice".} =
## constructs an ordered choice with the PEGs in `a`
multipleOp(pkOrderedChoice, addChoice)
@ -166,7 +166,7 @@ proc addSequence(dest: var TPeg, elem: TPeg) =
else: add(dest, elem)
else: add(dest, elem)
proc sequence*(a: openArray[TPeg]): TPeg {.
proc sequence*(a: varargs[TPeg]): TPeg {.
nosideEffect, rtl, extern: "npegs$1".} =
## constructs a sequence with all the PEGs from `a`
multipleOp(pkSequence, addSequence)
@ -939,7 +939,7 @@ proc replace*(s: string, sub: TPeg, by = ""): string {.
inc(i, x)
add(result, substr(s, i))
proc parallelReplace*(s: string, subs: openArray[
proc parallelReplace*(s: string, subs: varargs[
tuple[pattern: TPeg, repl: string]]): string {.
nosideEffect, rtl, extern: "npegs$1".} =
## Returns a modified copy of `s` with the substitutions in `subs`
@ -964,7 +964,7 @@ proc parallelReplace*(s: string, subs: openArray[
add(result, substr(s, i))
proc transformFile*(infile, outfile: string,
subs: openArray[tuple[pattern: TPeg, repl: string]]) {.
subs: varargs[tuple[pattern: TPeg, repl: string]]) {.
rtl, extern: "npegs$1".} =
## reads in the file `infile`, performs a parallel replacement (calls
## `parallelReplace`) and writes back to `outfile`. Raises ``EIO`` if an