diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2022-09-07 03:38:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-06 21:38:08 +0200 |
commit | b2c5f6f3c8a8d3e5b9f908353f3ea791cc771385 (patch) | |
tree | a129338da04c7ee9f9567f47053851088a3470bb /lib/pure/strscans.nim | |
parent | 5d947bb791e8149c1eb0ffc7c775b7a115605770 (diff) | |
download | Nim-b2c5f6f3c8a8d3e5b9f908353f3ea791cc771385.tar.gz |
give a deprecate warning when using `newPar` to construct tuple expressions (#20312)
* error/deprecate when using `newPar` to construct tuple expressions * Update lib/core/macros.nim * fixes
Diffstat (limited to 'lib/pure/strscans.nim')
-rw-r--r-- | lib/pure/strscans.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/strscans.nim b/lib/pure/strscans.nim index 7db6f28af..8a1ea125f 100644 --- a/lib/pure/strscans.nim +++ b/lib/pure/strscans.nim @@ -512,7 +512,7 @@ macro scanTuple*(input: untyped; pattern: static[string]; matcherTypes: varargs[ inc userMatches else: discard inc p - result.add newPar(newCall(ident("scanf"), input, newStrLitNode(pattern))) + result.add nnkTupleConstr.newTree(newCall(ident("scanf"), input, newStrLitNode(pattern))) for arg in arguments: result[^1][0].add arg result[^1].add arg @@ -588,7 +588,7 @@ macro scanp*(input, idx: typed; pattern: varargs[untyped]): bool = action # (x) a # bind action a to (x) - if it[0].kind == nnkPar and it.len == 2: + if it[0].kind in {nnkPar, nnkTupleConstr} and it.len == 2: result = atm(it[0], input, idx, placeholder(it[1], input, idx)) elif it.kind == nnkInfix and it[0].eqIdent"->": # bind matching to some action: |