Add comments to dfa's

This commit is contained in:
2025-06-21 16:01:35 -04:00
parent 7806f6420f
commit 1df18b3c57

View File

@@ -16,6 +16,11 @@
namespace parser3 { namespace parser3 {
// See https://gist.github.com/pervognsen/218ea17743e1442e59bb60d29b1aa725 for
// an explanation of this cycle/byte dfa implementation.
//
// Recognizes json number syntax. As a regex:
// -?([0-9]|[1-9][0-9]*)(\.[0-9]+)?((e|E)(-|\+)?[0-9]+)?
struct NumDfa { struct NumDfa {
constexpr static uint64_t num_dfa_table[256] = { constexpr static uint64_t num_dfa_table[256] = {
0x0ull, 0x0ull,
@@ -326,6 +331,8 @@ private:
uint64_t state = 6; uint64_t state = 6;
}; };
// Recognizes sequences of valid utf8 characters except 0-0x20, double quote,
// and backslash
struct Utf8Dfa { struct Utf8Dfa {
constexpr static uint64_t num_dfa_table[256] = { constexpr static uint64_t num_dfa_table[256] = {
0x0ull, 0x0ull,