Merge branch 'missing-bracket'

This commit is contained in:
Tom MacWright 2013-03-11 16:32:48 -04:00
commit 3382bfa29f
4 changed files with 35 additions and 1 deletions

View File

@ -575,7 +575,12 @@ carto.Parser = function Parser(env) {
$(this.entities.dimension) ||
$(this.entities.keyword) ||
$(this.entities.field))) {
if (! $(']')) return;
if (! $(']')) {
throw makeError({
message: 'Missing closing ] of filter.',
index: memo - 1
});
}
if (!key.is) key = new tree.Field(key);
return new tree.Filter(key, op, val, memo, env.filename);
}

View File

@ -0,0 +1,14 @@
{
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Stylesheet": [
"missing_close.mss"
],
"Layer": [{
"name": "world",
"srs": "+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0.0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs +over",
"Datasource": {
"file": "http://tilemill-data.s3.amazonaws.com/test_data/shape_demo.zip",
"type": "shape"
}
}]
}

View File

@ -0,0 +1,4 @@
#world[natural="water"
{
polygon-fill: blue;
}

View File

@ -0,0 +1,11 @@
Error: missing_close.mss:1:5 Missing closing ] of filter.
at makeError (/Users/tmcw/src/carto/lib/carto/parser.js:131:16)
at Object.carto.Parser.parser.parsers.filter (/Users/tmcw/src/carto/lib/carto/parser.js:579:35)
at $ (/Users/tmcw/src/carto/lib/carto/parser.js:50:24)
at Object.carto.Parser.parser.parsers.selector (/Users/tmcw/src/carto/lib/carto/parser.js:523:30)
at $ (/Users/tmcw/src/carto/lib/carto/parser.js:50:24)
at Object.carto.Parser.parser.parsers.ruleset (/Users/tmcw/src/carto/lib/carto/parser.js:615:28)
at $ (/Users/tmcw/src/carto/lib/carto/parser.js:50:24)
at Object.carto.Parser.parser.parsers.primary (/Users/tmcw/src/carto/lib/carto/parser.js:297:48)
at $ (/Users/tmcw/src/carto/lib/carto/parser.js:50:24)
at Object.carto.Parser.parser.parse (/Users/tmcw/src/carto/lib/carto/parser.js:227:41)