add exports and library info to README.md
This commit is contained in:
1 parent
b239bf6509
commit
01d0289091
3 files changed
+150
-3
No files matched your search
@@ -181,6 +181,14 @@ Modelling a library name makes it keyword-extracted, so it no longer reaches `cu
|
||||
registers its own tag under one of these names and a different signature therefore gets a parse error. That
|
||||
is accepted: these names are common enough that shadowing them is the mistake.
|
||||
|
||||
**Adding a library tag or filter touches four files**: `grammar.js`, `queries/libraries.scm` (which library
|
||||
it came from), `queries/highlights.scm` (the name, spelled out) and the table in `README.md`, which lists
|
||||
every library name the grammar models. All four are hand-maintained, and **no test catches a name left out
|
||||
of any of them**: `tree-sitter test` loads every `.scm` under `queries/`, so a pattern naming a node that
|
||||
no longer exists aborts the whole run, but a name that was never added passes 304/304 in silence, and the
|
||||
README nothing checks at all. The library-contents differential below, run against
|
||||
`django.templatetags.<name>.register`, is what finds a gap.
|
||||
|
||||
### External scanner (`src/scanner.c`)
|
||||
|
||||
Twelve external tokens, for the constraints a context-free grammar cannot express:
|
||||
@@ -288,6 +296,11 @@ documentation or memory. Both checks are worth repeating whenever tags, filters
|
||||
|
||||
### Deliberate divergences from Django
|
||||
|
||||
`README.md` carries a shorter list of its own, and the two are not the same set on purpose: the README
|
||||
lists only the divergences where Django accepts an input that is almost certainly a mistake, which is the
|
||||
rule it states. Anything added here that fits that rule belongs there too; anything that does not — an
|
||||
unavoidable limitation, or a case where this grammar is the more permissive one — stays here.
|
||||
|
||||
- Django has no number token: `[\w.]+` is one lexeme and `int()`/`float()` decides whether it is a literal,
|
||||
so `1a`, `1e`, `0x1f`, `1.2.3`, `1__0` and `1.` are variable _lookups_ there and errors here.
|
||||
- Django has no boolean or `None` token either. `True`, `False` and `None` are lookups, which resolve
|
||||
|
||||
Reference in new issue
Block a user