aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2018-12-03 14:20:31 -0600
committerGanesh Viswanathan <dev@genotrance.com>2018-12-03 14:20:31 -0600
commit9c206fea4f93fe2dcc9b5332d08d86f6dc5adb03 (patch)
treeae4122cc57f008090602130ab50947bf95271c5b
parentb1c5407ff3fbf79c8d9318b789c9f4a638e43f83 (diff)
parenta32835a0e39c18961b311b112220cd8de0f38c7b (diff)
downloadnimterop-9c206fea4f93fe2dcc9b5332d08d86f6dc5adb03.tar.gz
nimterop-9c206fea4f93fe2dcc9b5332d08d86f6dc5adb03.zip
Merge branch 'master' of https://github.com/genotrance/nimterop
-rw-r--r--nimterop/ast.nim4
-rw-r--r--nimterop/globals.nim1
-rw-r--r--toast.nim2
3 files changed, 6 insertions, 1 deletions
diff --git a/nimterop/ast.nim b/nimterop/ast.nim
index 4d20482..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
diff --git a/toast.nim b/toast.nim
index b418308..f743264 100644
--- a/toast.nim
+++ b/toast.nim
@@ -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"]: