about summary refs log tree commit diff stats
path: root/src/utils/twtstr.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-01 19:05:45 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-01 19:37:48 +0200
commitaf3dbce840d0d0956663ffb20012329a4c22d5dd (patch)
treeda3c2bad567d9b08f585cbc973aac61ef4eb05ae /src/utils/twtstr.nim
parentcab49aa0952c24941bcfb9a5b483f796158bf373 (diff)
downloadchawan-af3dbce840d0d0956663ffb20012329a4c22d5dd.tar.gz
Fixes & workarounds to compile on Nim 2.0.0
* Import punycode, as it has been removed from stdlib.
* Fix some syntax errors
* Apparently you can no longer compare distinct pointers with nil.
  Add explicit comparisons with typeof(nil) instead.
* htmlparser: rename _ to other, as semantics of _ have changed.
  (Quite a shame, it looked better with _. Oh well.)
* Explicitly specify mm:refc, as the browser OOMs with orc for
  some reason.

Confirmed to compile & run on 2.0.0, 1.6.14, 1.6.12, 1.6.10 and 1.6.8.
(<1.6.8 it's broken & wontfix.)
Diffstat (limited to 'src/utils/twtstr.nim')
-rw-r--r--src/utils/twtstr.nim6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index 9273b703..1c2c2a1d 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -5,7 +5,6 @@ import os
 import math
 import sequtils
 import options
-import punycode
 
 import bindings/libunicode
 import data/charwidth
@@ -13,6 +12,7 @@ import data/idna
 import js/javascript
 import utils/map
 import utils/opt
+import lib/punycode
 
 when defined(posix):
   import posix
@@ -951,7 +951,9 @@ func isCombining(r: Rune): bool =
 # We do not store a lookup table of ambiguous ranges, either.
 type PropertyTable = array[0..(0xFFFF div 8), uint8]
 
-func makePropertyTable(ranges, skip: openarray[(uint32, uint32)] = @[]): PropertyTable =
+type RangeMap = openarray[(uint32, uint32)]
+
+func makePropertyTable(ranges: RangeMap, skip: RangeMap = @[]): PropertyTable =
   var ucs: uint32 = 0
   var j = 0
   var k = 0
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271