Skip to content

Commit 899cddd

Browse files
committed
Merge pull request #199 from cscott/matchers
Use `Matcher` combinators to greatly simplify complex `ValidationTypes`
2 parents 422ae7b + c7fef82 commit 899cddd

File tree

5 files changed

+355
-293
lines changed

5 files changed

+355
-293
lines changed

src/css/Properties.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ var Properties = {
9292
"background-color" : "<color> | inherit",
9393
"background-image" : { multi: "<bg-image>", comma: true },
9494
"background-origin" : { multi: "<box>", comma: true },
95-
"background-position" : { multi: "<bg-position>", comma: true },
95+
"background-position" : "<bg-position> | inherit",
9696
"background-repeat" : { multi: "<repeat-style>", comma: true },
9797
"background-size" : { multi: "<bg-size>", comma: true },
9898
"baseline-shift" : "baseline | sub | super | <percentage> | <length>",
@@ -106,8 +106,8 @@ var Properties = {
106106
"border" : "<border-width> || <border-style> || <color>",
107107
"border-bottom" : "<border-width> || <border-style> || <color>",
108108
"border-bottom-color" : "<color> | inherit",
109-
"border-bottom-left-radius" : "<x-one-radius>",
110-
"border-bottom-right-radius" : "<x-one-radius>",
109+
"border-bottom-left-radius" : "<x-one-radius> | inherit",
110+
"border-bottom-right-radius" : "<x-one-radius> | inherit",
111111
"border-bottom-style" : "<border-style>",
112112
"border-bottom-width" : "<border-width>",
113113
"border-collapse" : "collapse | separate | inherit",
@@ -200,8 +200,8 @@ var Properties = {
200200
"border-style" : { multi: "<border-style>", max: 4 },
201201
"border-top" : "<border-width> || <border-style> || <color>",
202202
"border-top-color" : "<color> | inherit",
203-
"border-top-left-radius" : "<x-one-radius>",
204-
"border-top-right-radius" : "<x-one-radius>",
203+
"border-top-left-radius" : "<x-one-radius> | inherit",
204+
"border-top-right-radius" : "<x-one-radius> | inherit",
205205
"border-top-style" : "<border-style>",
206206
"border-top-width" : "<border-width>",
207207
"border-width" : { multi: "<border-width>", max: 4 },
@@ -422,7 +422,7 @@ var Properties = {
422422

423423
//O
424424
"object-fit" : "fill | contain | cover | none | scale-down",
425-
"object-position" : "<bg-position>",
425+
"object-position" : "<position> | inherit",
426426
"opacity" : "<number> | inherit",
427427
"order" : "<integer>",
428428
"-webkit-order" : "<integer>",

src/css/PropertyValueIterator.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,11 @@ PropertyValueIterator.prototype.restore = function(){
122122
}
123123
};
124124

125+
/**
126+
* Drops the last saved bookmark.
127+
* @return {void}
128+
* @method drop
129+
*/
130+
PropertyValueIterator.prototype.drop = function() {
131+
this._marks.pop();
132+
};

src/css/Validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var Validation = {
5454
part = expression.peek();
5555
throw new ValidationError("Expected end of value but found '" + part + "'.", part.line, part.col);
5656
} else {
57-
throw new ValidationError("Expected (" + types + ") but found '" + value + "'.", value.line, value.col);
57+
throw new ValidationError("Expected (" + ValidationTypes.describe(types) + ") but found '" + value + "'.", value.line, value.col);
5858
}
5959
} else if (expression.hasNext()) {
6060
part = expression.next();

0 commit comments

Comments
 (0)