diff options
| author | Ben Fuhrmannek | 2021-08-16 15:47:01 +0200 |
|---|---|---|
| committer | Ben Fuhrmannek | 2021-08-16 15:47:01 +0200 |
| commit | 5148ded7268b569fd5e720f90b44645c83ac3e9e (patch) | |
| tree | 9d5c3035a7a85ffc27de7c32b441994a21a6347a /src/sp_config_scanner.h | |
| parent | 9dc6b23a2219e809e665bac7d82567533751d39d (diff) | |
fincy new scanner/parser for config rules + fixed a few bugs along the way + fixed related unittests
Diffstat (limited to 'src/sp_config_scanner.h')
| -rw-r--r-- | src/sp_config_scanner.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/sp_config_scanner.h b/src/sp_config_scanner.h new file mode 100644 index 0000000..3284713 --- /dev/null +++ b/src/sp_config_scanner.h | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | |||
| 2 | #ifndef SP_CONFIG_SCANNER_H | ||
| 3 | #define SP_CONFIG_SCANNER_H | ||
| 4 | |||
| 5 | typedef enum { | ||
| 6 | SP_ARGTYPE_UNKNOWN = 0, | ||
| 7 | SP_ARGTYPE_NONE, | ||
| 8 | SP_ARGTYPE_EMPTY, | ||
| 9 | SP_ARGTYPE_STR | ||
| 10 | } sp_argtype; | ||
| 11 | |||
| 12 | typedef struct { | ||
| 13 | char *kw; // keyword points directly to the parsed input text and as such is not null-terminated | ||
| 14 | size_t kwlen; | ||
| 15 | char *arg; // optional argument / can be not null terminated | ||
| 16 | size_t arglen; | ||
| 17 | sp_argtype argtype; | ||
| 18 | long lineno; | ||
| 19 | } sp_parsed_keyword; | ||
| 20 | |||
| 21 | zend_result sp_config_scan(char *data, zend_result (*process_rule)(sp_parsed_keyword*)); | ||
| 22 | zend_string *sp_get_arg_string(sp_parsed_keyword *kw); | ||
| 23 | zend_string *sp_get_textual_representation(sp_parsed_keyword *parsed_rule); | ||
| 24 | |||
| 25 | #endif \ No newline at end of file | ||
