diff options
| author | genotrance <dev@genotrance.com> | 2018-11-29 18:32:34 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-11-29 18:32:34 -0600 |
| commit | a32835a0e39c18961b311b112220cd8de0f38c7b (patch) | |
| tree | ae4122cc57f008090602130ab50947bf95271c5b | |
| parent | c9b57c567cf065ca4ff5dcb4f4a5ee2eb1f01a52 (diff) | |
| parent | 7dd8fff8a7cf518cbc663b72598477b622ae1822 (diff) | |
| download | nimterop-a32835a0e39c18961b311b112220cd8de0f38c7b.tar.gz nimterop-a32835a0e39c18961b311b112220cd8de0f38c7b.zip | |
Merge pull request #26 from timotheecour/pr_fix_8
fix #8 ; keep track of source file; display in standard sublime format file:line:col
| -rw-r--r-- | nimterop/ast.nim | 4 | ||||
| -rw-r--r-- | nimterop/globals.nim | 1 | ||||
| -rw-r--r-- | toast.nim | 2 |
3 files changed, 6 insertions, 1 deletions
diff --git a/nimterop/ast.nim b/nimterop/ast.nim index fe0111f..069ecba 100644 --- a/nimterop/ast.nim +++ b/nimterop/ast.nim @@ -239,7 +239,8 @@ proc genNimAst(root: TSNode) = case $node.tsNodeType(): of "ERROR": let (line, col) = getLineCol(node) - echo &"Potentially invalid syntax at line {line} column {col}" + let file = gStateRT.sourceFile + echo &"# [toast] Potentially invalid syntax at {file}:{line}:{col}" of "preproc_def": pPreprocDef(node) of "type_definition": @@ -253,6 +254,7 @@ proc genNimAst(root: TSNode) = if $node.tsNodeParent.tsNodeType() notin ["type_definition", "declaration"]: pEnumSpecifier(node) else: + # TODO: log discard else: return diff --git a/nimterop/globals.nim b/nimterop/globals.nim index 1e3a83c..f1ba151 100644 --- a/nimterop/globals.nim +++ b/nimterop/globals.nim @@ -7,6 +7,7 @@ type consts*, procs*, types*: seq[string] code*, constStr*, currentHeader*, mode*, procStr*, typeStr*: string + sourceFile*: string # eg, C or C++ source or header file var gStateCT* {.compiletime.}: State @@ -63,6 +63,8 @@ proc process(path: string) = defer: parser.tsParserDelete() + gStateRT.sourceFile = path + if gStateRT.mode.len == 0: gStateRT.mode = modeDefault elif ext in [".h", ".c"]: |
