Files
my-os-project2/user/tb/interp.h
2025-09-14 23:31:14 +02:00

38 lines
570 B
C

#ifndef TB_INTERP_H_
#define TB_INTERP_H_
#include <stddef.h>
#include <stdbool.h>
#include "runtime.h"
#define INTERP_ERRMSG_BUF_MAX (2048)
typedef struct {
char errmsg[INTERP_ERRMSG_BUF_MAX];
} InterpResult;
typedef struct Token {
struct Token *next;
const char *ptr;
size_t len;
enum {
TOK_STRING,
TOK_CMD,
} type;
struct RtCmd *cmd;
} Token;
typedef struct {
const char *str;
size_t len;
size_t pos;
Token *tokens;
} Tokenizer;
bool interp_runstring(const char *string, size_t len, InterpResult **res);
#endif // TB_INTERP_H_