Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor output emitter and implement missing output styles #910

Merged
merged 2 commits into from
Mar 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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