commit b34769b

shrub  ·  2026-10-15 18:11:54 +0000 UTC
parent 07bc628
dont allow empty name or null
1 files changed,  +8, -2
+8, -2
 1@@ -46,7 +46,9 @@ fun read(s: &scanner, allowed: (int) -<fun1> bool): void =
 2                         read(s, allowed) ) 
 3                     else $raise ScanErr
 4                end
 5-            else ()
 6+            else (
 7+                prerrln!("null at ", s.line,":",s.col);
 8+                $raise ScanErr )
 9         end
10     else ()
11 
12@@ -55,7 +57,11 @@ implement scanname(s) (*Strptr1*)=
13 let
14     val () = read(s, isnamec)
15 in
16-    stringbuf_takeout_all(s.buf) 
17+    if stringbuf_get_size(s.buf) = 0 then (
18+        prerrln!("expected name");
19+        $raise ScanErr 
20+    ) else 
21+        stringbuf_takeout_all(s.buf) 
22 end
23 
24 implement skipspace(s) (*void*) =