01234567891011121314151617181920212223
|
// Copyright (C) 2023, Jakob Wakeling
// All rights reserved.
#include "eval.h"
#include "exec.h"
#include "lex.h"
#include "parse.h"
#include <unistd.h>
bool Eflag, pflag;
void eval(char *src, u64 len) {
lex l = lex_init(src, len);
if (Eflag) { lex_debug(&l); return; }
for (ast *a; l.t.k != TK_EOF; ast_free(a)) {
a = parse(&l); if (!a) { return; }
if (pflag) { ast_debug(a, 0); continue; }
_ret = execute(a, STDIN_FILENO, NULL);
}
}
|