diff options
| author | Joey Yakimowich-Payne <jyapayne@gmail.com> | 2020-05-03 18:40:49 -0600 |
|---|---|---|
| committer | genotrance <dev@genotrance.com> | 2020-05-04 16:43:07 -0500 |
| commit | 5104eeb5c0da96509c621202ea9e94c371e20933 (patch) | |
| tree | 68111f2e1a6a06c1de75565dfb2c7aff1ea54bb1 | |
| parent | 5e7ec3d88c7cf817ec716f4b24e9564906f258f6 (diff) | |
| download | nimterop-5104eeb5c0da96509c621202ea9e94c371e20933.tar.gz nimterop-5104eeb5c0da96509c621202ea9e94c371e20933.zip | |
compilerArgs -> nimArgs, fix multi decl comments
| -rw-r--r-- | nimterop.nimble | 2 | ||||
| -rw-r--r-- | nimterop/ast2.nim | 17 | ||||
| -rw-r--r-- | nimterop/docs.nim | 4 |
3 files changed, 19 insertions, 4 deletions
diff --git a/nimterop.nimble b/nimterop.nimble index 38a2d5d..702c714 100644 --- a/nimterop.nimble +++ b/nimterop.nimble @@ -25,7 +25,7 @@ proc execTest(test: string, flags = "", runDocs = true) = let docPath = "build/html_" & test.extractFileName.changeFileExt("") & "_docs" rmDir docPath mkDir docPath - buildDocs(@[test], docPath, compilerArgs = flags) + buildDocs(@[test], docPath, nimArgs = flags) task buildToast, "build toast": execCmd("nim c --hints:off nimterop/toast.nim") diff --git a/nimterop/ast2.nim b/nimterop/ast2.nim index b51b252..759419c 100644 --- a/nimterop/ast2.nim +++ b/nimterop/ast2.nim @@ -1640,16 +1640,31 @@ proc addDecl(gState: State, node: TSNode) = let start = getStartAtom(node) - commentNodes = gState.getCommentNodes(node) + + var + firstDecl = true + commentNodes: seq[TSNode] for i in start+1 ..< node.len: if not node[i].firstChildInTree("function_declarator").isNil: # Proc declaration - var or actual proc if node[i].getAtom().getPxName(1) == "pointer_declarator": # proc var + if firstDecl: + # If + commentNodes = gState.getCommentNodes(node) + firstDecl = false + else: + commentNodes = gState.getCommentNodes(node[i]) gState.addProcVar(node[i], node[start], commentNodes) else: # proc + if firstDecl: + # If + commentNodes = gState.getCommentNodes(node) + firstDecl = false + else: + commentNodes = gState.getCommentNodes(node[i]) gState.addProc(node[i], node[start], commentNodes) else: # Regular var diff --git a/nimterop/docs.nim b/nimterop/docs.nim index e0fef39..798df52 100644 --- a/nimterop/docs.nim +++ b/nimterop/docs.nim @@ -36,7 +36,7 @@ proc execAction(cmd: string): string = doAssert ret == 0, "Command failed: " & $ret & "\ncmd: " & ccmd & "\nresult:\n" & result proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath() & $DirSep, - defines: openArray[string] = @[], compilerArgs = "") = + defines: openArray[string] = @[], nimArgs = "") = ## Generate docs for all specified nim `files` to the specified `path` ## ## `baseDir` is the project path by default and `files` and `path` are relative @@ -70,7 +70,7 @@ proc buildDocs*(files: openArray[string], path: string, baseDir = getProjectPath defStr nim = getCurrentCompilerExe() for file in files: - echo execAction(&"{nim} doc {defStr} {compilerArgs} -o:{path} --project --index:on {baseDir & file}") + echo execAction(&"{nim} doc {defStr} {nimArgs} -o:{path} --project --index:on {baseDir & file}") echo execAction(&"{nim} buildIndex -o:{path}/theindex.html {path}") when declared(getNimRootDir): |
