@mapbox/mapbox-gl-style-spec 14.21.0 → 14.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -20762,12 +20762,15 @@ ${ JSON.stringify(filterExp, null, 2) }
20762
20762
  layers = layers.slice();
20763
20763
  const map = /* @__PURE__ */
20764
20764
  Object.create(null);
20765
- for (let i = 0; i < layers.length; i++) {
20766
- map[layers[i].id] = layers[i];
20765
+ for (const layer of layers) {
20766
+ map[layer.id] = layer;
20767
20767
  }
20768
20768
  for (let i = 0; i < layers.length; i++) {
20769
- if ('ref' in layers[i]) {
20770
- layers[i] = deref(layers[i], map[layers[i].ref]);
20769
+ const layer = layers[i];
20770
+ if (layer && 'ref' in layer) {
20771
+ const parent = map[layer.ref];
20772
+ if (parent)
20773
+ layers[i] = deref(layer, parent);
20771
20774
  }
20772
20775
  }
20773
20776
  return layers;
@@ -22962,1086 +22965,137 @@ Use an identity property function instead: ${ example }.`)];
22962
22965
  return errors.slice().sort((a, b) => a.line && b.line ? a.line - b.line : 0);
22963
22966
  }
22964
22967
 
22965
- function commonjsRequire(path) {
22966
- throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
22967
- }
22968
-
22969
- var jsonlint$1 = {};
22970
-
22971
- /* parser generated by jison 0.4.15 */
22972
-
22973
- var hasRequiredJsonlint;
22974
-
22975
- function requireJsonlint () {
22976
- if (hasRequiredJsonlint) return jsonlint$1;
22977
- hasRequiredJsonlint = 1;
22978
- (function (exports$1) {
22979
- /*
22980
- Returns a Parser object of the following structure:
22981
-
22982
- Parser: {
22983
- yy: {}
22984
- }
22985
-
22986
- Parser.prototype: {
22987
- yy: {},
22988
- trace: function(),
22989
- symbols_: {associative list: name ==> number},
22990
- terminals_: {associative list: number ==> name},
22991
- productions_: [...],
22992
- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$),
22993
- table: [...],
22994
- defaultActions: {...},
22995
- parseError: function(str, hash),
22996
- parse: function(input),
22997
-
22998
- lexer: {
22999
- EOF: 1,
23000
- parseError: function(str, hash),
23001
- setInput: function(input),
23002
- input: function(),
23003
- unput: function(str),
23004
- more: function(),
23005
- less: function(n),
23006
- pastInput: function(),
23007
- upcomingInput: function(),
23008
- showPosition: function(),
23009
- test_match: function(regex_match_array, rule_index),
23010
- next: function(),
23011
- lex: function(),
23012
- begin: function(condition),
23013
- popState: function(),
23014
- _currentRules: function(),
23015
- topState: function(),
23016
- pushState: function(condition),
23017
-
23018
- options: {
23019
- ranges: boolean (optional: true ==> token location info will include a .range[] member)
23020
- flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match)
23021
- backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code)
23022
- },
23023
-
23024
- performAction: function(yy, yy_, $avoiding_name_collisions, YY_START),
23025
- rules: [...],
23026
- conditions: {associative list: name ==> set},
23027
- }
23028
- }
23029
-
23030
-
23031
- token location info (@$, _$, etc.): {
23032
- first_line: n,
23033
- last_line: n,
23034
- first_column: n,
23035
- last_column: n,
23036
- range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based)
23037
- }
23038
-
23039
-
23040
- the parseError function receives a 'hash' object with these members for lexer and parser errors: {
23041
- text: (matched text)
23042
- token: (the produced terminal token, if any)
23043
- line: (yylineno)
23044
- }
23045
- while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: {
23046
- loc: (yylloc)
23047
- expected: (string describing the set of expected tokens)
23048
- recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error)
23049
- }
23050
- */
23051
- var parser = (function () {
23052
- var o = function (k, v, o, l) {
23053
- for (o = o || {}, l = k.length; l--; o[k[l]] = v);
23054
- return o;
23055
- }, $V0 = [
23056
- 1,
23057
- 12
23058
- ], $V1 = [
23059
- 1,
23060
- 13
23061
- ], $V2 = [
23062
- 1,
23063
- 9
23064
- ], $V3 = [
23065
- 1,
23066
- 10
23067
- ], $V4 = [
23068
- 1,
23069
- 11
23070
- ], $V5 = [
23071
- 1,
23072
- 14
23073
- ], $V6 = [
23074
- 1,
23075
- 15
23076
- ], $V7 = [
23077
- 14,
23078
- 18,
23079
- 22,
23080
- 24
23081
- ], $V8 = [
23082
- 18,
23083
- 22
23084
- ], $V9 = [
23085
- 22,
23086
- 24
23087
- ];
23088
- var parser = {
23089
- trace: function trace() {
23090
- },
23091
- yy: {},
23092
- symbols_: {
23093
- 'error': 2,
23094
- 'JSONString': 3,
23095
- 'STRING': 4,
23096
- 'JSONNumber': 5,
23097
- 'NUMBER': 6,
23098
- 'JSONNullLiteral': 7,
23099
- 'NULL': 8,
23100
- 'JSONBooleanLiteral': 9,
23101
- 'TRUE': 10,
23102
- 'FALSE': 11,
23103
- 'JSONText': 12,
23104
- 'JSONValue': 13,
23105
- 'EOF': 14,
23106
- 'JSONObject': 15,
23107
- 'JSONArray': 16,
23108
- '{': 17,
23109
- '}': 18,
23110
- 'JSONMemberList': 19,
23111
- 'JSONMember': 20,
23112
- ':': 21,
23113
- ',': 22,
23114
- '[': 23,
23115
- ']': 24,
23116
- 'JSONElementList': 25,
23117
- '$accept': 0,
23118
- '$end': 1
23119
- },
23120
- terminals_: {
23121
- 2: 'error',
23122
- 4: 'STRING',
23123
- 6: 'NUMBER',
23124
- 8: 'NULL',
23125
- 10: 'TRUE',
23126
- 11: 'FALSE',
23127
- 14: 'EOF',
23128
- 17: '{',
23129
- 18: '}',
23130
- 21: ':',
23131
- 22: ',',
23132
- 23: '[',
23133
- 24: ']'
23134
- },
23135
- productions_: [
23136
- 0,
23137
- [
23138
- 3,
23139
- 1
23140
- ],
23141
- [
23142
- 5,
23143
- 1
23144
- ],
23145
- [
23146
- 7,
23147
- 1
23148
- ],
23149
- [
23150
- 9,
23151
- 1
23152
- ],
23153
- [
23154
- 9,
23155
- 1
23156
- ],
23157
- [
23158
- 12,
23159
- 2
23160
- ],
23161
- [
23162
- 13,
23163
- 1
23164
- ],
23165
- [
23166
- 13,
23167
- 1
23168
- ],
23169
- [
23170
- 13,
23171
- 1
23172
- ],
23173
- [
23174
- 13,
23175
- 1
23176
- ],
23177
- [
23178
- 13,
23179
- 1
23180
- ],
23181
- [
23182
- 13,
23183
- 1
23184
- ],
23185
- [
23186
- 15,
23187
- 2
23188
- ],
23189
- [
23190
- 15,
23191
- 3
23192
- ],
23193
- [
23194
- 20,
23195
- 3
23196
- ],
23197
- [
23198
- 19,
23199
- 1
23200
- ],
23201
- [
23202
- 19,
23203
- 3
23204
- ],
23205
- [
23206
- 16,
23207
- 2
23208
- ],
23209
- [
23210
- 16,
23211
- 3
23212
- ],
23213
- [
23214
- 25,
23215
- 1
23216
- ],
23217
- [
23218
- 25,
23219
- 3
23220
- ]
23221
- ],
23222
- performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$) {
23223
- /* this == yyval */
23224
- var $0 = $$.length - 1;
23225
- switch (yystate) {
23226
- case 1:
23227
- // replace escaped characters with actual character
23228
- this.$ = new String(yytext.replace(/\\(\\|")/g, '$' + '1').replace(/\\n/g, '\n').replace(/\\r/g, '\r').replace(/\\t/g, '\t').replace(/\\v/g, '\x0B').replace(/\\f/g, '\f').replace(/\\b/g, '\b'));
23229
- this.$.__line__ = this._$.first_line;
23230
- break;
23231
- case 2:
23232
- this.$ = new Number(yytext);
23233
- this.$.__line__ = this._$.first_line;
23234
- break;
23235
- case 3:
23236
- this.$ = null;
23237
- break;
23238
- case 4:
23239
- this.$ = new Boolean(true);
23240
- this.$.__line__ = this._$.first_line;
23241
- break;
23242
- case 5:
23243
- this.$ = new Boolean(false);
23244
- this.$.__line__ = this._$.first_line;
23245
- break;
23246
- case 6:
23247
- return this.$ = $$[$0 - 1];
23248
- case 13:
23249
- this.$ = {};
23250
- Object.defineProperty(this.$, '__line__', {
23251
- value: this._$.first_line,
23252
- enumerable: false
23253
- });
23254
- break;
23255
- case 14:
23256
- case 19:
23257
- this.$ = $$[$0 - 1];
23258
- Object.defineProperty(this.$, '__line__', {
23259
- value: this._$.first_line,
23260
- enumerable: false
23261
- });
23262
- break;
23263
- case 15:
23264
- this.$ = [
23265
- $$[$0 - 2],
23266
- $$[$0]
23267
- ];
23268
- break;
23269
- case 16:
23270
- this.$ = {};
23271
- this.$[$$[$0][0]] = $$[$0][1];
23272
- break;
23273
- case 17:
23274
- this.$ = $$[$0 - 2];
23275
- $$[$0 - 2][$$[$0][0]] = $$[$0][1];
23276
- break;
23277
- case 18:
23278
- this.$ = [];
23279
- Object.defineProperty(this.$, '__line__', {
23280
- value: this._$.first_line,
23281
- enumerable: false
23282
- });
23283
- break;
23284
- case 20:
23285
- this.$ = [$$[$0]];
23286
- break;
23287
- case 21:
23288
- this.$ = $$[$0 - 2];
23289
- $$[$0 - 2].push($$[$0]);
23290
- break;
23291
- }
23292
- },
23293
- table: [
23294
- {
23295
- 3: 5,
23296
- 4: $V0,
23297
- 5: 6,
23298
- 6: $V1,
23299
- 7: 3,
23300
- 8: $V2,
23301
- 9: 4,
23302
- 10: $V3,
23303
- 11: $V4,
23304
- 12: 1,
23305
- 13: 2,
23306
- 15: 7,
23307
- 16: 8,
23308
- 17: $V5,
23309
- 23: $V6
23310
- },
23311
- { 1: [3] },
23312
- {
23313
- 14: [
23314
- 1,
23315
- 16
23316
- ]
23317
- },
23318
- o($V7, [
23319
- 2,
23320
- 7
23321
- ]),
23322
- o($V7, [
23323
- 2,
23324
- 8
23325
- ]),
23326
- o($V7, [
23327
- 2,
23328
- 9
23329
- ]),
23330
- o($V7, [
23331
- 2,
23332
- 10
23333
- ]),
23334
- o($V7, [
23335
- 2,
23336
- 11
23337
- ]),
23338
- o($V7, [
23339
- 2,
23340
- 12
23341
- ]),
23342
- o($V7, [
23343
- 2,
23344
- 3
23345
- ]),
23346
- o($V7, [
23347
- 2,
23348
- 4
23349
- ]),
23350
- o($V7, [
23351
- 2,
23352
- 5
23353
- ]),
23354
- o([
23355
- 14,
23356
- 18,
23357
- 21,
23358
- 22,
23359
- 24
23360
- ], [
23361
- 2,
23362
- 1
23363
- ]),
23364
- o($V7, [
23365
- 2,
23366
- 2
23367
- ]),
23368
- {
23369
- 3: 20,
23370
- 4: $V0,
23371
- 18: [
23372
- 1,
23373
- 17
23374
- ],
23375
- 19: 18,
23376
- 20: 19
23377
- },
23378
- {
23379
- 3: 5,
23380
- 4: $V0,
23381
- 5: 6,
23382
- 6: $V1,
23383
- 7: 3,
23384
- 8: $V2,
23385
- 9: 4,
23386
- 10: $V3,
23387
- 11: $V4,
23388
- 13: 23,
23389
- 15: 7,
23390
- 16: 8,
23391
- 17: $V5,
23392
- 23: $V6,
23393
- 24: [
23394
- 1,
23395
- 21
23396
- ],
23397
- 25: 22
23398
- },
23399
- {
23400
- 1: [
23401
- 2,
23402
- 6
23403
- ]
23404
- },
23405
- o($V7, [
23406
- 2,
23407
- 13
23408
- ]),
23409
- {
23410
- 18: [
23411
- 1,
23412
- 24
23413
- ],
23414
- 22: [
23415
- 1,
23416
- 25
23417
- ]
23418
- },
23419
- o($V8, [
23420
- 2,
23421
- 16
23422
- ]),
23423
- {
23424
- 21: [
23425
- 1,
23426
- 26
23427
- ]
23428
- },
23429
- o($V7, [
23430
- 2,
23431
- 18
23432
- ]),
23433
- {
23434
- 22: [
23435
- 1,
23436
- 28
23437
- ],
23438
- 24: [
23439
- 1,
23440
- 27
23441
- ]
23442
- },
23443
- o($V9, [
23444
- 2,
23445
- 20
23446
- ]),
23447
- o($V7, [
23448
- 2,
23449
- 14
23450
- ]),
23451
- {
23452
- 3: 20,
23453
- 4: $V0,
23454
- 20: 29
23455
- },
23456
- {
23457
- 3: 5,
23458
- 4: $V0,
23459
- 5: 6,
23460
- 6: $V1,
23461
- 7: 3,
23462
- 8: $V2,
23463
- 9: 4,
23464
- 10: $V3,
23465
- 11: $V4,
23466
- 13: 30,
23467
- 15: 7,
23468
- 16: 8,
23469
- 17: $V5,
23470
- 23: $V6
23471
- },
23472
- o($V7, [
23473
- 2,
23474
- 19
23475
- ]),
23476
- {
23477
- 3: 5,
23478
- 4: $V0,
23479
- 5: 6,
23480
- 6: $V1,
23481
- 7: 3,
23482
- 8: $V2,
23483
- 9: 4,
23484
- 10: $V3,
23485
- 11: $V4,
23486
- 13: 31,
23487
- 15: 7,
23488
- 16: 8,
23489
- 17: $V5,
23490
- 23: $V6
23491
- },
23492
- o($V8, [
23493
- 2,
23494
- 17
23495
- ]),
23496
- o($V8, [
23497
- 2,
23498
- 15
23499
- ]),
23500
- o($V9, [
23501
- 2,
23502
- 21
23503
- ])
23504
- ],
23505
- defaultActions: {
23506
- 16: [
23507
- 2,
23508
- 6
23509
- ]
23510
- },
23511
- parseError: function parseError(str, hash) {
23512
- if (hash.recoverable) {
23513
- this.trace(str);
23514
- } else {
23515
- throw new Error(str);
23516
- }
23517
- },
23518
- parse: function parse(input) {
23519
- var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, TERROR = 2, EOF = 1;
23520
- var args = lstack.slice.call(arguments, 1);
23521
- var lexer = Object.create(this.lexer);
23522
- var sharedState = { yy: {} };
23523
- for (var k in this.yy) {
23524
- if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
23525
- sharedState.yy[k] = this.yy[k];
23526
- }
23527
- }
23528
- lexer.setInput(input, sharedState.yy);
23529
- sharedState.yy.lexer = lexer;
23530
- sharedState.yy.parser = this;
23531
- if (typeof lexer.yylloc == 'undefined') {
23532
- lexer.yylloc = {};
23533
- }
23534
- var yyloc = lexer.yylloc;
23535
- lstack.push(yyloc);
23536
- var ranges = lexer.options && lexer.options.ranges;
23537
- if (typeof sharedState.yy.parseError === 'function') {
23538
- this.parseError = sharedState.yy.parseError;
23539
- } else {
23540
- this.parseError = Object.getPrototypeOf(this).parseError;
23541
- }
23542
- function lex() {
23543
- var token;
23544
- token = lexer.lex() || EOF;
23545
- if (typeof token !== 'number') {
23546
- token = self.symbols_[token] || token;
23547
- }
23548
- return token;
23549
- }
23550
- var symbol, state, action, r, yyval = {}, p, len, newState, expected;
23551
- while (true) {
23552
- state = stack[stack.length - 1];
23553
- if (this.defaultActions[state]) {
23554
- action = this.defaultActions[state];
23555
- } else {
23556
- if (symbol === null || typeof symbol == 'undefined') {
23557
- symbol = lex();
23558
- }
23559
- action = table[state] && table[state][symbol];
23560
- }
23561
- if (typeof action === 'undefined' || !action.length || !action[0]) {
23562
- var errStr = '';
23563
- expected = [];
23564
- for (p in table[state]) {
23565
- if (this.terminals_[p] && p > TERROR) {
23566
- expected.push('\'' + this.terminals_[p] + '\'');
23567
- }
23568
- }
23569
- if (lexer.showPosition) {
23570
- errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\'';
23571
- } else {
23572
- errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\'');
23573
- }
23574
- this.parseError(errStr, {
23575
- text: lexer.match,
23576
- token: this.terminals_[symbol] || symbol,
23577
- line: lexer.yylineno,
23578
- loc: yyloc,
23579
- expected: expected
23580
- });
23581
- }
23582
- if (action[0] instanceof Array && action.length > 1) {
23583
- throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol);
23584
- }
23585
- switch (action[0]) {
23586
- case 1:
23587
- stack.push(symbol);
23588
- vstack.push(lexer.yytext);
23589
- lstack.push(lexer.yylloc);
23590
- stack.push(action[1]);
23591
- symbol = null;
23592
- {
23593
- yyleng = lexer.yyleng;
23594
- yytext = lexer.yytext;
23595
- yylineno = lexer.yylineno;
23596
- yyloc = lexer.yylloc;
23597
- }
23598
- break;
23599
- case 2:
23600
- len = this.productions_[action[1]][1];
23601
- yyval.$ = vstack[vstack.length - len];
23602
- yyval._$ = {
23603
- first_line: lstack[lstack.length - (len || 1)].first_line,
23604
- last_line: lstack[lstack.length - 1].last_line,
23605
- first_column: lstack[lstack.length - (len || 1)].first_column,
23606
- last_column: lstack[lstack.length - 1].last_column
23607
- };
23608
- if (ranges) {
23609
- yyval._$.range = [
23610
- lstack[lstack.length - (len || 1)].range[0],
23611
- lstack[lstack.length - 1].range[1]
23612
- ];
23613
- }
23614
- r = this.performAction.apply(yyval, [
23615
- yytext,
23616
- yyleng,
23617
- yylineno,
23618
- sharedState.yy,
23619
- action[1],
23620
- vstack,
23621
- lstack
23622
- ].concat(args));
23623
- if (typeof r !== 'undefined') {
23624
- return r;
23625
- }
23626
- if (len) {
23627
- stack = stack.slice(0, -1 * len * 2);
23628
- vstack = vstack.slice(0, -1 * len);
23629
- lstack = lstack.slice(0, -1 * len);
23630
- }
23631
- stack.push(this.productions_[action[1]][0]);
23632
- vstack.push(yyval.$);
23633
- lstack.push(yyval._$);
23634
- newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
23635
- stack.push(newState);
23636
- break;
23637
- case 3:
23638
- return true;
23639
- }
23640
- }
23641
- return true;
23642
- }
23643
- };
23644
- /* generated by jison-lex 0.3.4 */
23645
- var lexer = (function () {
23646
- var lexer = {
23647
- EOF: 1,
23648
- parseError: function parseError(str, hash) {
23649
- if (this.yy.parser) {
23650
- this.yy.parser.parseError(str, hash);
23651
- } else {
23652
- throw new Error(str);
23653
- }
23654
- },
23655
- // resets the lexer, sets new input
23656
- setInput: function (input, yy) {
23657
- this.yy = yy || this.yy || {};
23658
- this._input = input;
23659
- this._more = this._backtrack = this.done = false;
23660
- this.yylineno = this.yyleng = 0;
23661
- this.yytext = this.matched = this.match = '';
23662
- this.conditionStack = ['INITIAL'];
23663
- this.yylloc = {
23664
- first_line: 1,
23665
- first_column: 0,
23666
- last_line: 1,
23667
- last_column: 0
23668
- };
23669
- if (this.options.ranges) {
23670
- this.yylloc.range = [
23671
- 0,
23672
- 0
23673
- ];
23674
- }
23675
- this.offset = 0;
23676
- return this;
23677
- },
23678
- // consumes and returns one char from the input
23679
- input: function () {
23680
- var ch = this._input[0];
23681
- this.yytext += ch;
23682
- this.yyleng++;
23683
- this.offset++;
23684
- this.match += ch;
23685
- this.matched += ch;
23686
- var lines = ch.match(/(?:\r\n?|\n).*/g);
23687
- if (lines) {
23688
- this.yylineno++;
23689
- this.yylloc.last_line++;
23690
- } else {
23691
- this.yylloc.last_column++;
23692
- }
23693
- if (this.options.ranges) {
23694
- this.yylloc.range[1]++;
23695
- }
23696
- this._input = this._input.slice(1);
23697
- return ch;
23698
- },
23699
- // unshifts one char (or a string) into the input
23700
- unput: function (ch) {
23701
- var len = ch.length;
23702
- var lines = ch.split(/(?:\r\n?|\n)/g);
23703
- this._input = ch + this._input;
23704
- this.yytext = this.yytext.substr(0, this.yytext.length - len);
23705
- //this.yyleng -= len;
23706
- this.offset -= len;
23707
- var oldLines = this.match.split(/(?:\r\n?|\n)/g);
23708
- this.match = this.match.substr(0, this.match.length - 1);
23709
- this.matched = this.matched.substr(0, this.matched.length - 1);
23710
- if (lines.length - 1) {
23711
- this.yylineno -= lines.length - 1;
23712
- }
23713
- var r = this.yylloc.range;
23714
- this.yylloc = {
23715
- first_line: this.yylloc.first_line,
23716
- last_line: this.yylineno + 1,
23717
- first_column: this.yylloc.first_column,
23718
- last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : this.yylloc.first_column - len
23719
- };
23720
- if (this.options.ranges) {
23721
- this.yylloc.range = [
23722
- r[0],
23723
- r[0] + this.yyleng - len
23724
- ];
23725
- }
23726
- this.yyleng = this.yytext.length;
23727
- return this;
23728
- },
23729
- // When called from action, caches matched text and appends it on next action
23730
- more: function () {
23731
- this._more = true;
23732
- return this;
23733
- },
23734
- // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead.
23735
- reject: function () {
23736
- if (this.options.backtrack_lexer) {
23737
- this._backtrack = true;
23738
- } else {
23739
- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), {
23740
- text: '',
23741
- token: null,
23742
- line: this.yylineno
23743
- });
23744
- }
23745
- return this;
23746
- },
23747
- // retain first n characters of the match
23748
- less: function (n) {
23749
- this.unput(this.match.slice(n));
23750
- },
23751
- // displays already matched input, i.e. for error messages
23752
- pastInput: function () {
23753
- var past = this.matched.substr(0, this.matched.length - this.match.length);
23754
- return (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, '');
23755
- },
23756
- // displays upcoming input, i.e. for error messages
23757
- upcomingInput: function () {
23758
- var next = this.match;
23759
- if (next.length < 20) {
23760
- next += this._input.substr(0, 20 - next.length);
23761
- }
23762
- return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(/\n/g, '');
23763
- },
23764
- // displays the character position where the lexing error occurred, i.e. for error messages
23765
- showPosition: function () {
23766
- var pre = this.pastInput();
23767
- var c = new Array(pre.length + 1).join('-');
23768
- return pre + this.upcomingInput() + '\n' + c + '^';
23769
- },
23770
- // test the lexed token: return FALSE when not a match, otherwise return token
23771
- test_match: function (match, indexed_rule) {
23772
- var token, lines, backup;
23773
- if (this.options.backtrack_lexer) {
23774
- // save context
23775
- backup = {
23776
- yylineno: this.yylineno,
23777
- yylloc: {
23778
- first_line: this.yylloc.first_line,
23779
- last_line: this.last_line,
23780
- first_column: this.yylloc.first_column,
23781
- last_column: this.yylloc.last_column
23782
- },
23783
- yytext: this.yytext,
23784
- match: this.match,
23785
- matches: this.matches,
23786
- matched: this.matched,
23787
- yyleng: this.yyleng,
23788
- offset: this.offset,
23789
- _more: this._more,
23790
- _input: this._input,
23791
- yy: this.yy,
23792
- conditionStack: this.conditionStack.slice(0),
23793
- done: this.done
23794
- };
23795
- if (this.options.ranges) {
23796
- backup.yylloc.range = this.yylloc.range.slice(0);
23797
- }
23798
- }
23799
- lines = match[0].match(/(?:\r\n?|\n).*/g);
23800
- if (lines) {
23801
- this.yylineno += lines.length;
23802
- }
23803
- this.yylloc = {
23804
- first_line: this.yylloc.last_line,
23805
- last_line: this.yylineno + 1,
23806
- first_column: this.yylloc.last_column,
23807
- last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + match[0].length
23808
- };
23809
- this.yytext += match[0];
23810
- this.match += match[0];
23811
- this.matches = match;
23812
- this.yyleng = this.yytext.length;
23813
- if (this.options.ranges) {
23814
- this.yylloc.range = [
23815
- this.offset,
23816
- this.offset += this.yyleng
23817
- ];
23818
- }
23819
- this._more = false;
23820
- this._backtrack = false;
23821
- this._input = this._input.slice(match[0].length);
23822
- this.matched += match[0];
23823
- token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]);
23824
- if (this.done && this._input) {
23825
- this.done = false;
23826
- }
23827
- if (token) {
23828
- return token;
23829
- } else if (this._backtrack) {
23830
- // recover context
23831
- for (var k in backup) {
23832
- this[k] = backup[k];
23833
- }
23834
- return false; // rule action called reject() implying the next rule should be tested instead.
23835
- }
23836
- return false;
23837
- },
23838
- // return next match in input
23839
- next: function () {
23840
- if (this.done) {
23841
- return this.EOF;
23842
- }
23843
- if (!this._input) {
23844
- this.done = true;
23845
- }
23846
- var token, match, tempMatch, index;
23847
- if (!this._more) {
23848
- this.yytext = '';
23849
- this.match = '';
23850
- }
23851
- var rules = this._currentRules();
23852
- for (var i = 0; i < rules.length; i++) {
23853
- tempMatch = this._input.match(this.rules[rules[i]]);
23854
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
23855
- match = tempMatch;
23856
- index = i;
23857
- if (this.options.backtrack_lexer) {
23858
- token = this.test_match(tempMatch, rules[i]);
23859
- if (token !== false) {
23860
- return token;
23861
- } else if (this._backtrack) {
23862
- match = false;
23863
- continue; // rule action called reject() implying a rule MISmatch.
23864
- } else {
23865
- // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
23866
- return false;
23867
- }
23868
- } else if (!this.options.flex) {
23869
- break;
23870
- }
23871
- }
23872
- }
23873
- if (match) {
23874
- token = this.test_match(match, rules[index]);
23875
- if (token !== false) {
23876
- return token;
23877
- }
23878
- // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace)
23879
- return false;
23880
- }
23881
- if (this._input === '') {
23882
- return this.EOF;
23883
- } else {
23884
- return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), {
23885
- text: '',
23886
- token: null,
23887
- line: this.yylineno
23888
- });
23889
- }
23890
- },
23891
- // return next match that has a token
23892
- lex: function lex() {
23893
- var r = this.next();
23894
- if (r) {
23895
- return r;
23896
- } else {
23897
- return this.lex();
23898
- }
23899
- },
23900
- // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack)
23901
- begin: function begin(condition) {
23902
- this.conditionStack.push(condition);
23903
- },
23904
- // pop the previously active lexer condition state off the condition stack
23905
- popState: function popState() {
23906
- var n = this.conditionStack.length - 1;
23907
- if (n > 0) {
23908
- return this.conditionStack.pop();
23909
- } else {
23910
- return this.conditionStack[0];
23911
- }
23912
- },
23913
- // produce the lexer rule set which is active for the currently active lexer condition state
23914
- _currentRules: function _currentRules() {
23915
- if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) {
23916
- return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules;
23917
- } else {
23918
- return this.conditions['INITIAL'].rules;
23919
- }
23920
- },
23921
- // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available
23922
- topState: function topState(n) {
23923
- n = this.conditionStack.length - 1 - Math.abs(n || 0);
23924
- if (n >= 0) {
23925
- return this.conditionStack[n];
23926
- } else {
23927
- return 'INITIAL';
23928
- }
23929
- },
23930
- // alias for begin(condition)
23931
- pushState: function pushState(condition) {
23932
- this.begin(condition);
23933
- },
23934
- // return the number of states currently on the stack
23935
- stateStackSize: function stateStackSize() {
23936
- return this.conditionStack.length;
23937
- },
23938
- options: {},
23939
- performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) {
23940
- switch ($avoiding_name_collisions) {
23941
- case 0:
23942
- /* skip whitespace */
23943
- break;
23944
- case 1:
23945
- return 6;
23946
- case 2:
23947
- yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2);
23948
- return 4;
23949
- case 3:
23950
- return 17;
23951
- case 4:
23952
- return 18;
23953
- case 5:
23954
- return 23;
23955
- case 6:
23956
- return 24;
23957
- case 7:
23958
- return 22;
23959
- case 8:
23960
- return 21;
23961
- case 9:
23962
- return 10;
23963
- case 10:
23964
- return 11;
23965
- case 11:
23966
- return 8;
23967
- case 12:
23968
- return 14;
23969
- case 13:
23970
- return 'INVALID';
23971
- }
23972
- },
23973
- rules: [
23974
- /^(?:\s+)/,
23975
- /^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,
23976
- /^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,
23977
- /^(?:\{)/,
23978
- /^(?:\})/,
23979
- /^(?:\[)/,
23980
- /^(?:\])/,
23981
- /^(?:,)/,
23982
- /^(?::)/,
23983
- /^(?:true\b)/,
23984
- /^(?:false\b)/,
23985
- /^(?:null\b)/,
23986
- /^(?:$)/,
23987
- /^(?:.)/
23988
- ],
23989
- conditions: {
23990
- 'INITIAL': {
23991
- 'rules': [
23992
- 0,
23993
- 1,
23994
- 2,
23995
- 3,
23996
- 4,
23997
- 5,
23998
- 6,
23999
- 7,
24000
- 8,
24001
- 9,
24002
- 10,
24003
- 11,
24004
- 12,
24005
- 13
24006
- ],
24007
- 'inclusive': true
24008
- }
24009
- }
24010
- };
24011
- return lexer;
24012
- }());
24013
- parser.lexer = lexer;
24014
- function Parser() {
24015
- this.yy = {};
24016
- }
24017
- Parser.prototype = parser;
24018
- parser.Parser = Parser;
24019
- return new Parser();
24020
- }());
24021
- if (typeof commonjsRequire !== 'undefined' && 'object' !== 'undefined') {
24022
- exports$1.parser = parser;
24023
- exports$1.Parser = parser.Parser;
24024
- exports$1.parse = function () {
24025
- return parser.parse.apply(parser, arguments);
24026
- };
24027
- }
24028
- } (jsonlint$1));
24029
- return jsonlint$1;
24030
- }
24031
-
24032
- var jsonlintExports = requireJsonlint();
24033
- var jsonlint = /*@__PURE__*/getDefaultExportFromCjs(jsonlintExports);
24034
-
24035
22968
  function readStyle(style) {
24036
22969
  if (style instanceof String || typeof style === 'string' || ArrayBuffer.isView(style)) {
24037
22970
  try {
24038
- return jsonlint.parse(style.toString());
22971
+ const str = style.toString();
22972
+ JSON.parse(str);
22973
+ return parse(str);
24039
22974
  } catch (e) {
24040
22975
  throw new ParsingError(e);
24041
22976
  }
24042
22977
  }
24043
22978
  return style;
24044
22979
  }
22980
+ const LBRACE = 0;
22981
+ const RBRACE = 1;
22982
+ const LBRACKET = 2;
22983
+ const RBRACKET = 3;
22984
+ const STRING = 4;
22985
+ const NUMBER = 5;
22986
+ const TRUE = 6;
22987
+ const FALSE = 7;
22988
+ const NULL = 8;
22989
+ function tokenize(s) {
22990
+ const tokens = [];
22991
+ let pos = 0;
22992
+ const len = s.length;
22993
+ while (pos < len) {
22994
+ const c = s.charCodeAt(pos);
22995
+ if (c === 32 || c === 9 || c === 10 || c === 13 || c === 58 || c === 44) {
22996
+ pos++;
22997
+ continue;
22998
+ }
22999
+ const start = pos;
23000
+ if (c === 123)
23001
+ tokens.push(LBRACE, start, ++pos);
23002
+ else if (c === 125)
23003
+ tokens.push(RBRACE, start, ++pos);
23004
+ else if (c === 91)
23005
+ tokens.push(LBRACKET, start, ++pos);
23006
+ else if (c === 93)
23007
+ tokens.push(RBRACKET, start, ++pos);
23008
+ else if (c === 34) {
23009
+ pos++;
23010
+ while (pos < len) {
23011
+ const ch = s.charCodeAt(pos);
23012
+ if (ch === 92)
23013
+ pos += s.charCodeAt(pos + 1) === 117 ? 6 : 2;
23014
+ else if (ch === 34)
23015
+ break;
23016
+ else
23017
+ pos++;
23018
+ }
23019
+ tokens.push(STRING, start, ++pos);
23020
+ } else if (c === 116)
23021
+ tokens.push(TRUE, start, pos += 4);
23022
+ else if (c === 102)
23023
+ tokens.push(FALSE, start, pos += 5);
23024
+ else if (c === 110)
23025
+ tokens.push(NULL, start, pos += 4);
23026
+ else {
23027
+ while (pos < len) {
23028
+ const ch = s.charCodeAt(pos);
23029
+ if (ch >= 48 && ch <= 57 || ch === 45 || ch === 43 || ch === 46 || ch === 101 || ch === 69)
23030
+ pos++;
23031
+ else
23032
+ break;
23033
+ }
23034
+ tokens.push(NUMBER, start, pos);
23035
+ }
23036
+ }
23037
+ return tokens;
23038
+ }
23039
+ function parseTokens(s, tokens) {
23040
+ let i = 0;
23041
+ const lineOffsets = [0];
23042
+ for (let j = 0; j < s.length; j++) {
23043
+ if (s.charCodeAt(j) === 10)
23044
+ lineOffsets.push(j + 1);
23045
+ }
23046
+ function lineNum(pos) {
23047
+ let lo = 0, hi = lineOffsets.length - 1;
23048
+ while (lo < hi) {
23049
+ const mid = lo + hi + 1 >> 1;
23050
+ if (lineOffsets[mid] <= pos)
23051
+ lo = mid;
23052
+ else
23053
+ hi = mid - 1;
23054
+ }
23055
+ return lo + 1;
23056
+ }
23057
+ function setLine(obj, line) {
23058
+ Object.defineProperty(obj, '__line__', { value: line });
23059
+ return obj;
23060
+ }
23061
+ function parseValue() {
23062
+ const type = tokens[i];
23063
+ const start = tokens[i + 1];
23064
+ const end = tokens[i + 2];
23065
+ i += 3;
23066
+ const line = lineNum(start);
23067
+ if (type === LBRACE) {
23068
+ const obj = setLine({}, line);
23069
+ while (tokens[i] !== RBRACE) {
23070
+ const key = JSON.parse(s.slice(tokens[i + 1], tokens[i + 2]));
23071
+ i += 3;
23072
+ obj[key] = parseValue();
23073
+ }
23074
+ i += 3;
23075
+ return obj;
23076
+ }
23077
+ if (type === LBRACKET) {
23078
+ const arr = setLine([], line);
23079
+ while (tokens[i] !== RBRACKET)
23080
+ arr.push(parseValue());
23081
+ i += 3;
23082
+ return arr;
23083
+ }
23084
+ if (type === STRING)
23085
+ return setLine(new String(JSON.parse(s.slice(start, end))), line);
23086
+ if (type === NUMBER)
23087
+ return setLine(new Number(+s.slice(start, end)), line);
23088
+ if (type === TRUE)
23089
+ return setLine(new Boolean(true), line);
23090
+ if (type === FALSE)
23091
+ return setLine(new Boolean(false), line);
23092
+ return null;
23093
+ }
23094
+ return parseValue();
23095
+ }
23096
+ function parse(s) {
23097
+ return parseTokens(s, tokenize(s));
23098
+ }
24045
23099
 
24046
23100
  function validateStyle(style, styleSpec = v8) {
24047
23101
  let s = style;