diff --git a/src/phparser.nim b/src/phparser.nim index 4c0c07d..7942315 100644 --- a/src/phparser.nim +++ b/src/phparser.nim @@ -2649,9 +2649,9 @@ proc parseEnum(p: var Parser): PNode = symPragma.add(a) symPragma.add(pragma) - let symInd = p.currInd + comments.add commentLookahead(p) - comments.add commentLookahead(p) + let symInd = p.currInd if p.tok.indent >= 0 and p.tok.indent <= p.currInd: p.skipped = splitComments(comments, symPragma, symInd, clPostfix) @@ -3256,9 +3256,10 @@ proc parseStmt(p: var Parser): PNode = p.hasProgress = false if p.tok.tokType in {tkElse, tkElif}: break - # Allow this too, see tests/parser/tifexprs - let a = complexOrSimpleStmt(p) + # Allow this too, see tests/parser/tifexprs + let + a = complexOrSimpleStmt(p) if a.kind == nkEmpty and not p.hasProgress: debugEcho 3 diff --git a/src/phrenderer.nim b/src/phrenderer.nim index 10e80ea..1e7f090 100644 --- a/src/phrenderer.nim +++ b/src/phrenderer.nim @@ -1108,10 +1108,9 @@ proc gstmts(g: var TSrcGen; n: PNode; c: TContext; doIndent = true) = if doIndent: indentNL(g) - gprefixes(g, n) - var lastKind = nkStmtList if n.kind in {nkStmtList, nkStmtListExpr, nkStmtListType}: + gprefixes(g, n) for i in 0 ..< n.len: # This groups sections by their kind, giving a bit of air between "parts" # of code - we don't do it before control flow because there, the code @@ -1132,11 +1131,11 @@ proc gstmts(g: var TSrcGen; n: PNode; c: TContext; doIndent = true) = gcoms(g) lastKind = n[i].kind + gpostfixes(g, n) else: gsub(g, n) gcoms(g) - gpostfixes(g, n) if doIndent: dedent(g)