Merge branch 'missing-bracket'
This commit is contained in:
commit
3382bfa29f
@ -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);
|
||||
}
|
||||
|
14
test/errorhandling/missing_close.mml
Normal file
14
test/errorhandling/missing_close.mml
Normal 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"
|
||||
}
|
||||
}]
|
||||
}
|
4
test/errorhandling/missing_close.mss
Normal file
4
test/errorhandling/missing_close.mss
Normal file
@ -0,0 +1,4 @@
|
||||
#world[natural="water"
|
||||
{
|
||||
polygon-fill: blue;
|
||||
}
|
11
test/errorhandling/missing_close.result
Normal file
11
test/errorhandling/missing_close.result
Normal 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)
|
Loading…
Reference in New Issue
Block a user