Open timotheecour opened 3 years ago
From https://github.com/pietroppeter/nimib/issues/20 - might this issue be related to this bug?
import std/macros
macro testOut(x: untyped) =
echo treeRepr x
echo repr x
testOut:
*header: {headers}
Currently the renderer's output is *header
which is obviously wrong
I think it's a separate issue, unrelated to repr (repr shows badly but that seems like a symptom)
@Araq isn't that a parser bug?
when true:
import std/macros
macro testOut(x: untyped) =
echo treeRepr x
echo lispRepr x
echo repr x
testOut:
*a: b
StmtList
Prefix
Ident "*"
Ident "a"
StmtList
Ident "b"
(StmtList (Prefix (Ident "*") (Ident "a") (StmtList (Ident "b"))))
*a
how come Prefix has 3 children instead of 2?
how come Prefix has 3 children instead of 2?
I think the colon is parsed much like a do:
in this case so it adds a third child. Definitely something we need to investigate. :-)
bugs
do:
renders badly => https://github.com/nim-lang/Nim/pull/17623 and https://github.com/nim-lang/Nim/pull/17449(discard)
renders badly => https://github.com/nim-lang/Nim/pull/17455nnkAccQuoted
renders badly, see Example 2 below => https://github.com/nim-lang/Nim/pull/17624*a: b
renders badly, which might be due to a parser error, see Example 3Example 1
Current Output
Expected Output
Example 2
repr doesn't work with
nnkAccQuoted
:prints:
the culprit is the spaces inserted here in renderer.nim:
Example 3
*a: b
parsed wrong in https://github.com/nim-lang/Nim/issues/17292#issuecomment-805545016 (should be moved to a different bug)Additional Information
renderModule
is buggy