mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 07:51:32 +00:00
fix a regression in tlexerex
This commit is contained in:
@@ -1168,19 +1168,20 @@ proc postExprBlocks(p: var TParser, x: PNode): PNode =
|
||||
result = makeCall(result)
|
||||
getTok(p)
|
||||
skipComment(p, result)
|
||||
var stmtList = newNodeP(nkStmtList, p)
|
||||
let body = parseStmt(p)
|
||||
stmtList.add body
|
||||
if p.tok.tokType notin {tkOf, tkElif, tkElse, tkExcept}:
|
||||
var stmtList = newNodeP(nkStmtList, p)
|
||||
let body = parseStmt(p)
|
||||
stmtList.add body
|
||||
|
||||
if stmtList.len == 1 and stmtList[0].kind == nkStmtList:
|
||||
# to keep backwards compatibility (see tests/vm/tstringnil)
|
||||
stmtList = stmtList[0]
|
||||
if stmtList.len == 1 and stmtList[0].kind == nkStmtList:
|
||||
# to keep backwards compatibility (see tests/vm/tstringnil)
|
||||
stmtList = stmtList[0]
|
||||
|
||||
if openingParams.kind != nkEmpty:
|
||||
result.add newProcNode(nkDo, stmtList.info, stmtList,
|
||||
params = openingParams, pragmas = openingPragmas)
|
||||
else:
|
||||
result.add stmtList
|
||||
if openingParams.kind != nkEmpty:
|
||||
result.add newProcNode(nkDo, stmtList.info, stmtList,
|
||||
params = openingParams, pragmas = openingPragmas)
|
||||
else:
|
||||
result.add stmtList
|
||||
|
||||
while sameInd(p):
|
||||
var nextBlock: PNode
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
|
||||
import macros
|
||||
|
||||
macro match*(s: cstring|string; pos: int; sections: untyped): untyped =
|
||||
for sec in sections.children:
|
||||
macro match*(s: cstring|string; pos: int; sections: varargs[untyped]): untyped =
|
||||
for sec in sections:
|
||||
expectKind sec, nnkOfBranch
|
||||
expectLen sec, 2
|
||||
result = newStmtList()
|
||||
|
||||
Reference in New Issue
Block a user