vendor/edn rather than the prelude: the prelude is prepended to every program and everything in it is emitted, so a reader nobody imports would be a cost every build pays. The tokenizer only. A type-directed reader - the compiler emitting a parser from a walk over a struct's fields, the dual of the printer C-x C-e already has - lands in check.ml and emit.ml and is not this. What a caller writes today is a struct reader by hand against the cursor, and the acceptance program carries one, because that is what proves the API is usable rather than present. Every token is a slice into the source, so nothing allocates and the buffer has to outlive the tokens. That contract is stated at the top of the package, because it is the kind of thing found the hard way. Escaped strings are refused rather than half-supported: unescaping needs a copy and there is nowhere to put one, and handing back the raw bytes would return a three-byte string as four with a backslash in it. Each other refusal carries its own sentence - #inst and #uuid separately from tagged literals, because a file is most likely to contain those two and being told tagged literals are refused would not say that the timestamp is the thing to delete. Errors live on the cursor, a code and a byte offset, not in the return type: an Option loses the position, which is the whole point for an editor. A failed cursor is poisoned so a caller's loop terminates on a malformed file rather than spinning. # Conflicts: # test/test_acceptance.ml
27 lines
1.3 KiB
Plaintext
27 lines
1.3 KiB
Plaintext
(tests
|
|
(names test_flan test_acceptance test_reload test_agent test_session test_dev test_emacs test_repl)
|
|
(libraries flan unix)
|
|
; The acceptance programs are part of the test corpus: if the reader, the
|
|
; parser or the checker regresses on them we want to know here, not at the CLI.
|
|
(deps
|
|
(file %{workspace_root}/calc-me.flan)
|
|
(file %{workspace_root}/sand.flan)
|
|
; The sim package and the raylib bindings, because the headless sand case and
|
|
; the FFI case import them and an import reads the directory at build time.
|
|
(glob_files %{workspace_root}/sand-sim/*)
|
|
(glob_files %{workspace_root}/vendor/raylib/*)
|
|
; The dev agent package: its Flan declarations and the C that implements them.
|
|
(glob_files %{workspace_root}/vendor/agent/*)
|
|
; The EDN tokenizer, which programs/edn.flan imports.
|
|
(glob_files %{workspace_root}/vendor/edn/*)
|
|
(glob_files programs/*.flan)
|
|
; The reload primitive's host: a C main that dlopens what Build.shared made.
|
|
(file reload_host.c)
|
|
; test_dev runs the compiler itself: flan dev launches and owns a program.
|
|
(file %{workspace_root}/bin/main.exe)
|
|
; The Emacs client, which test_emacs drives against a real daemon.
|
|
(glob_files %{workspace_root}/emacs/*.el)
|
|
; The WASI host the wasm32 case runs its module under, when no wasmtime or
|
|
; wasmer is installed.
|
|
(file wasm-run.mjs)))
|