schema: ludicc --emit-schema / ludic schema, --check --diagnostics=json, and editor attributes
--emit-schema FILE writes the compiler's resolved view once the program type-checks: every
record (fields, types, defaults as written, docs, places, attributes), every registry with its
entries in their final order after the open-registry merge (key, constant, index, file:line:col
of the entry and of each field value, and which file contributed which keys), every const, and
the zero-argument functions a fn value can name. Deterministic, schema_version 1; the runtime is
left out. `ludic schema [file] [-o FILE]` wraps it.
--check --diagnostics=json prints every error as one JSON array on stdout: the checker's and the
module rules' all, a parse or lowering error as the last. Tokens and nodes now carry a column.
Fields take several @attributes; @Ref(Registry), @OneOf(PREFIX_), @Range(lo, hi), @Unit("..."),
@Asset("..."), @Color on a field and @AppendOnly / @ByKey on a registry change nothing but go into
the schema, and @Ref naming no registry is an error (every one reported). Fixtures:
examples/lang/attributes.ludic, examples/rejected/ref_unknown.ludic, cases in ludic-dev test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f8d811aa97
commit
42deb76c28
27 changed files with 1220 additions and 23 deletions
|
|
@ -261,8 +261,12 @@ function deps_keeps(f: pointer, seen: []bool) -> void {
|
|||
if kind == null { kind = "text" }
|
||||
deps_line(f, `fkeep {kind} {d.file}:{itoa(site.line)} {at} {fr_chain(k)}`)
|
||||
if g_arena_strict {
|
||||
let m = `{d.file}:{itoa(site.line)}: error: frame code keeps what it makes: this {kind} is kept at {at} ({fr_chain(k)}) - keep(...) or intern(...) to copy it on purpose, or @alloc_ok("why")\n`
|
||||
file_write(file_stderr(), m, len(m))
|
||||
let fm = `frame code keeps what it makes: this {kind} is kept at {at} ({fr_chain(k)}) - keep(...) or intern(...) to copy it on purpose, or @alloc_ok("why")`
|
||||
if g_diag_json { diag_add(d.file, site.line, site.col, "error", fm) }
|
||||
else {
|
||||
let m = `{d.file}:{itoa(site.line)}: error: {fm}\n`
|
||||
file_write(file_stderr(), m, len(m))
|
||||
}
|
||||
}
|
||||
n += 1
|
||||
}
|
||||
|
|
@ -270,7 +274,7 @@ function deps_keeps(f: pointer, seen: []bool) -> void {
|
|||
s += 1
|
||||
}
|
||||
deps_line(f, `frame_keeps {itoa(n)}`)
|
||||
if g_arena_strict and n > 0 { exit(1) }
|
||||
if g_arena_strict and n > 0 { diag_exit(1) }
|
||||
deps_births(f, seen)
|
||||
deps_resources(f) # 25.5e
|
||||
deps_owned(f)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue