This commit is contained in:
Ganesh Viswanathan 2018-12-03 14:20:31 -06:00
commit 9c206fea4f
3 changed files with 6 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -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"]: