This repository has been archived by the owner on Mar 13, 2021. It is now read-only.
forked from sass/libsass
-
Notifications
You must be signed in to change notification settings - Fork 1
/
eval.hpp
73 lines (58 loc) · 1.95 KB
/
eval.hpp
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
70
71
72
73
#define SASS_EVAL
#include <iostream>
#ifndef SASS_OPERATION
#include "operation.hpp"
#endif
#ifndef SASS_ENVIRONMENT
#include "environment.hpp"
#endif
#ifndef SASS
#include "sass.h"
#endif
namespace Sass {
using namespace std;
class Context;
typedef Environment<AST_Node*> Env;
struct Backtrace;
class Eval : public Operation_CRTP<Expression*, Eval> {
Context& ctx;
Expression* fallback_impl(AST_Node* n);
public:
Env* env;
Backtrace* backtrace;
Eval(Context&, Env*, Backtrace*);
virtual ~Eval();
Eval* with(Env* e, Backtrace* bt); // for setting the env before eval'ing an expression
using Operation<Expression*>::operator();
// for evaluating function bodies
Expression* operator()(Block*);
Expression* operator()(Assignment*);
Expression* operator()(If*);
Expression* operator()(For*);
Expression* operator()(Each*);
Expression* operator()(While*);
Expression* operator()(Return*);
Expression* operator()(Warning*);
Expression* operator()(List*);
Expression* operator()(Binary_Expression*);
Expression* operator()(Unary_Expression*);
Expression* operator()(Function_Call*);
Expression* operator()(Function_Call_Schema*);
Expression* operator()(Variable*);
Expression* operator()(Textual*);
Expression* operator()(Number*);
Expression* operator()(Boolean*);
Expression* operator()(String_Schema*);
Expression* operator()(String_Constant*);
Expression* operator()(Media_Query*);
Expression* operator()(Media_Query_Expression*);
Expression* operator()(Null*);
Expression* operator()(Argument*);
Expression* operator()(Arguments*);
template <typename U>
Expression* fallback(U x) { return fallback_impl(x); }
};
Expression* cval_to_astnode(Sass_Value v, Context& ctx, Backtrace* backtrace, string path = "", size_t line = 0);
bool eq(Expression*, Expression*, Context&);
bool lt(Expression*, Expression*, Context&);
}