Generate native LSL parser tables (#83)
Some checks failed
Native code generation / deterministic (push) Failing after 2m36s
Imaging and meshing gate / native (push) Successful in 5m29s
JPEG 2000 feature / linux (push) Successful in 2m46s
Native Rust workspace compile / compile (push) Failing after 1m58s
Skia feature / linux (push) Successful in 31m14s

This commit is contained in:
2026-08-11 03:36:14 +00:00
parent 656d837778
commit 2558e2f49f
17 changed files with 3905 additions and 2700 deletions

View File

@@ -511,6 +511,39 @@ NATIVE_TYPES = {
"T:LibreMetaverse.Rendering.LindenSkeleton": "crate::skeleton::LindenSkeleton",
}
# The cs0 parser/token classes are generated from the reviewed Rust grammar
# input. Keep this list algorithmic so adding an alternative cannot leave a
# hand-maintained compatibility shell behind.
_LSL_GENERATED_TYPES = [
"ANY", "BASE", "COLON", "ID", "LBRACE", "LBRACK", "LPAREN", "NEW",
"RBRACE", "RBRACK", "RPAREN", "SEMICOLON", "THIS",
]
for _lhs, _alternatives in (
("ClassBody", 1), ("GStuff", 3), ("Stuff", 2), ("Cons", 1),
("Call", 1), ("BaseCall", 3), ("Name", 2), ("Item", 12),
):
_LSL_GENERATED_TYPES.append(_lhs)
for _alternative in range(1, _alternatives + 1):
_LSL_GENERATED_TYPES.extend((
f"{_lhs}_{_alternative * 2 - 1}",
f"{_lhs}_{_alternative * 2}",
f"{_lhs}_{_alternative * 2}_1",
))
_LSL_GENERATED_TYPES.extend(("cs0syntax", "cs0tokens", "yycs0syntax", "yycs0tokens"))
NATIVE_TYPES.update({
f"T:LibreMetaverse.LslTools.{name}": f"crate::generated_tables::{name}"
for name in _LSL_GENERATED_TYPES
})
for _name in (
"AddToFunc", "Builder", "Func", "GenBase", "LNode", "Nfa", "NfaNode",
"Path", "Regex", "Relation", "SCreator", "Serialiser", "Sfactory",
"SymbolType", "SymbolsGen", "TCreator", "Tfactory", "TokClassDef", "TokensGen",
):
NATIVE_TYPES[f"T:LibreMetaverse.LslTools.{_name}"] = f"crate::generator::{_name}"
NATIVE_TYPES["T:LibreMetaverse.LslTools.ObjectList.OListEnumerator"] = (
"crate::generator::ObjectListOListEnumerator"
)
# Native declarations whose cataloged method implementations are still emitted
# below. This is used for static namespace types such as OSDParser: the type is
# hand-written, while its fixed public methods remain generator-audited.