foxp/src/process.h

47 lines
560 B
C
Raw Normal View History

2024-06-09 16:39:12 +00:00
#include <stdbool.h>
#include "syntax.h"
2024-06-09 19:38:22 +00:00
typedef enum {
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
REPLACE,
FUNCTION
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
} tProcessingType;
typedef struct {
2024-06-09 20:58:38 +00:00
2024-06-09 16:39:12 +00:00
char* replacethis;
tSyntaxElement* replacewiththis;
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
} tProcessingReplace;
typedef struct {
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
char** args;
tSyntaxElement* body;
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
} tProcessingFunction;
typedef union {
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
tProcessingReplace replace;
tProcessingFunction function;
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
} tuProcessingData;
typedef struct ProcessingData {
2024-06-09 20:58:38 +00:00
2024-06-09 19:38:22 +00:00
struct ProcessingData* prev;
tProcessingType type;
tuProcessingData data;
2024-06-09 20:58:38 +00:00
2024-06-09 16:39:12 +00:00
} tProcessingData;
2024-06-09 20:58:38 +00:00
2024-06-09 16:39:12 +00:00
void process(tSyntaxElement*, tProcessingData*);