aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-01-16 21:49:17 -0600
committerGanesh Viswanathan <dev@genotrance.com>2019-01-16 21:49:17 -0600
commitab3543cbdaed38fa4f79ce5479e2db37110a53ee (patch)
tree19641f17bdb8ade57ad163c3731362316dbbbac8
parent0e3588d258ed5a2e8eb5e2535fc33056fd43ab53 (diff)
downloadnimterop-ab3543cbdaed38fa4f79ce5479e2db37110a53ee.tar.gz
nimterop-ab3543cbdaed38fa4f79ce5479e2db37110a53ee.zip
Workaround 0.19.2 crash
-rw-r--r--nimterop/cimport.nim4
-rw-r--r--nimterop/globals.nim6
-rw-r--r--nimterop/treesitter/runtime.nim2
-rw-r--r--toast.nims1
4 files changed, 7 insertions, 6 deletions
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