pragma blocks; fixed line information issue with user defined assertions

This commit is contained in:
Araq 2012-01-17 23:58:18 +01:00
commit 78f4aacde9
17 changed files with 133 additions and 23 deletions

View file

@ -1316,6 +1316,15 @@ proc parseBind(p: var TParser): PNode =
optInd(p, a)
expectNl(p)
proc parseStmtPragma(p: var TParser): PNode =
result = parsePragma(p)
if p.tok.tokType == tkColon:
let a = result
result = newNodeI(nkPragmaBlock, a.info)
getTok(p)
result.add a
result.add parseStmt(p)
proc simpleStmt(p: var TParser): PNode =
case p.tok.tokType
of tkReturn: result = parseReturnOrRaise(p, nkReturnStmt)
@ -1324,7 +1333,7 @@ proc simpleStmt(p: var TParser): PNode =
of tkDiscard: result = parseYieldOrDiscard(p, nkDiscardStmt)
of tkBreak: result = parseBreakOrContinue(p, nkBreakStmt)
of tkContinue: result = parseBreakOrContinue(p, nkContinueStmt)
of tkCurlyDotLe: result = parsePragma(p)
of tkCurlyDotLe: result = parseStmtPragma(p)
of tkImport: result = parseImportOrIncludeStmt(p, nkImportStmt)
of tkFrom: result = parseFromStmt(p)
of tkInclude: result = parseImportOrIncludeStmt(p, nkIncludeStmt)