ocaml: phase 1 tokenizer (+58 tests) — consumes lib/guest/lex.sx
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 52s

Idents, ctors, 51 keywords, numbers (int/float/hex/exp/underscored),
strings + chars with escapes, type variables, 26 op/punct tokens, and
nested (* ... *) block comments. Tests via epoch protocol against
sx_server.exe.
This commit is contained in:
2026-05-07 23:04:40 +00:00
parent 1eb9d0f8d2
commit 85b7fed4fc
4 changed files with 699 additions and 5 deletions

View File

@@ -0,0 +1,16 @@
;; lib/ocaml/tests/tokenize.sx — smoke tests for the OCaml tokenizer.
;;
;; Tests are exercised via lib/ocaml/test.sh, which drives sx_server.exe
;; over the epoch protocol. This file provides a small evaluator that
;; returns short diagnostic values for each fixture so the runner can
;; grep them out of one batched run.
(define
ocaml-test-tok-type
(fn (src i) (get (nth (ocaml-tokenize src) i) :type)))
(define
ocaml-test-tok-value
(fn (src i) (get (nth (ocaml-tokenize src) i) :value)))
(define ocaml-test-tok-count (fn (src) (len (ocaml-tokenize src))))