make tests green again
This commit is contained in:
parent
47335aab41
commit
1d1d6f39a3
3 changed files with 8 additions and 8 deletions
|
|
@ -1779,7 +1779,7 @@ proc createConstructor(typeSym, jsonNode: NimNode): NimNode =
|
||||||
result = processType(typeSym, obj, jsonNode, false)
|
result = processType(typeSym, obj, jsonNode, false)
|
||||||
of nnkTupleTy:
|
of nnkTupleTy:
|
||||||
result = processType(typeSym, typeSym, jsonNode, false)
|
result = processType(typeSym, typeSym, jsonNode, false)
|
||||||
of nnkPar:
|
of nnkPar, nnkTupleConstr:
|
||||||
# TODO: The fact that `jsonNode` here works to give a good line number
|
# TODO: The fact that `jsonNode` here works to give a good line number
|
||||||
# is weird. Specifying typeSym should work but doesn't.
|
# is weird. Specifying typeSym should work but doesn't.
|
||||||
error("Use a named tuple instead of: " & $toStrLit(typeSym), jsonNode)
|
error("Use a named tuple instead of: " & $toStrLit(typeSym), jsonNode)
|
||||||
|
|
|
||||||
|
|
@ -532,7 +532,7 @@ macro scanp*(input, idx: typed; pattern: varargs[untyped]): bool =
|
||||||
newEmptyNode(), newEmptyNode())
|
newEmptyNode(), newEmptyNode())
|
||||||
elif it.kind == nnkPrefix and it[0].eqIdent"+":
|
elif it.kind == nnkPrefix and it[0].eqIdent"+":
|
||||||
# x+ is the same as xx*
|
# x+ is the same as xx*
|
||||||
result = atm(newTree(nnkPar, it[1], newTree(nnkPrefix, ident"*", it[1])),
|
result = atm(newTree(nnkTupleConstr, it[1], newTree(nnkPrefix, ident"*", it[1])),
|
||||||
input, idx, attached)
|
input, idx, attached)
|
||||||
elif it.kind == nnkPrefix and it[0].eqIdent"?":
|
elif it.kind == nnkPrefix and it[0].eqIdent"?":
|
||||||
# optional.
|
# optional.
|
||||||
|
|
@ -583,18 +583,18 @@ macro scanp*(input, idx: typed; pattern: varargs[untyped]): bool =
|
||||||
result = (newEmptyNode(), newCall(interf"atom", input, idx, it), !!newCall(interf"nxt", input, idx))
|
result = (newEmptyNode(), newCall(interf"atom", input, idx, it), !!newCall(interf"nxt", input, idx))
|
||||||
of nnkCurlyExpr:
|
of nnkCurlyExpr:
|
||||||
if it.len == 3 and it[1].kind == nnkIntLit and it[2].kind == nnkIntLit:
|
if it.len == 3 and it[1].kind == nnkIntLit and it[2].kind == nnkIntLit:
|
||||||
var h = newTree(nnkPar, it[0])
|
var h = newTree(nnkTupleConstr, it[0])
|
||||||
for count in 2i64 .. it[1].intVal: h.add(it[0])
|
for count in 2i64 .. it[1].intVal: h.add(it[0])
|
||||||
for count in it[1].intVal .. it[2].intVal-1: h.add(newTree(nnkPrefix, ident"?", it[0]))
|
for count in it[1].intVal .. it[2].intVal-1: h.add(newTree(nnkPrefix, ident"?", it[0]))
|
||||||
result = atm(h, input, idx, attached)
|
result = atm(h, input, idx, attached)
|
||||||
elif it.len == 2 and it[1].kind == nnkIntLit:
|
elif it.len == 2 and it[1].kind == nnkIntLit:
|
||||||
var h = newTree(nnkPar, it[0])
|
var h = newTree(nnkTupleConstr, it[0])
|
||||||
for count in 2i64 .. it[1].intVal: h.add(it[0])
|
for count in 2i64 .. it[1].intVal: h.add(it[0])
|
||||||
result = atm(h, input, idx, attached)
|
result = atm(h, input, idx, attached)
|
||||||
else:
|
else:
|
||||||
error("invalid pattern")
|
error("invalid pattern")
|
||||||
of nnkPar:
|
of nnkPar, nnkTupleConstr:
|
||||||
if it.len == 1:
|
if it.len == 1 and it.kind == nnkPar:
|
||||||
result = atm(it[0], input, idx, attached)
|
result = atm(it[0], input, idx, attached)
|
||||||
else:
|
else:
|
||||||
# concatenation:
|
# concatenation:
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ proc createProcType(p, b: NimNode): NimNode {.compileTime.} =
|
||||||
formalParams.add b
|
formalParams.add b
|
||||||
|
|
||||||
case p.kind
|
case p.kind
|
||||||
of nnkPar:
|
of nnkPar, nnkTupleConstr:
|
||||||
for i in 0 ..< p.len:
|
for i in 0 ..< p.len:
|
||||||
let ident = p[i]
|
let ident = p[i]
|
||||||
var identDefs = newNimNode(nnkIdentDefs)
|
var identDefs = newNimNode(nnkIdentDefs)
|
||||||
|
|
@ -61,7 +61,7 @@ macro `=>`*(p, b: untyped): untyped =
|
||||||
var params: seq[NimNode] = @[newIdentNode("auto")]
|
var params: seq[NimNode] = @[newIdentNode("auto")]
|
||||||
|
|
||||||
case p.kind
|
case p.kind
|
||||||
of nnkPar:
|
of nnkPar, nnkTupleConstr:
|
||||||
for c in children(p):
|
for c in children(p):
|
||||||
var identDefs = newNimNode(nnkIdentDefs)
|
var identDefs = newNimNode(nnkIdentDefs)
|
||||||
case c.kind
|
case c.kind
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue