Sha256: 8ea152a8777c5fd7a166b72f6b0a751f4acefdafd44df5eb2161f67395e537ef

Contents?: true

Size: 1010 Bytes

Versions: 4

Compression:

Stored size: 1010 Bytes

Contents

#include <cmath>
#include <sstream>
#include <iomanip>
#include <iostream>

#include "ast.hpp"
#include "inspect.hpp"
#include "context.hpp"
#include "to_string.hpp"

namespace Sass {

  To_String::To_String(Context* ctx, bool in_declaration)
  : ctx(ctx), in_declaration(in_declaration) { }
  To_String::~To_String() { }

  inline std::string To_String::fallback_impl(AST_Node* n)
  {
    Emitter emitter(ctx);
    Inspect i(emitter);
    i.in_declaration = in_declaration;
    if (n) n->perform(&i);
    return i.get_buffer();
  }

  inline std::string To_String::operator()(String_Schema* s)
  {
    std::string acc("");
    for (size_t i = 0, L = s->length(); i < L; ++i) {
      acc += s->elements()[i]->perform(this);
    }
    return acc;
  }

  inline std::string To_String::operator()(String_Quoted* s)
  {
    return s->value();
  }

  inline std::string To_String::operator()(String_Constant* s)
  {
    return s->value();
  }

  inline std::string To_String::operator()(Null* n)
  { return ""; }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sassc-1.8.1 ext/libsass/src/to_string.cpp
sassc-1.8.0 ext/libsass/src/to_string.cpp
sassc-1.8.0.pre2 ext/libsass/src/to_string.cpp
sassc-1.8.0.pre1 ext/libsass/src/to_string.cpp