diff options
author | Araq <rumpf_a@web.de> | 2011-10-07 10:07:18 -0700 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-10-07 10:07:18 -0700 |
commit | fae8ea0cee55cf85a7d30d63d06c73ed3874fa89 (patch) | |
tree | 660df418fce1076c16cd7ab97574d0c6c12c6605 /lib/core/macros.nim | |
parent | 130316751d88a93169304a19caf92308f115808c (diff) | |
parent | 4a444bf6dbf973faea020b1e82650e50eccf7d54 (diff) | |
download | Nim-fae8ea0cee55cf85a7d30d63d06c73ed3874fa89.tar.gz |
Merge pull request #58 from zah/getast-unittests
getAst operational. Unit testing library based on it.
Diffstat (limited to 'lib/core/macros.nim')
-rwxr-xr-x | lib/core/macros.nim | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index c5afcdf17..825979e27 100755 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -36,8 +36,8 @@ type nnkMacroDef, nnkTemplateDef, nnkIteratorDef, nnkOfBranch, nnkElifBranch, nnkExceptBranch, nnkElse, nnkMacroStmt, nnkAsmStmt, nnkPragma, nnkIfStmt, nnkWhenStmt, - nnkForStmt, nnkWhileStmt, nnkCaseStmt, - nnkVarSection, nnkLetSection, nnkConstSection, + nnkForStmt, nnkWhileStmt, nnkCaseStmt, + nnkVarSection, nnkLetSection, nnkConstSection, nnkConstDef, nnkTypeSection, nnkTypeDef, nnkYieldStmt, nnkTryStmt, nnkFinally, nnkRaiseStmt, nnkReturnStmt, nnkBreakStmt, nnkContinueStmt, nnkBlockStmt, @@ -45,8 +45,8 @@ type nnkIncludeStmt, nnkCommentStmt, nnkStmtListExpr, nnkBlockExpr, nnkStmtListType, nnkBlockType, nnkTypeOfExpr, nnkObjectTy, nnkTupleTy, nnkRecList, nnkRecCase, nnkRecWhen, - nnkRefTy, nnkPtrTy, nnkVarTy, - nnkConstTy, nnkMutableTy, + nnkRefTy, nnkPtrTy, nnkVarTy, + nnkConstTy, nnkMutableTy, nnkDistinctTy, nnkProcTy, nnkEnumTy, nnkEnumFieldDef, nnkReturnToken TNimNodeKinds* = set[TNimrodNodeKind] @@ -187,6 +187,8 @@ proc toStrLit*(n: PNimrodNode): PNimrodNode {.compileTime.} = ## in a string literal node return newStrLitNode(repr(n)) +proc lineinfo*(n: PNimrodNode): string {.magic: "NLineInfo".} + proc toLisp*(n: PNimrodNode): string {.compileTime.} = ## Convert the AST `n` to a human-readable string ## @@ -228,11 +230,11 @@ proc parseStmt*(s: string): stmt {.magic: "ParseStmtToAst".} ## Compiles the passed string to its AST representation. ## Expects one or more statements. -proc getAst*(macroOrTemplate: expr): expr {.magic: "ExpandMacroToAst".} +proc getAst*(macroOrTemplate: expr): expr {.magic: "ExpandToAst".} ## Obtains the AST nodes returned from a macro or template invocation. - ## Example: - ## - ## .. code-block:: nimrod + ## Example: + ## + ## .. code-block:: nimrod ## ## macro FooMacro() = ## var ast = getAst(BarTemplate()) |