Created
March 7, 2014 08:30
-
-
Save Panya/9407621 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/lexer.js b/lib/lexer.js | |
index a9e016a..01a14a1 100644 | |
--- a/lib/lexer.js | |
+++ b/lib/lexer.js | |
@@ -486,14 +486,14 @@ Lexer.prototype = { | |
}, | |
/** | |
- * '@extends' ([^{\n]+) | |
+ * '@extends' | |
*/ | |
extends: function() { | |
var captures; | |
- if (captures = /^@extends?[ \t]*([^\/{\n;]+)/.exec(this.str)) { | |
+ if (captures = /^@extends?[ \t]*/.exec(this.str)) { | |
this.skip(captures); | |
- return new Token('extend', captures[1].trim()); | |
+ return new Token('extend'); | |
} | |
}, | |
diff --git a/lib/parser.js b/lib/parser.js | |
index 599b09f..42c15c2 100644 | |
--- a/lib/parser.js | |
+++ b/lib/parser.js | |
@@ -887,11 +887,8 @@ Parser.prototype = { | |
*/ | |
extend: function(){ | |
- var val = this.expect('extend').val | |
- , arr = this.selectorParts(); | |
- | |
- arr.unshift(new nodes.Literal(val)); | |
- | |
+ this.expect('extend'); | |
+ var arr = this.selectorParts(); | |
return new nodes.Extend(new nodes.Selector(arr)); | |
}, | |
@@ -1271,13 +1268,6 @@ Parser.prototype = { | |
// Push the selector | |
if (isRoot && scope) arr.unshift(new nodes.Literal(scope + ' ')); | |
- | |
- arr.forEach(function(part) { | |
- if (part.val === '.') { | |
- part.val = '.' + this.prefix; | |
- } | |
- }, this); | |
- | |
if (arr.length) group.push(new nodes.Selector(arr)); | |
} while (this.accept(',') || this.accept('newline')); | |
@@ -1306,6 +1296,9 @@ Parser.prototype = { | |
this.expect('}'); | |
arr.push(expr); | |
break; | |
+ case this.prefix && '.': | |
+ arr.push(new nodes.Literal(tok.val + this.prefix)); | |
+ break; | |
case 'comment': | |
arr.push(new nodes.Literal(tok.val.str)); | |
break; | |
diff --git a/lib/visitor/normalizer.js b/lib/visitor/normalizer.js | |
index c7ce62b..2f58633 100644 | |
--- a/lib/visitor/normalizer.js | |
+++ b/lib/visitor/normalizer.js | |
@@ -34,7 +34,6 @@ var Normalizer = module.exports = function Normalizer(root, options) { | |
this.stack = []; | |
this.extends = {}; | |
this.map = {}; | |
- this.prefix = options.prefix || ''; | |
}; | |
/** | |
@@ -130,7 +129,6 @@ Normalizer.prototype.visitGroup = function(group){ | |
// map for extension lookup | |
selectors.forEach(function(selector){ | |
- selector = selector.replace(this.prefix, ''); | |
map[selector] = map[selector] || []; | |
map[selector].push(group); | |
}, this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment