[FIX] use mixin for strscans.scanp (#17371)
This commit is contained in:
parent
8e8bea9044
commit
430c30299f
1 changed files with 2 additions and 1 deletions
|
|
@ -577,6 +577,7 @@ macro scanp*(input, idx: typed; pattern: varargs[untyped]): bool =
|
||||||
of nnkCallKinds:
|
of nnkCallKinds:
|
||||||
# *{'A'..'Z'} !! s.add(!_)
|
# *{'A'..'Z'} !! s.add(!_)
|
||||||
template buildWhile(input, idx, init, cond, action): untyped =
|
template buildWhile(input, idx, init, cond, action): untyped =
|
||||||
|
mixin hasNxt
|
||||||
while hasNxt(input, idx):
|
while hasNxt(input, idx):
|
||||||
init
|
init
|
||||||
if not cond: break
|
if not cond: break
|
||||||
|
|
@ -688,4 +689,4 @@ macro scanp*(input, idx: typed; pattern: varargs[untyped]): bool =
|
||||||
result.add toIfChain(conds, idx, res, 0)
|
result.add toIfChain(conds, idx, res, 0)
|
||||||
result.add res
|
result.add res
|
||||||
when defined(debugScanp):
|
when defined(debugScanp):
|
||||||
echo repr result
|
echo repr result
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue