Use gperf - not faster yet

This commit is contained in:
2025-08-17 06:22:55 -04:00
parent 6343213e1b
commit ce9d7db277
6 changed files with 193 additions and 56 deletions

34
src/json_tokens.gperf Normal file
View File

@@ -0,0 +1,34 @@
%{
#include <string.h>
%}
%define hash-function-name hash_json_token
%define lookup-function-name lookup_json_token
%language=C++
%global-table
%struct-type
%readonly-tables
%compare-lengths
struct JsonToken {
const char* name;
int token_id;
};
%%
"preconditions", 1
"operations", 2
"request_id", 3
"leader_id", 4
"read_version", 5
"type", 6
"key", 7
"begin", 8
"end", 9
"value", 10
"version", 11
"point_read", 12
"range_read", 13
"write", 14
"delete", 15
"range_delete", 16
%%