Skip to content

Commit

Permalink
Added #nn support (#ef -> #efefef)
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Oct 8, 2011
1 parent 87f6767 commit 509b632
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions lib/lexer.js
Expand Up @@ -642,16 +642,36 @@ Lexer.prototype = {
},

/**
* #rrggbbaa | #rrggbb | #rgba | #rgb
* #rrggbbaa | #rrggbb | #rgba | #rgb | #nn | #n
*/

color: function() {
return this.rrggbbaa()
|| this.rrggbb()
|| this.rgba()
|| this.rgb()
return this.rrggbbaa()
|| this.rrggbb()
|| this.rgba()
|| this.rgb()
|| this.nn()
// || this.n()
},

/**
* #nn
*/

nn: function() {
var captures;
if (captures = /^#([a-fA-F0-9]{2}) */.exec(this.str)) {
this.skip(captures);
var n = captures[1]
, r = parseInt(n, 16)
, g = parseInt(n, 16)
, b = parseInt(n, 16)
, color = new nodes.RGBA(r, g, b, 1);
color.raw = captures[0];
return new Token('color', color);
}
},

/**
* #rgb
*/
Expand Down

0 comments on commit 509b632

Please sign in to comment.