Files
my-os-project2/user/tb/interp.h

35 lines
553 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;
char *str;
enum {
TOK_STRING,
TOK_CMD,
TOK_MISC,
} type;
bool (*cmd)(struct Token *);
} Token;
typedef struct {
char *str;
Token *tokens;
} Tokenizer;
bool interp_runstring(char *string, InterpResult **res, bool logcmds, bool interactive);
#endif // TB_INTERP_H_