-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheval.h
More file actions
69 lines (59 loc) · 1.58 KB
/
eval.h
File metadata and controls
69 lines (59 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright (c) 2024 Fabian Stiewitz <fabian (at) stiewitz.pw>
// Licensed under the EUPL-1.2
#ifndef SMOLBASIC55_EVAL_H
#define SMOLBASIC55_EVAL_H
#include <map>
#include <vector>
#include <optional>
#include <string>
#include <array>
#include <set>
#include <deque>
#include "smolmath.h"
#define ASSERT(X) if(!(X)) throw std::runtime_error(#X)
enum eval_ret {
NUMBERC,
NUMBERS,
NUMBERI,
NUMBERL,
NUMBERF,
NUMBERD,
STRING,
NUMBERP,
};
eval_ret eval_ret_from_suffix(char c);
eval_ret eval_ret_from_comma(char c);
enum env_t {
PRINT, OTHER
};
enum eval_cmp_op {
LT,
LE,
EQ,
NE,
GE,
GT
};
extern env_t env;
extern bool pval;
extern bool skip_val;
extern std::map<std::string, std::pair<long, long>> var_dims;
extern std::map<long, std::string> string_map;
extern std::vector<std::pair<double, std::string>> data_items;
extern std::map<std::string, long> local_variables;
extern std::optional<std::string> current_def;
extern std::map<std::string, std::array<char, 9>> defns;
extern env_t env;
extern long string_ix;
extern std::map<std::string, long> string_buf;
extern std::map<std::string_view, eval_ret> known_funcs;
extern std::set<std::string_view> promoting_funcs;
extern long option_base;
extern long tmp_labels;
extern long line_no;
extern std::deque<std::tuple<exp_t *, std::string, std::string, long, long>> for_stack;
extern std::vector<std::pair<long, long>> for_blocks;
void smolmath_log_od(struct exp_t *root);
void eval_args(struct exp_t *exp);
std::optional<std::pair<long, long>> line_in_for(long l);
#endif //SMOLBASIC55_EVAL_H