From ab3543cbdaed38fa4f79ce5479e2db37110a53ee Mon Sep 17 00:00:00 2001 From: Ganesh Viswanathan Date: Wed, 16 Jan 2019 21:49:17 -0600 Subject: Workaround 0.19.2 crash --- nimterop/cimport.nim | 4 +++- nimterop/globals.nim | 6 +++--- nimterop/treesitter/runtime.nim | 2 +- toast.nims | 1 - 4 files changed, 7 insertions(+), 6 deletions(-) delete mode 100644 toast.nims diff --git a/nimterop/cimport.nim b/nimterop/cimport.nim index 14c689d..91de727 100644 --- a/nimterop/cimport.nim +++ b/nimterop/cimport.nim @@ -1,6 +1,8 @@ import macros, os, strformat, strutils -import "."/globals +const CIMPORT = 1 + +include "."/globals proc interpPath(dir: string): string= # TODO: more robust: needs a DirSep after "$projpath" diff --git a/nimterop/globals.nim b/nimterop/globals.nim index 6ba64c1..5fb100c 100644 --- a/nimterop/globals.nim +++ b/nimterop/globals.nim @@ -2,7 +2,7 @@ import tables import regex -when defined(NIMTEROP): +when not defined(CIMPORT): import "."/treesitter/runtime type @@ -17,7 +17,7 @@ type name*: string kind*: Kind children*: seq[ref Ast] - when defined(NIMTEROP): + when not defined(CIMPORT): tonim*: proc (ast: ref Ast, node: TSNode) regex*: Regex @@ -33,7 +33,7 @@ type ast*: Table[string, seq[ref Ast]] data*: seq[tuple[name, val: string]] - when defined(NIMTEROP): + when not defined(CIMPORT): grammar*: seq[tuple[grammar: string, call: proc(ast: ref Ast, node: TSNode) {.nimcall.}]] var diff --git a/nimterop/treesitter/runtime.nim b/nimterop/treesitter/runtime.nim index 6650aaf..ca93fd4 100644 --- a/nimterop/treesitter/runtime.nim +++ b/nimterop/treesitter/runtime.nim @@ -2,7 +2,7 @@ import strutils -const sourcePath = currentSourcePath().split({'\\', '/'})[0..^4].join("/") & "/inc/treesitter" +const sourcePath = currentSourcePath().split({'\\', '/'})[0..^4].join("/") & "/inc/treesitter" {.passC: "-std=c11 -DUTF8PROC_STATIC".} {.passC: "-I$1/include" % sourcePath.} diff --git a/toast.nims b/toast.nims deleted file mode 100644 index 9c2ddac..0000000 --- a/toast.nims +++ /dev/null @@ -1 +0,0 @@ -switch("d", "NIMTEROP") \ No newline at end of file -- cgit v1.2.3