Skip to content

Commit a9c6f1b

Browse files
committed
Merge pull request #40 from nschonni/fix-#38-CSS2-system-colors
Add CSS2 system colors #38
2 parents c33c670 + 126c692 commit a9c6f1b

File tree

8 files changed

+241
-45
lines changed

8 files changed

+241
-45
lines changed

build/node-parserlib.js

+47-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 16-November-2012 11:43:35 */
24+
/* Version v@VERSION@, Build time: 19-November-2012 08:31:03 */
2525
var parserlib = {};
2626
(function(){
2727

@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931931
THE SOFTWARE.
932932
933933
*/
934-
/* Version v@VERSION@, Build time: 16-November-2012 11:43:35 */
934+
/* Version v@VERSION@, Build time: 19-November-2012 08:31:03 */
935935
(function(){
936936
var EventTarget = parserlib.util.EventTarget,
937937
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -1080,7 +1080,36 @@ var Colors = {
10801080
white :"#ffffff",
10811081
whitesmoke :"#f5f5f5",
10821082
yellow :"#ffff00",
1083-
yellowgreen :"#9acd32"
1083+
yellowgreen :"#9acd32",
1084+
//CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system
1085+
activeBorder :"Active window border.",
1086+
activecaption :"Active window caption.",
1087+
appworkspace :"Background color of multiple document interface.",
1088+
background :"Desktop background.",
1089+
buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
1090+
buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
1091+
buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
1092+
buttontext :"Text on push buttons.",
1093+
captiontext :"Text in caption, size box, and scrollbar arrow box.",
1094+
graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
1095+
highlight :"Item(s) selected in a control.",
1096+
highlighttext :"Text of item(s) selected in a control.",
1097+
inactiveborder :"Inactive window border.",
1098+
inactivecaption :"Inactive window caption.",
1099+
inactivecaptiontext :"Color of text in an inactive caption.",
1100+
infobackground :"Background color for tooltip controls.",
1101+
infotext :"Text color for tooltip controls.",
1102+
menu :"Menu background.",
1103+
menutext :"Text in menus.",
1104+
scrollbar :"Scroll bar gray area.",
1105+
threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1106+
threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1107+
threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1108+
threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1109+
threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1110+
window :"Window background.",
1111+
windowframe :"Window frame.",
1112+
windowtext :"Text in windows."
10841113
};
10851114
/*global SyntaxUnit, Parser*/
10861115
/**
@@ -1908,18 +1937,21 @@ Parser.prototype = function(){
19081937
});
19091938
},
19101939

1911-
_operator: function(){
1940+
_operator: function(inFunction){
19121941

19131942
/*
1914-
* operator
1943+
* operator (outside function)
19151944
* : '/' S* | ',' S* | /( empty )/
1945+
* operator (inside function)
1946+
* : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/
19161947
* ;
19171948
*/
19181949

19191950
var tokenStream = this._tokenStream,
19201951
token = null;
19211952

1922-
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA])){
1953+
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||
1954+
(inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){
19231955
token = tokenStream.token();
19241956
this._readWhitespace();
19251957
}
@@ -2706,7 +2738,7 @@ Parser.prototype = function(){
27062738
return result;
27072739
},
27082740

2709-
_expr: function(){
2741+
_expr: function(inFunction){
27102742
/*
27112743
* expr
27122744
* : term [ operator term ]*
@@ -2725,8 +2757,8 @@ Parser.prototype = function(){
27252757
values.push(value);
27262758

27272759
do {
2728-
operator = this._operator();
2729-
2760+
operator = this._operator(inFunction);
2761+
27302762
//if there's an operator, keep building up the value parts
27312763
if (operator){
27322764
values.push(operator);
@@ -2862,7 +2894,7 @@ Parser.prototype = function(){
28622894
if (tokenStream.match(Tokens.FUNCTION)){
28632895
functionText = tokenStream.token().value;
28642896
this._readWhitespace();
2865-
expr = this._expr();
2897+
expr = this._expr(true);
28662898
functionText += expr;
28672899

28682900
//START: Horrible hack in case it's an IE filter
@@ -6061,7 +6093,11 @@ var ValidationTypes = {
60616093
},
60626094

60636095
"<length>": function(part){
6064-
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
6096+
if (part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){
6097+
return true;
6098+
}else{
6099+
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
6100+
}
60656101
},
60666102

60676103
"<color>": function(part){

build/npm/lib/node-parserlib.js

+47-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 16-November-2012 11:43:35 */
24+
/* Version v@VERSION@, Build time: 19-November-2012 08:31:03 */
2525
var parserlib = {};
2626
(function(){
2727

@@ -931,7 +931,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
931931
THE SOFTWARE.
932932
933933
*/
934-
/* Version v@VERSION@, Build time: 16-November-2012 11:43:35 */
934+
/* Version v@VERSION@, Build time: 19-November-2012 08:31:03 */
935935
(function(){
936936
var EventTarget = parserlib.util.EventTarget,
937937
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -1080,7 +1080,36 @@ var Colors = {
10801080
white :"#ffffff",
10811081
whitesmoke :"#f5f5f5",
10821082
yellow :"#ffff00",
1083-
yellowgreen :"#9acd32"
1083+
yellowgreen :"#9acd32",
1084+
//CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system
1085+
activeBorder :"Active window border.",
1086+
activecaption :"Active window caption.",
1087+
appworkspace :"Background color of multiple document interface.",
1088+
background :"Desktop background.",
1089+
buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
1090+
buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
1091+
buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
1092+
buttontext :"Text on push buttons.",
1093+
captiontext :"Text in caption, size box, and scrollbar arrow box.",
1094+
graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
1095+
highlight :"Item(s) selected in a control.",
1096+
highlighttext :"Text of item(s) selected in a control.",
1097+
inactiveborder :"Inactive window border.",
1098+
inactivecaption :"Inactive window caption.",
1099+
inactivecaptiontext :"Color of text in an inactive caption.",
1100+
infobackground :"Background color for tooltip controls.",
1101+
infotext :"Text color for tooltip controls.",
1102+
menu :"Menu background.",
1103+
menutext :"Text in menus.",
1104+
scrollbar :"Scroll bar gray area.",
1105+
threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1106+
threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1107+
threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1108+
threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1109+
threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
1110+
window :"Window background.",
1111+
windowframe :"Window frame.",
1112+
windowtext :"Text in windows."
10841113
};
10851114
/*global SyntaxUnit, Parser*/
10861115
/**
@@ -1908,18 +1937,21 @@ Parser.prototype = function(){
19081937
});
19091938
},
19101939

1911-
_operator: function(){
1940+
_operator: function(inFunction){
19121941

19131942
/*
1914-
* operator
1943+
* operator (outside function)
19151944
* : '/' S* | ',' S* | /( empty )/
1945+
* operator (inside function)
1946+
* : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/
19161947
* ;
19171948
*/
19181949

19191950
var tokenStream = this._tokenStream,
19201951
token = null;
19211952

1922-
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA])){
1953+
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||
1954+
(inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){
19231955
token = tokenStream.token();
19241956
this._readWhitespace();
19251957
}
@@ -2706,7 +2738,7 @@ Parser.prototype = function(){
27062738
return result;
27072739
},
27082740

2709-
_expr: function(){
2741+
_expr: function(inFunction){
27102742
/*
27112743
* expr
27122744
* : term [ operator term ]*
@@ -2725,8 +2757,8 @@ Parser.prototype = function(){
27252757
values.push(value);
27262758

27272759
do {
2728-
operator = this._operator();
2729-
2760+
operator = this._operator(inFunction);
2761+
27302762
//if there's an operator, keep building up the value parts
27312763
if (operator){
27322764
values.push(operator);
@@ -2862,7 +2894,7 @@ Parser.prototype = function(){
28622894
if (tokenStream.match(Tokens.FUNCTION)){
28632895
functionText = tokenStream.token().value;
28642896
this._readWhitespace();
2865-
expr = this._expr();
2897+
expr = this._expr(true);
28662898
functionText += expr;
28672899

28682900
//START: Horrible hack in case it's an IE filter
@@ -6061,7 +6093,11 @@ var ValidationTypes = {
60616093
},
60626094

60636095
"<length>": function(part){
6064-
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
6096+
if (part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){
6097+
return true;
6098+
}else{
6099+
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
6100+
}
60656101
},
60666102

60676103
"<color>": function(part){

build/parserlib-core.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 16-November-2012 11:43:35 */
24+
/* Version v@VERSION@, Build time: 19-November-2012 08:31:03 */
2525
var parserlib = {};
2626
(function(){
2727

build/parserlib-css.js

+46-10
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
THE SOFTWARE.
2222
2323
*/
24-
/* Version v@VERSION@, Build time: 16-November-2012 11:43:35 */
24+
/* Version v@VERSION@, Build time: 19-November-2012 08:31:03 */
2525
(function(){
2626
var EventTarget = parserlib.util.EventTarget,
2727
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -170,7 +170,36 @@ var Colors = {
170170
white :"#ffffff",
171171
whitesmoke :"#f5f5f5",
172172
yellow :"#ffff00",
173-
yellowgreen :"#9acd32"
173+
yellowgreen :"#9acd32",
174+
//CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system
175+
activeBorder :"Active window border.",
176+
activecaption :"Active window caption.",
177+
appworkspace :"Background color of multiple document interface.",
178+
background :"Desktop background.",
179+
buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.",
180+
buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
181+
buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.",
182+
buttontext :"Text on push buttons.",
183+
captiontext :"Text in caption, size box, and scrollbar arrow box.",
184+
graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.",
185+
highlight :"Item(s) selected in a control.",
186+
highlighttext :"Text of item(s) selected in a control.",
187+
inactiveborder :"Inactive window border.",
188+
inactivecaption :"Inactive window caption.",
189+
inactivecaptiontext :"Color of text in an inactive caption.",
190+
infobackground :"Background color for tooltip controls.",
191+
infotext :"Text color for tooltip controls.",
192+
menu :"Menu background.",
193+
menutext :"Text in menus.",
194+
scrollbar :"Scroll bar gray area.",
195+
threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
196+
threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
197+
threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
198+
threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
199+
threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.",
200+
window :"Window background.",
201+
windowframe :"Window frame.",
202+
windowtext :"Text in windows."
174203
};
175204
/*global SyntaxUnit, Parser*/
176205
/**
@@ -998,18 +1027,21 @@ Parser.prototype = function(){
9981027
});
9991028
},
10001029

1001-
_operator: function(){
1030+
_operator: function(inFunction){
10021031

10031032
/*
1004-
* operator
1033+
* operator (outside function)
10051034
* : '/' S* | ',' S* | /( empty )/
1035+
* operator (inside function)
1036+
* : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/
10061037
* ;
10071038
*/
10081039

10091040
var tokenStream = this._tokenStream,
10101041
token = null;
10111042

1012-
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA])){
1043+
if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) ||
1044+
(inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){
10131045
token = tokenStream.token();
10141046
this._readWhitespace();
10151047
}
@@ -1796,7 +1828,7 @@ Parser.prototype = function(){
17961828
return result;
17971829
},
17981830

1799-
_expr: function(){
1831+
_expr: function(inFunction){
18001832
/*
18011833
* expr
18021834
* : term [ operator term ]*
@@ -1815,8 +1847,8 @@ Parser.prototype = function(){
18151847
values.push(value);
18161848

18171849
do {
1818-
operator = this._operator();
1819-
1850+
operator = this._operator(inFunction);
1851+
18201852
//if there's an operator, keep building up the value parts
18211853
if (operator){
18221854
values.push(operator);
@@ -1952,7 +1984,7 @@ Parser.prototype = function(){
19521984
if (tokenStream.match(Tokens.FUNCTION)){
19531985
functionText = tokenStream.token().value;
19541986
this._readWhitespace();
1955-
expr = this._expr();
1987+
expr = this._expr(true);
19561988
functionText += expr;
19571989

19581990
//START: Horrible hack in case it's an IE filter
@@ -5151,7 +5183,11 @@ var ValidationTypes = {
51515183
},
51525184

51535185
"<length>": function(part){
5154-
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
5186+
if (part.type == "function" && /^(?:\-(?:ms|moz|o|webkit)\-)?calc/i.test(part)){
5187+
return true;
5188+
}else{
5189+
return part.type == "length" || part.type == "number" || part.type == "integer" || part == "0";
5190+
}
51555191
},
51565192

51575193
"<color>": function(part){

0 commit comments

Comments
 (0)