rfc: strict HCON grammar (not wired in) - #4047
Draft
manwithacat wants to merge 1 commit into
Draft
Conversation
Adds hcon/ as a proposed LL(1) replacement for the shipping regex HCON parser. Not wired into src/htmx.js. The new hcon_grammar CI job runs node --test with no Playwright. Comma is a List separator only; Maps are whitespace-separated. Colon-form oob (beforeend:#table tbody) is a well-formed map that interpretOob rejects. Selectors are quoted values. Related: bigskysoftware#4029.
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.
Description
RFC for a closed HCON grammar. Not wired into
src/htmx.js. Shipping HCON is unchanged.Discussion: #4046
Related: #4029 (colon-form
hx-swap-oobis a Map the host must reject, not a regex the parser should stretch).Adds:
hcon/GRAMMAR.md— LL(1) EBNF. Two start symbols (Map vs List) so comma is not overloaded.hcon/src/hcon.js— recursive descent, no regex. Quoted values are always strings. Leftover non-pairs error.hcon/src/interpret.js—hx-swap/hx-swap-oob/hx-triggerinterpret maps. Colon form (beforeend:#table tbody) is a well-formed map thatinterpretOobrejects in favour ofbeforeend target:'#table tbody'.hcon/test/— 40 Node tests, including a corpus against the shipping regex and a no-regex gate on the parser surface.hcon_grammar:node --test hcon/test/*.test.js(no Playwright, ~60ms).This PR is a demonstration so the discussion has a runnable artefact. Please treat it as draft until the grammar is accepted (or rejected). If the direction is wrong, close it.
Checklist
four-devnode --test hcon/test/*.test.js(40 passed)