Repository navigation
parser: HTML and CSS front end on tree-sitter, with specification and torture suites - #1858
Merged
swapnilpaliwal-sd merged 2 commits intoOct 7, 2026
Merged
Conversation
…ion and torture suites
One web front end reads `.html`/`.htm`/`.xhtml` and `.css` into seventeen relations
(`all-html-*.csv`, `all-css-*.csv`), the way the configuration formats are read: every
scan target, structurally, nothing rendered. tree-sitter-html 0.23.2 and tree-sitter-css
0.23.0 build the trees; what either grammar rejects but the language allows (an unquoted
`url(../x)`, `[a="b" i]`, `@container name`, `& &`, `! important`, `10%, 20%`, `col || td`,
`:nth-child(2n of S)`, uppercase end tags, Jinja tags inside a start tag, …) is re-read
from the source text and marked recovered, not reported as a gap.
Pages: documents with doctype and template dialects, elements as written with XPath-like
paths, attributes by kind, class tokens, every URL a page names classified and resolved
to a file (honouring `<base href>`, for the page's own `<style>` and `style=""` too),
scripts with their body range (inside inline `<svg>` as well), handler calls from `on*`
attributes, `javascript:` URLs and framework event bindings, and template expressions:
a Vue `v-for` declares its loop variables, `@click="save(id)"` is a call, `:class` a
binding, `{{ user.name }}` an interpolation; Angular, Alpine, Jinja, Handlebars, ERB and
the rest likewise. Sheets: rules and at-rules as a tree including nesting, selectors
with specificity, simple selectors with combinators (a namespaced type keeps its prefix
as the part's value), declarations, the names values refer to (custom properties, URLs,
imports, keyframes, layers, containers, font families), comments and gaps.
Tests: `web-tests.ts` is the specification (format checks with the implementation each
rules out, a fixture golden, key uniqueness, FK integrity, schema arity and domains,
determinism, an enum-emission audit); `web-torture.ts` runs the analyzer over a project
written to hold every trap a static reader meets and asserts the joins row by row, with a
DEFECT/GAP/LIMIT verdict per check so what the front end does not do stays an explicit,
current list. `tools/web-corpus-bench` is the development-only oracle against parse5,
htmlparser2, css-tree and postcss over downloaded corpora, with its baseline.
In per-language mode the web tables are copied into every java/, javascript/ and
typescript/ folder that exists, since a page is read by whichever of those engines the
repository runs. No engine reads them yet; the frozen schema and `.decl` lines are under
`src/schema/web/` for that step.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
JaredHLZhang
requested review from
Whua689,
suyashpaliwal26 and
swapnilpaliwal-sd
as code owners
October 7, 2026 19:54
Contributor
|
The java failure here is inherited from the base branch, not this PR: the engine-package test's stubbed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
One web front end for
.html/.htm/.xhtmland.css, read into seventeen relations (all-html-*.csv,all-css-*.csv) the way the configuration formats are read: every scan target, structurally, nothing rendered. Trees come from tree-sitter-html 0.23.2 and tree-sitter-css 0.23.0; what either grammar rejects but the language allows is re-read from the source text and marked recovered rather than reported as a gap.<base href>, for the page's own<style>andstyle=""too), scripts with their body range (inside inline<svg>as well), handler calls fromon*attributes,javascript:URLs and framework event bindings, and template expressions (v-fordeclares its loop variables,@click="save(id)"is a call,:classa binding,{{ user.name }}an interpolation; Angular, Alpine, Jinja, Handlebars, ERB and the rest likewise).java/,javascript/andtypescript/folder that exists. No engine reads them yet; the frozen schema and.decllines are underparser/src/schema/web/.Tests
npx tsx src/test/web-tests.ts: the specification suite (format checks with the implementation each rules out, fixture golden, key uniqueness, FK integrity, schema arity and domains, determinism, enum-emission audit). 32 checks, green.npx tsx src/test/web-torture.ts: the adversary, over a project written to hold every trap a static reader meets, asserting the joins row by row with a DEFECT/GAP/LIMIT verdict per check. 79 checks, green; 17 GAP/LIMIT findings are reported as the explicit list of what the front end does not yet do (browser tree repairs, CDATA in XHTML styles, quoted@keyframesnames,image-set()URLs, Svelte/htmx handlers, …).parser/tools/web-corpus-bench: development-only oracle against parse5, htmlparser2, css-tree and postcss over downloaded corpora, with its dated baseline.Notes
apps/integration-0.1.9was declined by the protected-branch hook, hence this PR. The parser version stays at this branch's0.1.3..gitattributesexempts the one CRLF torture fixture from normalisation because its line endings are the case under test.🤖 Generated with Claude Code