CSS-Sass
view release on metacpan or search on metacpan
libsass/inspect.cpp view on Meta::CPAN
#include "inspect.hpp"
#include "ast.hpp"
#include "context.hpp"
#include "utf8/checked.h"
#include <cmath>
#include <string>
#include <iostream>
#include <iomanip>
#include <stdint.h>
#include <stdint.h>
namespace Sass {
using namespace std;
Inspect::Inspect(Emitter emi)
: Emitter(emi)
{ }
Inspect::~Inspect() { }
// statements
void Inspect::operator()(Block* block)
{
if (!block->is_root()) {
add_open_mapping(block);
append_scope_opener();
}
if (output_style() == NESTED) indentation += block->tabs();
for (size_t i = 0, L = block->length(); i < L; ++i) {
(*block)[i]->perform(this);
}
if (output_style() == NESTED) indentation -= block->tabs();
if (!block->is_root()) {
append_scope_closer();
add_close_mapping(block);
}
}
void Inspect::operator()(Ruleset* ruleset)
{
ruleset->selector()->perform(this);
ruleset->block()->perform(this);
}
void Inspect::operator()(Keyframe_Rule* rule)
{
if (rule->selector()) rule->selector()->perform(this);
if (rule->block()) rule->block()->perform(this);
}
void Inspect::operator()(Propset* propset)
{
propset->property_fragment()->perform(this);
append_colon_separator();
propset->block()->perform(this);
}
void Inspect::operator()(Bubble* bubble)
{
append_indentation();
append_token("::BUBBLE", bubble);
append_scope_opener();
bubble->node()->perform(this);
append_scope_closer();
}
void Inspect::operator()(Media_Block* media_block)
{
append_indentation();
append_token("@media", media_block);
append_mandatory_space();
in_media_block = true;
media_block->media_queries()->perform(this);
in_media_block = false;
media_block->block()->perform(this);
}
void Inspect::operator()(Feature_Block* feature_block)
{
append_indentation();
append_token("@supports", feature_block);
append_mandatory_space();
feature_block->feature_queries()->perform(this);
feature_block->block()->perform(this);
}
void Inspect::operator()(At_Root_Block* at_root_block)
{
append_indentation();
append_token("@at-root ", at_root_block);
append_mandatory_space();
if(at_root_block->expression()) at_root_block->expression()->perform(this);
at_root_block->block()->perform(this);
}
void Inspect::operator()(At_Rule* at_rule)
{
append_indentation();
append_token(at_rule->keyword(), at_rule);
if (at_rule->selector()) {
append_mandatory_space();
in_wrapped = true;
at_rule->selector()->perform(this);
in_wrapped = false;
}
if (at_rule->block()) {
at_rule->block()->perform(this);
}
else {
append_delimiter();
}
}
void Inspect::operator()(Declaration* dec)
{
( run in 0.526 second using v1.01-cache-2.11-cpan-71847e10f99 )