mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
65313fd340
This imports Chromium's `make_dafsa.py` script [1]. It takes in a gperf formatted file (note: gperf is *not* required) and converts that to a compact binary representation of the string data in the form of a deterministic acyclic finite state automaton (DAFSA) [2]. The only change made to the script was to make it handle the arguments our file generation script passes in to the `main` function. It also imports the logic for traversing the DAFSA [3] almost verbatim in `Dafsa.cpp`. A thin wrapper was added so that we can reuse the DAFSA structure for multiple tables. The only change made to the original logic was to swap in mozilla style assertions and rename the not found constant from `kNotFound` to `Dafsa::kKeyNotFound` in order to avoid a collision with `kNotFound` defined in our nsString code. [1]6ba04a9056/tools/dafsa/make_dafsa.py
[2] https://en.wikipedia.org/wiki/Deterministic_acyclic_finite_state_automaton [3]a2a90a35aa/net/base/registry_controlled_domains/registry_controlled_domain.cc (72)
MozReview-Commit-ID: Eion9POHZm5
7 lines
64 B
Plaintext
7 lines
64 B
Plaintext
%%
|
|
foo.bar.baz, 1
|
|
a.test.string, 0
|
|
a.test.string2, 2
|
|
aaaa, 4
|
|
%%
|