openarray/varargs split; breaks bootstrapping
This commit is contained in:
parent
1215193010
commit
0171566c98
29 changed files with 228 additions and 175 deletions
11
tests/reject/tnocontains.nim
Normal file
11
tests/reject/tnocontains.nim
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
discard """
|
||||
file: "tnocontains.nim"
|
||||
line: 10
|
||||
errormsg: "type mismatch: got (string, string)"
|
||||
"""
|
||||
|
||||
# shouldn't compile since it doesn't do what you think it does without
|
||||
# importing strutils:
|
||||
|
||||
let x = "abc" in "abcdef"
|
||||
echo x
|
||||
|
|
@ -161,7 +161,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 {.
|
||||
rtl, extern: "npegsOrderedChoice".} =
|
||||
## constructs an ordered choice with the PEGs in `a`
|
||||
multipleOp(pkOrderedChoice, addChoice)
|
||||
|
|
@ -178,7 +178,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 {.
|
||||
rtl, extern: "npegs$1".} =
|
||||
## constructs a sequence with all the PEGs from `a`
|
||||
multipleOp(pkSequence, addSequence)
|
||||
|
|
@ -935,7 +935,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 {.
|
||||
rtl, extern: "npegs$1".} =
|
||||
## Returns a modified copy of `s` with the substitutions in `subs`
|
||||
|
|
@ -957,7 +957,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`. Calls ``quit`` if an
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue