Rename tables

This commit is contained in:
2025-06-21 16:05:02 -04:00
parent 1df18b3c57
commit 6c48c40d67

View File

@@ -22,7 +22,7 @@ namespace parser3 {
// Recognizes json number syntax. As a regex:
// -?([0-9]|[1-9][0-9]*)(\.[0-9]+)?((e|E)(-|\+)?[0-9]+)?
struct NumDfa {
constexpr static uint64_t num_dfa_table[256] = {
constexpr static uint64_t table[256] = {
0x0ull,
0x0ull,
0x0ull,
@@ -300,7 +300,7 @@ struct NumDfa {
constexpr int kStride = 16;
if (bufEnd - buf < kStride) [[unlikely]] {
while (buf != bufEnd) {
uint64_t row = num_dfa_table[uint8_t(*buf)];
uint64_t row = table[uint8_t(*buf)];
auto prev = state_;
state_ = (row >> (state_ & 63)) & 63;
if (state_ == 0) {
@@ -315,7 +315,7 @@ struct NumDfa {
uint8_t prev[kStride + 1];
prev[0] = state_;
for (int i = 0; i < kStride; ++i) {
uint64_t row = num_dfa_table[uint8_t(*buf)];
uint64_t row = table[uint8_t(*buf)];
prev[i + 1] = row >> (prev[i] & 63);
if ((prev[i + 1] & 63) == 0) {
state = prev[i];
@@ -334,7 +334,7 @@ private:
// Recognizes sequences of valid utf8 characters except 0-0x20, double quote,
// and backslash
struct Utf8Dfa {
constexpr static uint64_t num_dfa_table[256] = {
constexpr static uint64_t table[256] = {
0x0ull,
0x0ull,
0x0ull,
@@ -609,7 +609,7 @@ struct Utf8Dfa {
constexpr int kStride = 16;
if (bufEnd - buf < kStride) [[unlikely]] {
while (buf != bufEnd) {
uint64_t row = num_dfa_table[uint8_t(*buf)];
uint64_t row = table[uint8_t(*buf)];
auto prev = state_;
state_ = (row >> (state_ & 63)) & 63;
if (state_ == 0) {
@@ -624,7 +624,7 @@ struct Utf8Dfa {
uint8_t prev[kStride + 1];
prev[0] = state_;
for (int i = 0; i < kStride; ++i) {
uint64_t row = num_dfa_table[uint8_t(*buf)];
uint64_t row = table[uint8_t(*buf)];
prev[i + 1] = row >> (prev[i] & 63);
if ((prev[i + 1] & 63) == 0) {
state = prev[i];