diff options
author | Arne Döring <arne.doering@gmx.net> | 2017-06-02 01:22:21 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-06-02 01:22:21 +0200 |
commit | eb8e267ff63eec0dd5279186a57d8af59f26c696 (patch) | |
tree | ae8c8ee6f5e7503372a47d3aed9e65995651203a /lib | |
parent | da52ade86e9df306b03958c5525a0e6973fc1cb5 (diff) | |
download | Nim-eb8e267ff63eec0dd5279186a57d8af59f26c696.tar.gz |
improved comment satement support in macros (#5904)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/macros.nim | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 13f341350..af1e9de28 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -255,6 +255,11 @@ proc newStrLitNode*(s: string): NimNode {.compileTime, noSideEffect.} = result = newNimNode(nnkStrLit) result.strVal = s +proc newCommentStmtNode*(s: string): NimNode {.compileTime, noSideEffect.} = + ## creates a comment statement node + result = newNimNode(nnkCommentStmt) + result.strVal = s + proc newIntLitNode*(i: BiggestInt): NimNode {.compileTime.} = ## creates a int literal node from `i` result = newNimNode(nnkIntLit) @@ -275,6 +280,7 @@ proc newIdentNode*(i: string): NimNode {.compileTime.} = result = newNimNode(nnkIdent) result.ident = !i + type BindSymRule* = enum ## specifies how ``bindSym`` behaves brClosed, ## only the symbols in current scope are bound @@ -835,6 +841,8 @@ proc `$`*(node: NimNode): string {.compileTime.} = result = $node[0] of nnkAccQuoted: result = $node[0] + of nnkCommentStmt: + result = node.strVal else: badNodeKind node.kind, "$" |