Files
my-os-project2/user/tb/interp.h
2025-09-17 22:07:58 +02:00

39 lines
586 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,
TOK_MISC,
} 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, InterpResult **res, bool logcmds);
#endif // TB_INTERP_H_