| 1 | #ifndef EVAL_RE2C_LEMON_INTERNAL_H |
| 2 | #define EVAL_RE2C_LEMON_INTERNAL_H |
| 3 | |
| 4 | #include "../eval-internal.h" |
| 5 | #include "parser.h" // This has the token definitions (TOK_*) |
| 6 | |
| 7 | // Token values for re2c lexer |
| 8 | typedef union { |
| 9 | NETDATA_DOUBLE dval; |
| 10 | char *strval; |
| 11 | } YYSTYPE; |
| 12 | |
| 13 | // Scanner structure definition |
| 14 | typedef struct { |
| 15 | const char *cursor; |
| 16 | const char *marker; |
| 17 | const char *token; |
| 18 | const char *limit; |
| 19 | int line; |
| 20 | int error; // Flag to indicate a lexer error occurred |
| 21 | } Scanner; |
| 22 | |
| 23 | // Function declarations for the scanner |
| 24 | void scanner_init(Scanner *s, const char *input); |
| 25 | int scan(Scanner *s, YYSTYPE *lval); |
| 26 | |
| 27 | // Function declarations for the parser |
| 28 | void *ParseAlloc(void *(*mallocProc)(size_t)); |
| 29 | void ParseFree(void *p, void (*freeProc)(void*)); |
| 30 | void Parse(void *yyp, int yymajor, YYSTYPE yyminor, EVAL_NODE **result); |
| 31 | |
| 32 | // Additional error code |
| 33 | #define EVAL_ERROR_SYNTAX EVAL_ERROR_UNKNOWN_OPERAND |
| 34 | |
| 35 | #endif // EVAL_RE2C_LEMON_INTERNAL_H |