Would an opt-in declaration source-provenance API be in scope?
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 28/100
Direzione di ricerca
Inizia leggendo il percorso di dichiarazione attuale di RuleBodyParser, inclusi DeclarationParser::parse_value e il ciclo di vita di alto livello di parse_until_after. Confronta un design additivo circoscritto con le osservazioni di provenienza richieste, usando parse_important e il retry tra declaration e qualified rule come punti di ingresso chiave. Il lavoro è concluso quando i maintainer concordano sull’ambito e il design preserva il comportamento esistente di parsing, retry, errore e costo opt-in.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Hi,
I am evaluating cssparser for source-backed developer tooling that needs exact
zero-based, half-open UTF-8 byte ranges for CSS declarations while preserving the
existing full-stylesheet and RuleBodyParser lifecycle.
For example:
a { c\6F lor/**/: red !/**/Im\70 ortant; }
The decoded property name is color, but the authored property-name spelling is
c\6F lor. Its exact raw endpoint cannot be reconstructed safely from the
decoded identifier length.
In the current RuleBodyParser declaration path, the parser records the
declaration start, consumes the property-name Ident and the colon, and then
calls DeclarationParser::parse_value. The callback receives the decoded name,
a parser positioned after the colon, and the declaration-start state. The
high-level path also finalizes through parse_until_after, so it does not expose
whether the declaration ended with an authored semicolon, the end of the current
block, or the end of the input.
Recovering these boundaries downstream by searching the retained source,
resetting and replaying the parser, reparsing a fragment, or introducing another
tokenizer would duplicate parser behavior and could diverge around escapes,
comments, malformed input, and declaration-versus-qualified-rule retry.
Would an additive, opt-in public capability for declaration source provenance be
considered in scope for cssparser?
The coherent capability I am trying to validate would allow an opt-in consumer
to obtain, for a declaration that ultimately commits:
- parser-owned raw boundaries for the property name and colon;
- value-boundary checkpoints captured from the active
Parser, while property
and descriptor grammar remains downstream; - an exact raw range from a provenance-aware equivalent of
parse_important
when the consumer accepts that annotation in the current context; - the termination kind and range, distinguishing an authored semicolon, block
end, and input end; and - no committed declaration provenance when a failed declaration attempt is
retried and accepted as a qualified rule.
I am not committed to a particular API shape or to implementing this as one
large change. Possible directions could include a structured parse context,
additive lifecycle observations, parser-owned result metadata, or a separate
source-aware path that shares the existing parsing control flow.
The intended constraints are:
- preserve existing declaration recognition, nesting retry, and error behavior;
- keep property and descriptor value grammar downstream;
- avoid changing existing required trait methods or iterator item types when an
additive design is practical; - do not accept arbitrary downstream offsets as parser-authenticated evidence;
- avoid source searching, replay, fragment reparsing, a second tokenizer, or
exposure of unstable tokenizer internals; - avoid mandatory parser-state growth or hot-path cost for consumers that do not
request provenance unless measurement justifies it; and - avoid requiring a permanent downstream fork.
Before preparing a prototype, I would appreciate guidance on:
- whether this capability belongs in
cssparser; - whether maintainers would prefer an Issue, a small prototype, or a draft Pull
Request first; and - whether an initial bounded prototype should begin with parser-owned prefix and
termination boundaries while documenting the coherent lifecycle, or should
cover the committed declaration envelope including consumer-assisted value
and priority observations from the start.
I can prepare a bounded API comparison, focused test cases, compatibility checks,
and a representative downstream usage example after receiving direction.
Thank you.
- Lingua principale
- Rust
- Stelle
- 869
- Fork
- 152
- Merge medio
- 15h 8m
- PR unite (30g)
- 12
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di servo/rust-cssparser
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
servo/rust-cssparser#440 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
servo/rust-cssparser#439 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
servo/rust-cssparser#434 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
servo/rust-cssparser#438 · 3 commenti · 1 reazione ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
servo/rust-cssparser#423 · 5 commenti ·
Tutte le issue di servo/rust-cssparser
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
Axis areas are always keyboard-focusable (Sense::drag), even with allow_axis_zoom_drag(false) Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
bug team:backend track:services-maintenance
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
cowprotocol/services#4950 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
gitbutlerapp/gitbutler#15998 · 1 commento ·