about summary refs log tree commit diff stats
path: root/src/config/toml.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-06-02 00:36:54 +0200
committerbptato <nincsnevem662@gmail.com>2023-06-05 03:58:21 +0200
commit8027e52cb221c432bed64517015ebf3182e6166d (patch)
tree18991f9e74c8dcfc0ed7439f3bc78a0cfec9b2d6 /src/config/toml.nim
parentb3b97465805b7367df461a4b7b830fabaccf3a89 (diff)
downloadchawan-8027e52cb221c432bed64517015ebf3182e6166d.tar.gz
Add support for canvas and multipart
Quite incomplete canvas implementation. Crucially, the layout engine
can't do much with whatever is drawn because it doesn't support images
yet.

I've re-introduced multipart as well, with the FormData API. For the
append function I've also introduced a hack to the JS binding generator
that allows requesting the JSContext pointer in nim procs. Really I
should just fix the union generator thing and add support for overloading.

In conclusion, for now the only thing canvas can be used for is exporting
it as PNG and uploading it somewhere. Also, we now have PNG encoding and
decoding too. (Now if only we had sixels as well...)
Diffstat (limited to 'src/config/toml.nim')
-rw-r--r--src/config/toml.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/config/toml.nim b/src/config/toml.nim
index c34e46a7..05a202ab 100644
--- a/src/config/toml.nim
+++ b/src/config/toml.nim
@@ -1,5 +1,6 @@
 import streams
 import tables
+import options
 import times
 import strutils
 import strformat
@@ -367,6 +368,7 @@ proc consumeNumber(state: var TomlParser, c: char): TomlValue =
 
   if state.has(1):
     if state.peek(0) == 'E' or state.peek(0) == 'e':
+      isfloat = true
       var j = 2
       if state.peek(1) == '-' or state.peek(1) == '+':
         inc j
@@ -383,7 +385,7 @@ proc consumeNumber(state: var TomlParser, c: char): TomlValue =
     return TomlValue(vt: VALUE_FLOAT, f: val)
 
   let val = parseInt64(repr)
-  return TomlValue(vt: VALUE_INTEGER, i: val)
+  return TomlValue(vt: VALUE_INTEGER, i: val.get)
 
 proc consumeValue(state: var TomlParser): TomlValue