Commit Graph
1 Commits
Author SHA1 Message Date
Brad ArantandClaude Sonnet 5 b1c275182a jetc: add barant.jet, a real-world DOM-equal reproduction of barant.com
Fetched the live raw HTML from https://barant.com/ (rendered by the
user's own separate JET-1.4 C interpreter, unrelated to this JetCore/
jetc project - see the barant.com project memory) and embedded it as
literal content in a jetc template (#api GET /barant), as a real-world
stress test of the --shared compiler against markup nobody wrote with
jetc in mind.

Needed several fixes to compile, all discovered by reading jetc's own
JetParser.cpp rather than guessing, and each one either genuinely
DOM-neutral or an actual bug fix in barant.com's own markup:

- Void elements (<meta>/<link>/<input>/<img>/<br>) had to be
  self-closed. jetc's parser treats any unrecognized <tag ...> as a
  generic custom tag needing a matching </tag> (mirroring the
  interpreter's own extensible custom-tag model) - it has no built-in
  notion of HTML's void-element list. Self-closing is standard HTML5
  syntax with zero effect on the parsed DOM either way.
- <!DOCTYPE html> and HTML comments (<!--...-->) aren't understood at
  all - confirmed via a minimal repro that even a bare <!-- comment -->
  breaks tag tokenization (the "<!" prefix isn't special-cased).
  Routed the doctype through a <set name="x" value="<!DOCTYPE html>"/>
  + $[x] pair instead - a <set> attribute value is a plain quoted
  string, never re-parsed as nested markup, verified via host_test to
  render byte-identical to the literal text. The one HTML comment
  (a Google Analytics label) was just removed outright - comments have
  no rendered/DOM effect, so this is neither a workaround nor a
  meaningful change, and the actual <script> tags it was labeling are
  untouched and verified still present.
- A genuine real bug in barant.com's own live markup: `<table
  class="menubar" cellspacing="0" cellpadding="0" width: 100%">` (line
  28) - a stray unpaired `"` with no matching partner (missing `=` and
  opening quote before `100%`). jetc's attribute scanner toggles into
  "inside a quoted value" mode on any `"` and treats everything
  (including the real closing `>`) as opaque until the next `"` -  a
  single unpaired quote anywhere derails tokenization for the rest of
  the file, which is exactly what "unterminated tag near end of input"
  turned out to mean here. Browsers silently tolerate this malformed
  attribute (hence it looking fine live); jetc's simpler tokenizer
  doesn't. Fixed to width="100%", the obvious intent.
- Two stray trailing </if></if> lines (a leftover artifact from
  barant.com's own JET-1.4 template engine, unrelated to anything here)
  were dropped - dead, invisible in any browser, and incompatible with
  jetc's tag-matching (no corresponding <if> anywhere).

Verified: diffed the actual rendered output (via host_test) against the
original fetched HTML - every difference maps exactly to one of the
changes above, nothing else moved. Deployed live into the running
APIServer test instance (GET /barant) and confirmed Content-Length
matches the diffed render exactly (13944 bytes).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-25 18:39:57 -07:00