summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorCharlie Barto <bartoc@umich.edu>2014-02-26 22:25:02 -0500
committerCharlie Barto <bartoc@umich.edu>2014-02-26 22:25:02 -0500
commita79579da6fd03f11dc48f03cc9e8598603fa3863 (patch)
treeb53b0343006662af7e0289ca5f6b2a3ea589c4a5 /lib
parent2b271e7b17a08e27b2fe961e93eebb3089461dbb (diff)
downloadNim-a79579da6fd03f11dc48f03cc9e8598603fa3863.tar.gz
added an overload for highlight.initGeneralTokenizer that accepts a cstring.
I use this when calling the highlighter from C#.
Diffstat (limited to 'lib')
-rw-r--r--lib/packages/docutils/highlite.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/packages/docutils/highlite.nim b/lib/packages/docutils/highlite.nim
index 4ca0c79e0..c507f5e1c 100644
--- a/lib/packages/docutils/highlite.nim
+++ b/lib/packages/docutils/highlite.nim
@@ -61,9 +61,8 @@ proc getSourceLanguage*(name: string): TSourceLanguage =
     if cmpIgnoreStyle(name, sourceLanguageToStr[i]) == 0: 
       return i
   result = langNone
-
-proc initGeneralTokenizer*(g: var TGeneralTokenizer, buf: string) = 
-  g.buf = cstring(buf)
+proc initGeneralTokenizer*(g: var TGeneralTokenizer, buf: cstring) =
+  g.buf = buf
   g.kind = low(TTokenClass)
   g.start = 0
   g.length = 0
@@ -71,6 +70,8 @@ proc initGeneralTokenizer*(g: var TGeneralTokenizer, buf: string) =
   var pos = 0                     # skip initial whitespace:
   while g.buf[pos] in {' ', '\x09'..'\x0D'}: inc(pos)
   g.pos = pos
+proc initGeneralTokenizer*(g: var TGeneralTokenizer, buf: string) = 
+  initGeneralTokenizer(g, cstring(buf))
 
 proc deinitGeneralTokenizer*(g: var TGeneralTokenizer) = 
   discard