1 | #ifndef SASS_EVAL_H |
---|---|
2 | #define SASS_EVAL_H |
3 | |
4 | // sass.hpp must go before all system headers to get the |
5 | // __EXTENSIONS__ fix on Solaris. |
6 | #include "sass.hpp" |
7 | #include "ast.hpp" |
8 | |
9 | #include "context.hpp" |
10 | #include "listize.hpp" |
11 | #include "operation.hpp" |
12 | #include "environment.hpp" |
13 | |
14 | namespace Sass { |
15 | |
16 | class Expand; |
17 | class Context; |
18 | |
19 | class Eval : public Operation_CRTP<Expression*, Eval> { |
20 | |
21 | public: |
22 | Expand& exp; |
23 | Context& ctx; |
24 | Backtraces& traces; |
25 | Eval(Expand& exp); |
26 | ~Eval(); |
27 | |
28 | bool force; |
29 | bool is_in_comment; |
30 | bool is_in_selector_schema; |
31 | |
32 | Boolean_Obj bool_true; |
33 | Boolean_Obj bool_false; |
34 | |
35 | Env* environment(); |
36 | EnvStack& env_stack(); |
37 | const sass::string cwd(); |
38 | CalleeStack& callee_stack(); |
39 | struct Sass_Inspect_Options& options(); |
40 | struct Sass_Compiler* compiler(); |
41 | |
42 | // for evaluating function bodies |
43 | Expression* operator()(Block*); |
44 | Expression* operator()(Assignment*); |
45 | Expression* operator()(If*); |
46 | Expression* operator()(ForRule*); |
47 | Expression* operator()(EachRule*); |
48 | Expression* operator()(WhileRule*); |
49 | Expression* operator()(Return*); |
50 | Expression* operator()(WarningRule*); |
51 | Expression* operator()(ErrorRule*); |
52 | Expression* operator()(DebugRule*); |
53 | |
54 | Expression* operator()(List*); |
55 | Expression* operator()(Map*); |
56 | Expression* operator()(Binary_Expression*); |
57 | Expression* operator()(Unary_Expression*); |
58 | Expression* operator()(Function_Call*); |
59 | Expression* operator()(Variable*); |
60 | Expression* operator()(Number*); |
61 | Expression* operator()(Color_RGBA*); |
62 | Expression* operator()(Color_HSLA*); |
63 | Expression* operator()(Boolean*); |
64 | Expression* operator()(String_Schema*); |
65 | Expression* operator()(String_Quoted*); |
66 | Expression* operator()(String_Constant*); |
67 | Media_Query* operator()(Media_Query*); |
68 | Expression* operator()(Media_Query_Expression*); |
69 | Expression* operator()(At_Root_Query*); |
70 | Expression* operator()(SupportsOperation*); |
71 | Expression* operator()(SupportsNegation*); |
72 | Expression* operator()(SupportsDeclaration*); |
73 | Expression* operator()(Supports_Interpolation*); |
74 | Expression* operator()(Null*); |
75 | Expression* operator()(Argument*); |
76 | Expression* operator()(Arguments*); |
77 | Expression* operator()(Comment*); |
78 | |
79 | // these will return selectors |
80 | SelectorList* operator()(SelectorList*); |
81 | SelectorList* operator()(ComplexSelector*); |
82 | CompoundSelector* operator()(CompoundSelector*); |
83 | SelectorComponent* operator()(SelectorComponent*); |
84 | SimpleSelector* operator()(SimpleSelector* s); |
85 | PseudoSelector* operator()(PseudoSelector* s); |
86 | |
87 | // they don't have any specific implementation (yet) |
88 | IDSelector* operator()(IDSelector* s) { return s; }; |
89 | ClassSelector* operator()(ClassSelector* s) { return s; }; |
90 | TypeSelector* operator()(TypeSelector* s) { return s; }; |
91 | AttributeSelector* operator()(AttributeSelector* s) { return s; }; |
92 | PlaceholderSelector* operator()(PlaceholderSelector* s) { return s; }; |
93 | |
94 | // actual evaluated selectors |
95 | SelectorList* operator()(Selector_Schema*); |
96 | Expression* operator()(Parent_Reference*); |
97 | |
98 | // generic fallback |
99 | template <typename U> |
100 | Expression* fallback(U x) |
101 | { return Cast<Expression>(x); } |
102 | |
103 | private: |
104 | void interpolation(Context& ctx, sass::string& res, ExpressionObj ex, bool into_quotes, bool was_itpl = false); |
105 | |
106 | }; |
107 | |
108 | } |
109 | |
110 | #endif |
111 |