1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! Compact IDs for automaton states, ranked symbols, and arities.
use fmt;
/// Dense integer identifier for an automaton state.
///
/// `StateId` is the fast state representation used by [`crate::Explicit`],
/// [`crate::Memo`], and deterministic runners. IDs are dense, starting at zero,
/// so they can be used to index vectors and bitsets.
///
/// Most users should create states with [`crate::ExplicitBuilder::new_state`]
/// or [`crate::Interner::intern`] rather than constructing `StateId` directly.
/// The one special value is [`StateId::STUCK`], which is reserved for rejected
/// subtrees and must not be used as an ordinary state.
;
/// Identifier for a node label or grammar symbol.
///
/// The library deliberately does not intern or interpret symbols. Your
/// application owns the signature and maps labels such as `"a"` or `"concat"`
/// to `Symbol` values.
;
/// Number of children a symbol expects.
///
/// `Arity` appears mainly in [`crate::materialize()`], where the caller provides
/// the finite alphabet to explore.
pub type Arity = u8;