@amql/selector
v0.0.0-alpha.0
Published
Structural selector parser and matcher for annotation trees
Readme
amql-selector
CSS-like selector parsing and matching for AQL annotation trees
Role
- Parses selectors like
controller[method="POST"] > handler - Matches annotations against compound selectors with combinators
- Defines shared newtypes:
TagName,AttrName - Dependency of amql-engine
Features
wasm— WASM bindings viawasm_bindgents— TypeScript type generation viats-rsjsonschema— JSON Schema derivation viaschemars
Types
SelectorAst— parsed selector treeCompoundSelector— tag + attribute predicatesCombinator— Child, Descendant, AdjacentSibling, GeneralSiblingAttrPredicate— attribute comparison (name, op, value)TagName— opaque newtype for annotation/element tag namesAttrName— opaque newtype for attribute keys
Getting Started
use aql_selector::{parse_selector, TagName, AttrName};
let ast = parse_selector("controller[method=\"POST\"] > handler")?;
assert_eq!(ast.compounds.len(), 2);npm
- Package:
@aql/selector - Build:
bun run build(wasm-pack + codegen) - Types: branded newtypes (
TagName,AttrName), generated viats-rs
