distinguish properly between nkOpen and nkClosedSymChoice

This commit is contained in:
Araq 2012-08-26 02:47:17 +02:00
commit b5b5e6e76d
15 changed files with 107 additions and 50 deletions

View file

@ -379,7 +379,8 @@ proc lsub(n: PNode): int =
of nkPar, nkCurly, nkBracket, nkClosure: result = lcomma(n) + 2
of nkTableConstr:
result = if n.len > 0: lcomma(n) + 2 else: len("{:}")
of nkSymChoice: result = lsons(n) + len("()") + sonsLen(n) - 1
of nkClosedSymChoice, nkOpenSymChoice:
result = lsons(n) + len("()") + sonsLen(n) - 1
of nkTupleTy: result = lcomma(n) + len("tuple[]")
of nkDotExpr: result = lsons(n) + 1
of nkBind: result = lsons(n) + len("bind_")
@ -833,7 +834,7 @@ proc gsub(g: var TSrcGen, n: PNode, c: TContext) =
put(g, tkParLe, "(")
gcomma(g, n, 1)
put(g, tkParRi, ")")
of nkSymChoice:
of nkClosedSymChoice, nkOpenSymChoice:
put(g, tkParLe, "(")
for i in countup(0, sonsLen(n) - 1):
if i > 0: put(g, tkOpr, "|")