JaiFileTypeTest could previously only check the virtual file's type, because
without a ParserDefinition the PSI file fell back to plain text. It now asserts
the PSI file is a JaiFile in the Jai language and that JaiParserDefinition is the
registered definition - the wiring every PSI-dependent feature needs.
Also records the in-memory-fixture flake ('Cannot create child file at /src') as
infrastructure, with the note that JaiCorpusParserTest sidesteps it by using
PsiFileFactory directly.
Records the parser design facts a future agent needs before touching Jai.bnf:
the token-factory requirement, what lives in JaiParserUtil and why, the PSI
element that truncates an enclosing expression, longest-first operator ordering,
and directive-flag adjacency. Adds the stale-output symptoms and the sticky
--tests filter to the environment gotchas, and writes down the grammar
iteration loop.
Phase 3 is marked done; the remaining 58 corpus files are listed as the pick-up
point with the three known gaps named.
Adds src/main/grammar/Jai.bnf, the generated parser/PSI in src/main/gen, a
JaiParserDefinition, and the Tier 3 corpus parse gate (406/714 files clean).
Two things were not obvious:
- Grammar-Kit mints its own token instances from the .bnf 'tokens' block, which
are different objects from the ones JaiLexer emits, so every rule silently
failed to match. Fixed with tokenTypeFactory -> JaiTokenTypes.byName.
- A backslash inside an identifier is a continuation in the compiler's lexer
(Jai_Lexer/module.jai:444): 'left\_margin' is one identifier. JaiLexer now
does the same; the Tier 0 round-trip still holds because the token span
covers the backslash and the skipped spaces.
Constructs that BNF alone cannot express live in JaiParserUtil: directive-name
tests (#ident is one token), '==' before '{' for the switch form, procedure
header vs parenthesised expression, and the declaration lookahead.
- README documents install-from-disk and what actually works today
- jaitest prints the recovery steps when a poisoned build cache makes
:test report NO-SOURCE, and AGENTS.md records the failure mode