summaryrefslogtreecommitdiff
path: root/tokenizer.fun
diff options
context:
space:
mode:
authorVladimir Azarov <avm@intermediate-node.net>2025-08-04 15:12:55 +0200
committerVladimir Azarov <avm@intermediate-node.net>2025-08-04 15:12:55 +0200
commit396ebf0c76153e5e1e9dc77371bdd02b4d3d85d1 (patch)
tree3c2aab25631581d5367a6288c2eb9e0f812d76b0 /tokenizer.fun
parent671760c2b5857312cac178f24cad8686c1d4b719 (diff)
Flattening of initializers
Diffstat (limited to 'tokenizer.fun')
-rw-r--r--tokenizer.fun21
1 files changed, 21 insertions, 0 deletions
diff --git a/tokenizer.fun b/tokenizer.fun
index cce6bea..80200d5 100644
--- a/tokenizer.fun
+++ b/tokenizer.fun
@@ -253,6 +253,9 @@ struct
fun clKw tk (ppc, NONE) = (ppc, SOME tk)
| clKw _ _ = raise Unreachable
+
+ val res = ST.getId symtab "0"
+ val () = if res <> 0 then raise Unreachable else ()
in
app (fn (tk, repr) =>
if ?repr = ppcPrefix then
@@ -576,6 +579,24 @@ struct
| _ => (c, stream)
end
+ fun strlit2charList (s: string) =
+ let
+ val s = String.substring (s, 1, size s - 2)
+ val stream = S.createFromString s
+
+ fun collect acc stream =
+ let
+ val (c, stream) = getMaybeBackslashed stream
+ in
+ case c of
+ Reg #"\000" => rev $ #"\000" :: acc
+ | Reg c | EscSeqed c => collect (c :: acc) stream
+ | NoChar => raise Unreachable
+ end
+ in
+ collect [] stream
+ end
+
fun parseCharConst symtab stream =
let
val startOff = S.getOffset stream - 1