Skip to content

Commit

Permalink
Merge pull request #910 from mgreter/feature/output-emitter
Browse files Browse the repository at this point in the history
Refactor output emitter and implement missing output styles
  • Loading branch information
mgreter committed Mar 2, 2015
2 parents f642fad + 7877cfa commit 8e74f7f
Show file tree
Hide file tree
Showing 55 changed files with 2,505 additions and 2,138 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ libsass/*
*.a
a.out
libsass.js
tester
tester.exe
build/
config.h.in*
lib/pkgconfig/

bin/*
.deps/
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ SOURCES = \
inspect.cpp \
node.cpp \
json.cpp \
output_compressed.cpp \
output_nested.cpp \
emitter.cpp \
output.cpp \
parser.cpp \
position.cpp \
prelexer.cpp \
Expand Down
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ libsass_la_SOURCES = \
inspect.cpp inspect.hpp \
node.cpp node.hpp \
json.cpp json.hpp \
output_compressed.cpp output_compressed.hpp \
output_nested.cpp output_nested.hpp \
emitter.cpp emitter.hpp \
output.cpp output.hpp \
parser.cpp parser.hpp \
prelexer.cpp prelexer.hpp \
remove_placeholders.cpp remove_placeholders.hpp \
Expand Down
25 changes: 16 additions & 9 deletions ast.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace Sass {

Compound_Selector* Simple_Selector::unify_with(Compound_Selector* rhs, Context& ctx)
{
To_String to_string;
To_String to_string(&ctx);
for (size_t i = 0, L = rhs->length(); i < L; ++i)
{ if (perform(&to_string) == (*rhs)[i]->perform(&to_string)) return rhs; }

Expand Down Expand Up @@ -183,6 +183,7 @@ namespace Sass {
return 0;
}
}
rhs->has_line_break(has_line_break());
return Simple_Selector::unify_with(rhs, ctx);
}

Expand Down Expand Up @@ -451,7 +452,7 @@ namespace Sass {
{
Complex_Selector* cpy = new (ctx.mem) Complex_Selector(*this);

if (head()) {
if (head()) {
cpy->head(head()->clone(ctx));
}

Expand All @@ -470,10 +471,11 @@ namespace Sass {



/* not used anymore - remove?
Selector_Placeholder* Selector::find_placeholder()
{
return 0;
}
}*/

void Selector_List::adjust_after_pushing(Complex_Selector* c)
{
Expand All @@ -486,6 +488,7 @@ namespace Sass {
#endif
}

/* not used anymore - remove?
Selector_Placeholder* Selector_List::find_placeholder()
{
if (has_placeholder()) {
Expand All @@ -494,17 +497,19 @@ namespace Sass {
}
}
return 0;
}
}*/

/* not used anymore - remove?
Selector_Placeholder* Complex_Selector::find_placeholder()
{
if (has_placeholder()) {
if (head() && head()->has_placeholder()) return head()->find_placeholder();
else if (tail() && tail()->has_placeholder()) return tail()->find_placeholder();
}
return 0;
}
}*/

/* not used anymore - remove?
Selector_Placeholder* Compound_Selector::find_placeholder()
{
if (has_placeholder()) {
Expand All @@ -514,12 +519,13 @@ namespace Sass {
// return this;
}
return 0;
}
}*/

/* not used anymore - remove?
Selector_Placeholder* Selector_Placeholder::find_placeholder()
{
return this;
}
}*/

vector<string> Compound_Selector::to_str_vec()
{
Expand All @@ -533,7 +539,7 @@ namespace Sass {

Compound_Selector* Compound_Selector::minus(Compound_Selector* rhs, Context& ctx)
{
To_String to_string;
To_String to_string(&ctx);
Compound_Selector* result = new (ctx.mem) Compound_Selector(pstate());

// not very efficient because it needs to preserve order
Expand Down Expand Up @@ -562,6 +568,7 @@ namespace Sass {
}
}

/* not used anymore - remove?
vector<Compound_Selector*> Complex_Selector::to_vector()
{
vector<Compound_Selector*> result;
Expand All @@ -575,7 +582,7 @@ namespace Sass {
if (h) result.push_back(h);
}
return result;
}
}*/

}

Loading

0 comments on commit 8e74f7f

Please sign in to comment.