Permalink
Browse files

[a] selector fixed

  • Loading branch information...
1 parent 1fc8f76 commit 168366012f148db921db64e5d3bcf22748aa17b7 @anotherquiz anotherquiz committed Sep 26, 2011
View
2 CHANGELOG
@@ -1,3 +1,5 @@
+1.0.1:
+ * Добавлена обработка селектора атрибута вида [att].
1.0.0:
* Добавлены CSSParser, CSSTransformer и CSSTranslator в API.
* Внутренняя переорганизация parser.ometajs.
View
2 src/cssptt.js
@@ -46,7 +46,7 @@ var ometajs = require('ometajs'),
"block":function(){var $elf=this,_fromIdx=this.input.idx,x;return (function(){this._applyWithArgs("exactly","{");x=this._many((function(){return this._apply("blockdecl")}));this._applyWithArgs("exactly","}");return this.concatContent(["block"],x)}).call(this)},
"ruleset":function(){var $elf=this,_fromIdx=this.input.idx,x,y;return (function(){x=this._many((function(){return this._apply("selector")}));y=this._apply("block");return this.concat(["ruleset"],x,[y])}).call(this)},
"combinator":function(){var $elf=this,_fromIdx=this.input.idx,x;return (function(){x=(function(){switch(this._apply('anything')){case "+":return "+";case ">":return ">";case "~":return "~";default: throw fail}}).call(this);return ["combinator",x]}).call(this)},
-"attrib":function(){var $elf=this,_fromIdx=this.input.idx,s0,x,s1,a,s2,y,s3;return (function(){this._applyWithArgs("exactly","[");s0=this._many((function(){return this._apply("sc")}));x=this._apply("ident");s1=this._many((function(){return this._apply("sc")}));a=this._apply("attrselector");s2=this._many((function(){return this._apply("sc")}));y=this._or((function(){return this._apply("ident")}),(function(){return this._apply("string")}));s3=this._many((function(){return this._apply("sc")}));this._applyWithArgs("exactly","]");return this.concat(["attrib"],s0,[x],s1,[a],s2,[y],s3)}).call(this)},
+"attrib":function(){var $elf=this,_fromIdx=this.input.idx,s0,x,s1,a,s2,y,s3,s0,x,s1;return (function(){switch(this._apply('anything')){case "[":return this._or((function(){return (function(){s0=this._many((function(){return this._apply("sc")}));x=this._apply("ident");s1=this._many((function(){return this._apply("sc")}));a=this._apply("attrselector");s2=this._many((function(){return this._apply("sc")}));y=this._or((function(){return this._apply("ident")}),(function(){return this._apply("string")}));s3=this._many((function(){return this._apply("sc")}));this._applyWithArgs("exactly","]");return this.concat(["attrib"],s0,[x],s1,[a],s2,[y],s3)}).call(this)}),(function(){return (function(){s0=this._many((function(){return this._apply("sc")}));x=this._apply("ident");s1=this._many((function(){return this._apply("sc")}));this._applyWithArgs("exactly","]");return this.concat(["attrib"],s0,[x],s1)}).call(this)}));default: throw fail}}).call(this)},
"clazz":function(){var $elf=this,_fromIdx=this.input.idx,i;return (function(){this._applyWithArgs("exactly",".");i=this._apply("ident");return ["clazz",i]}).call(this)},
"pseudoe":function(){var $elf=this,_fromIdx=this.input.idx,x;return (function(){this._applyWithArgs("exactly",":");this._applyWithArgs("exactly",":");"::";x=this._apply("ident");return ["pseudoe",x]}).call(this)},
"pseudoc":function(){var $elf=this,_fromIdx=this.input.idx,x;return (function(){this._applyWithArgs("exactly",":");x=this._or((function(){return this._apply("funktion")}),(function(){return this._apply("ident")}));return ["pseudoc",x]}).call(this)},
View
3 src/parser.ometajs
@@ -93,7 +93,8 @@ ometa CSSParser {
combinator = ('+' | '>' | '~'):x -> [#combinator, x],
- attrib = '[' sc*:s0 ident:x sc*:s1 attrselector:a sc*:s2 (ident | string):y sc*:s3 ']' -> this.concat([#attrib], s0, [x], s1, [a], s2, [y], s3),
+ attrib = '[' sc*:s0 ident:x sc*:s1 attrselector:a sc*:s2 (ident | string):y sc*:s3 ']' -> this.concat([#attrib], s0, [x], s1, [a], s2, [y], s3)
+ | '[' sc*:s0 ident:x sc*:s1 ']' -> this.concat([#attrib], s0, [x], s1),
clazz = '.' ident:i -> [#clazz, i],
View
1 test/data/test_attrib/attrib.2.css
@@ -0,0 +1 @@
+[b]
View
1 test/data/test_attrib/attrib.2.l
@@ -0,0 +1 @@
+[b]
View
2 test/data/test_attrib/attrib.2.p
@@ -0,0 +1,2 @@
+['attrib',
+ ['ident', 'b']]

0 comments on commit 1683660

Please sign in to comment.