1// sass.hpp must go before all system headers to get the
2// __EXTENSIONS__ fix on Solaris.
3#include "sass.hpp"
4#include "ast.hpp"
5
6
7namespace Sass {
8
9 /////////////////////////////////////////////////////////////////////////
10 /////////////////////////////////////////////////////////////////////////
11
12 SupportsRule::SupportsRule(SourceSpan pstate, SupportsConditionObj condition, Block_Obj block)
13 : ParentStatement(pstate, block), condition_(condition)
14 { statement_type(statement_type__: SUPPORTS); }
15 SupportsRule::SupportsRule(const SupportsRule* ptr)
16 : ParentStatement(ptr), condition_(ptr->condition_)
17 { statement_type(statement_type__: SUPPORTS); }
18 bool SupportsRule::bubbles() { return true; }
19
20 /////////////////////////////////////////////////////////////////////////
21 /////////////////////////////////////////////////////////////////////////
22
23 SupportsCondition::SupportsCondition(SourceSpan pstate)
24 : Expression(pstate)
25 { }
26
27 SupportsCondition::SupportsCondition(const SupportsCondition* ptr)
28 : Expression(ptr)
29 { }
30
31 /////////////////////////////////////////////////////////////////////////
32 /////////////////////////////////////////////////////////////////////////
33
34 SupportsOperation::SupportsOperation(SourceSpan pstate, SupportsConditionObj l, SupportsConditionObj r, Operand o)
35 : SupportsCondition(pstate), left_(l), right_(r), operand_(o)
36 { }
37 SupportsOperation::SupportsOperation(const SupportsOperation* ptr)
38 : SupportsCondition(ptr),
39 left_(ptr->left_),
40 right_(ptr->right_),
41 operand_(ptr->operand_)
42 { }
43
44 bool SupportsOperation::needs_parens(SupportsConditionObj cond) const
45 {
46 if (SupportsOperationObj op = Cast<SupportsOperation>(ptr: cond)) {
47 return op->operand() != operand();
48 }
49 return Cast<SupportsNegation>(ptr: cond) != NULL;
50 }
51
52 /////////////////////////////////////////////////////////////////////////
53 /////////////////////////////////////////////////////////////////////////
54
55 SupportsNegation::SupportsNegation(SourceSpan pstate, SupportsConditionObj c)
56 : SupportsCondition(pstate), condition_(c)
57 { }
58 SupportsNegation::SupportsNegation(const SupportsNegation* ptr)
59 : SupportsCondition(ptr), condition_(ptr->condition_)
60 { }
61
62 bool SupportsNegation::needs_parens(SupportsConditionObj cond) const
63 {
64 return Cast<SupportsNegation>(ptr: cond) ||
65 Cast<SupportsOperation>(ptr: cond);
66 }
67
68 /////////////////////////////////////////////////////////////////////////
69 /////////////////////////////////////////////////////////////////////////
70
71 SupportsDeclaration::SupportsDeclaration(SourceSpan pstate, ExpressionObj f, ExpressionObj v)
72 : SupportsCondition(pstate), feature_(f), value_(v)
73 { }
74 SupportsDeclaration::SupportsDeclaration(const SupportsDeclaration* ptr)
75 : SupportsCondition(ptr),
76 feature_(ptr->feature_),
77 value_(ptr->value_)
78 { }
79
80 bool SupportsDeclaration::needs_parens(SupportsConditionObj cond) const
81 {
82 return false;
83 }
84
85 /////////////////////////////////////////////////////////////////////////
86 /////////////////////////////////////////////////////////////////////////
87
88 Supports_Interpolation::Supports_Interpolation(SourceSpan pstate, ExpressionObj v)
89 : SupportsCondition(pstate), value_(v)
90 { }
91 Supports_Interpolation::Supports_Interpolation(const Supports_Interpolation* ptr)
92 : SupportsCondition(ptr),
93 value_(ptr->value_)
94 { }
95
96 bool Supports_Interpolation::needs_parens(SupportsConditionObj cond) const
97 {
98 return false;
99 }
100
101 /////////////////////////////////////////////////////////////////////////
102 /////////////////////////////////////////////////////////////////////////
103
104 IMPLEMENT_AST_OPERATORS(SupportsRule);
105 IMPLEMENT_AST_OPERATORS(SupportsCondition);
106 IMPLEMENT_AST_OPERATORS(SupportsOperation);
107 IMPLEMENT_AST_OPERATORS(SupportsNegation);
108 IMPLEMENT_AST_OPERATORS(SupportsDeclaration);
109 IMPLEMENT_AST_OPERATORS(Supports_Interpolation);
110
111 /////////////////////////////////////////////////////////////////////////
112 /////////////////////////////////////////////////////////////////////////
113
114}
115

source code of gtk/subprojects/libsass/src/ast_supports.cpp