Commit f5290379 by Aaron Leung

Minor tweaks.

parent bfb7afa2
......@@ -109,8 +109,8 @@ namespace Sass {
}
}
void parse_scss(bool definition = false);
Node parse_import(bool definition = false);
void parse_scss();
Node parse_import();
Node parse_include();
Node parse_mixin_definition();
Node parse_mixin_parameters();
......
......@@ -34,6 +34,10 @@ namespace Sass {
n[1] = eval(n[1], context.environment);
}
} break;
case Node::expansion: {
} break;
}
}
}
......
......@@ -5,7 +5,7 @@
namespace Sass {
using namespace std;
void Document::parse_scss(bool definition)
void Document::parse_scss()
{
lex<optional_spaces>();
while(*position) {
......@@ -13,13 +13,11 @@ namespace Sass {
root << Node(line_number, Node::comment, lexed);
}
else if (peek< import >(position)) {
root += parse_import(definition);
root += parse_import();
lex< exactly<';'> >();
}
else if (peek< mixin >(position)) {
// TO DO: check to see if we're already inside a definition in order
// to disallow definitions that are sneakily nested via imports.
if (!definition) context.pending.push_back(parse_mixin_definition());
context.pending.push_back(parse_mixin_definition());
}
else if (peek< include >(position)) {
Node call(parse_mixin_call());
......@@ -28,26 +26,21 @@ namespace Sass {
root.has_rulesets |= call.has_rulesets;
root.has_propsets |= call.has_propsets;
lex< exactly<';'> >();
if (!definition) context.pending.push_back(call);
context.pending.push_back(call);
}
else if (peek< variable >(position)) {
Node assn(parse_assignment());
lex< exactly<';'> >();
if (!definition) {
context.pending.push_back(assn);
}
else {
root << assn;
}
}
else {
root << parse_ruleset(definition);
root << parse_ruleset();
}
lex<optional_spaces>();
}
}
Node Document::parse_import(bool definition)
Node Document::parse_import()
{
lex< import >();
lex< string_constant >();
......@@ -56,7 +49,7 @@ namespace Sass {
const char* curr_path_end = folders(curr_path_start);
string current_path(curr_path_start, curr_path_end - curr_path_start);
Document importee(current_path + import_path, context);
importee.parse_scss(definition);
importee.parse_scss();
return importee.root;
}
......@@ -117,7 +110,7 @@ namespace Sass {
lex< identifier >();
Node name(line_number, Node::identifier, lexed);
Node args(parse_mixin_arguments());
Node call(line_number, Node::mixin_expansion, 2);
Node call(line_number, Node::expansion, 2);
call << name << args;
return call;
}
......@@ -325,6 +318,7 @@ namespace Sass {
semicolon = true;
}
else if (peek< import >(position)) {
// TO DO: disallow imports inside of definitions
Node imported_tree(parse_import());
for (int i = 0; i < imported_tree.size(); ++i) {
if (imported_tree[i].type == Node::comment ||
......
......@@ -213,8 +213,8 @@ namespace Sass {
return result;
} break;
case mixin_expansion: {
string result("MIXIN: ");
case expansion: {
string result("MIXIN CALL: ");
return result;
} break;
......@@ -325,7 +325,7 @@ namespace Sass {
if (stm_type == comment || stm_type == rule) {
block[i].emit_nested_css(buf, depth+1); // NEED OVERLOADED VERSION FOR COMMENTS AND RULES
}
else if (stm_type == mixin_expansion) {
else if (stm_type == expansion) {
buf << endl << string(2*(depth+1), ' ') << block[i].to_string(""); // TEMPORARY
for (int j = 0; j < block[i].size(); ++j) {
block[i][j].emit_nested_css(buf, depth+1);
......
......@@ -64,7 +64,7 @@ namespace Sass {
mixin,
parameters,
mixin_expansion,
expansion,
arguments,
variable,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment