Skip to content

Commit a142000

Browse files
author
Nicholas C. Zakas
committed
Updated parser to fix validation issues (fixes #219)
1 parent bb0788a commit a142000

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

lib/parserlib.js

Lines changed: 13 additions & 6 deletions
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 v0.1.1, Build time: 4-January-2012 09:10:14 */
24+
/* Version v0.1.2, Build time: 4-January-2012 05:14:28 */
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 v0.1.1, Build time: 4-January-2012 09:10:14 */
934+
/* Version v0.1.2, Build time: 4-January-2012 05:14:28 */
935935
(function(){
936936
var EventTarget = parserlib.util.EventTarget,
937937
TokenStreamBase = parserlib.util.TokenStreamBase,
@@ -5660,7 +5660,7 @@ var Validation = {
56605660
if (literals.length) {
56615661
msg.push("one of (" + literals.join(" | ") + ")");
56625662
}
5663-
throw new ValidationError("Expected " + msg.join(" or ") + " but found '" + part + "'.", value.line, value.col);
5663+
throw new ValidationError("Expected " + (msg.join(" or ") || "end of value") + " but found '" + part + "'.", value.line, value.col);
56645664
}
56655665

56665666

@@ -5669,9 +5669,9 @@ var Validation = {
56695669
}
56705670

56715671
//for groups, make sure all items are there
5672-
if (group && group.total != types.length){
5673-
throw new ValidationError("Expected all of (" + types.join(", ") + ") but found '" + value + "'.", value.line, value.col);
5674-
}
5672+
//if (group && group.total != types.length){
5673+
// throw new ValidationError("Expected all of (" + types.join(", ") + ") but found '" + value + "'.", value.line, value.col);
5674+
//}
56755675
}
56765676

56775677
},
@@ -5916,6 +5916,7 @@ var Validation = {
59165916
"<shadow>": function(expression) {
59175917
//inset? && [ <length>{2,4} && <color>? ]
59185918
var result = false,
5919+
inset = false,
59195920
count = 0,
59205921
part;
59215922

@@ -5925,6 +5926,7 @@ var Validation = {
59255926
if (this.literal(part, "inset")){
59265927
expression.next();
59275928
part = expression.peek();
5929+
inset = true;
59285930
}
59295931

59305932
while (part && this["<length>"](part) && count < 4) {
@@ -5937,9 +5939,14 @@ var Validation = {
59375939
if (part) {
59385940
if (this["<color>"](part)) {
59395941
expression.next();
5942+
part = expression.peek();
59405943
}
59415944
}
59425945

5946+
if (part && this.literal(part, "inset") && !inset){
5947+
expression.next();
5948+
}
5949+
59435950
result = (count >= 2 && count <= 4);
59445951

59455952
}

0 commit comments

Comments
 (0)