ext/libsass/src/emitter.hpp in sassc-1.8.3 vs ext/libsass/src/emitter.hpp in sassc-1.8.4
- old
+ new
@@ -1,20 +1,21 @@
#ifndef SASS_EMITTER_H
#define SASS_EMITTER_H
#include <string>
+#include "sass.hpp"
#include "sass/base.h"
#include "source_map.hpp"
#include "ast_fwd_decl.hpp"
namespace Sass {
class Context;
class Emitter {
public:
- Emitter(Context* ctx);
+ Emitter(struct Sass_Output_Options& opt);
virtual ~Emitter() { }
protected:
OutputBuffer wbuf;
public:
@@ -22,21 +23,23 @@
const SourceMap smap(void) { return wbuf.smap; }
const OutputBuffer output(void) { return wbuf; }
// proxy methods for source maps
void add_source_index(size_t idx);
void set_filename(const std::string& str);
- void add_open_mapping(AST_Node* node);
- void add_close_mapping(AST_Node* node);
+ void add_open_mapping(const AST_Node* node);
+ void add_close_mapping(const AST_Node* node);
+ void schedule_mapping(const AST_Node* node);
std::string render_srcmap(Context &ctx);
ParserState remap(const ParserState& pstate);
public:
- Context* ctx;
+ struct Sass_Output_Options& opt;
size_t indentation;
size_t scheduled_space;
size_t scheduled_linefeed;
bool scheduled_delimiter;
+ const AST_Node* scheduled_mapping;
public:
// output strings different in comments
bool in_comment;
// selector list does not get linefeeds
@@ -46,20 +49,18 @@
// nested list must not have parentheses
bool in_declaration;
// nested lists need parentheses
bool in_space_array;
bool in_comma_array;
- // list separators don't get compressed in @debug
- bool in_debug;
public:
// return buffer as std::string
std::string get_buffer(void);
// flush scheduled space/linefeed
- Sass_Output_Style output_style(void);
+ Sass_Output_Style output_style(void) const;
// add outstanding linefeed
- void finalize(void);
+ void finalize(bool final = true);
// flush scheduled space/linefeed
void flush_schedules(void);
// prepend some text or token to the buffer
void prepend_string(const std::string& text);
void prepend_output(const OutputBuffer& out);
@@ -67,10 +68,10 @@
void append_string(const std::string& text);
// append some white-space only text
void append_wspace(const std::string& text);
// append some text or token to the buffer
// this adds source-mappings for node start and end
- void append_token(const std::string& text, AST_Node* node);
+ void append_token(const std::string& text, const AST_Node* node);
public: // syntax sugar
void append_indentation();
void append_optional_space(void);
void append_mandatory_space(void);