7 #include "source_map.hpp"
8 #include "ast_fwd_decl.hpp"
16 Emitter(struct Sass_Output_Options& opt);
17 virtual ~Emitter() { }
22 const std::string& buffer(void) { return wbuf.buffer; }
23 const SourceMap smap(void) { return wbuf.smap; }
24 const OutputBuffer output(void) { return wbuf; }
25 // proxy methods for source maps
26 void add_source_index(size_t idx);
27 void set_filename(const std::string& str);
28 void add_open_mapping(const AST_Node_Ptr node);
29 void add_close_mapping(const AST_Node_Ptr node);
30 void schedule_mapping(const AST_Node_Ptr node);
31 std::string render_srcmap(Context &ctx);
32 ParserState remap(const ParserState& pstate);
35 struct Sass_Output_Options& opt;
37 size_t scheduled_space;
38 size_t scheduled_linefeed;
39 bool scheduled_delimiter;
40 AST_Node_Ptr scheduled_mapping;
43 // output strings different in comments
45 // selector list does not get linefeeds
47 // lists always get a space after delimiter
49 // nested list must not have parentheses
51 // nested lists need parentheses
56 // return buffer as std::string
57 std::string get_buffer(void);
58 // flush scheduled space/linefeed
59 Sass_Output_Style output_style(void) const;
60 // add outstanding linefeed
61 void finalize(bool final = true);
62 // flush scheduled space/linefeed
63 void flush_schedules(void);
64 // prepend some text or token to the buffer
65 void prepend_string(const std::string& text);
66 void prepend_output(const OutputBuffer& out);
67 // append some text or token to the buffer
68 void append_string(const std::string& text);
69 // append some white-space only text
70 void append_wspace(const std::string& text);
71 // append some text or token to the buffer
72 // this adds source-mappings for node start and end
73 void append_token(const std::string& text, const AST_Node_Ptr node);
75 public: // syntax sugar
76 void append_indentation();
77 void append_optional_space(void);
78 void append_mandatory_space(void);
79 void append_special_linefeed(void);
80 void append_optional_linefeed(void);
81 void append_mandatory_linefeed(void);
82 void append_scope_opener(AST_Node_Ptr node = 0);
83 void append_scope_closer(AST_Node_Ptr node = 0);
84 void append_comma_separator(void);
85 void append_colon_separator(void);
86 void append_delimiter(void);