forked from sass/node-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move AST supports into own compile units
- Loading branch information
Showing
7 changed files
with
261 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#include "sass.hpp" | ||
#include "ast.hpp" | ||
#include "context.hpp" | ||
#include "node.hpp" | ||
#include "eval.hpp" | ||
#include "extend.hpp" | ||
#include "emitter.hpp" | ||
#include "color_maps.hpp" | ||
#include "ast_fwd_decl.hpp" | ||
#include <set> | ||
#include <iomanip> | ||
#include <iostream> | ||
#include <algorithm> | ||
#include <functional> | ||
#include <cctype> | ||
#include <locale> | ||
|
||
#include "ast_values.hpp" | ||
|
||
namespace Sass { | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
Supports_Block::Supports_Block(ParserState pstate, Supports_Condition_Obj condition, Block_Obj block) | ||
: Has_Block(pstate, block), condition_(condition) | ||
{ statement_type(SUPPORTS); } | ||
Supports_Block::Supports_Block(const Supports_Block* ptr) | ||
: Has_Block(ptr), condition_(ptr->condition_) | ||
{ statement_type(SUPPORTS); } | ||
bool Supports_Block::bubbles() { return true; } | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
Supports_Operator::Supports_Operator(ParserState pstate, Supports_Condition_Obj l, Supports_Condition_Obj r, Operand o) | ||
: Supports_Condition(pstate), left_(l), right_(r), operand_(o) | ||
{ } | ||
Supports_Operator::Supports_Operator(const Supports_Operator* ptr) | ||
: Supports_Condition(ptr), | ||
left_(ptr->left_), | ||
right_(ptr->right_), | ||
operand_(ptr->operand_) | ||
{ } | ||
|
||
bool Supports_Operator::needs_parens(Supports_Condition_Obj cond) const | ||
{ | ||
if (Supports_Operator_Obj op = Cast<Supports_Operator>(cond)) { | ||
return op->operand() != operand(); | ||
} | ||
return Cast<Supports_Negation>(cond) != NULL; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
Supports_Negation::Supports_Negation(ParserState pstate, Supports_Condition_Obj c) | ||
: Supports_Condition(pstate), condition_(c) | ||
{ } | ||
Supports_Negation::Supports_Negation(const Supports_Negation* ptr) | ||
: Supports_Condition(ptr), condition_(ptr->condition_) | ||
{ } | ||
|
||
bool Supports_Negation::needs_parens(Supports_Condition_Obj cond) const | ||
{ | ||
return Cast<Supports_Negation>(cond) || | ||
Cast<Supports_Operator>(cond); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
Supports_Declaration::Supports_Declaration(ParserState pstate, Expression_Obj f, Expression_Obj v) | ||
: Supports_Condition(pstate), feature_(f), value_(v) | ||
{ } | ||
Supports_Declaration::Supports_Declaration(const Supports_Declaration* ptr) | ||
: Supports_Condition(ptr), | ||
feature_(ptr->feature_), | ||
value_(ptr->value_) | ||
{ } | ||
|
||
bool Supports_Declaration::needs_parens(Supports_Condition_Obj cond) const | ||
{ | ||
return false; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
Supports_Interpolation::Supports_Interpolation(ParserState pstate, Expression_Obj v) | ||
: Supports_Condition(pstate), value_(v) | ||
{ } | ||
Supports_Interpolation::Supports_Interpolation(const Supports_Interpolation* ptr) | ||
: Supports_Condition(ptr), | ||
value_(ptr->value_) | ||
{ } | ||
|
||
bool Supports_Interpolation::needs_parens(Supports_Condition_Obj cond) const | ||
{ | ||
return false; | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
IMPLEMENT_AST_OPERATORS(Supports_Block); | ||
IMPLEMENT_AST_OPERATORS(Supports_Condition); | ||
IMPLEMENT_AST_OPERATORS(Supports_Operator); | ||
IMPLEMENT_AST_OPERATORS(Supports_Negation); | ||
IMPLEMENT_AST_OPERATORS(Supports_Declaration); | ||
IMPLEMENT_AST_OPERATORS(Supports_Interpolation); | ||
|
||
///////////////////////////////////////////////////////////////////////// | ||
///////////////////////////////////////////////////////////////////////// | ||
|
||
} |
Oops, something went wrong.