@slyte/html-parser 2.0.0-alpha

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.
@@ -0,0 +1,707 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ // The require scope
4
+ /******/ const __webpack_require__ = {};
5
+ /******/
6
+ /************************************************************************/
7
+ /******/ /* webpack/runtime/define property getters */
8
+ /******/ (() => {
9
+ /******/ // define getter/value functions for harmony exports
10
+ /******/ __webpack_require__.d = (exports, definition) => {
11
+ /******/ if(Array.isArray(definition)) {
12
+ /******/ var i = 0;
13
+ /******/ while(i < definition.length) {
14
+ /******/ var key = definition[i++];
15
+ /******/ var binding = definition[i++];
16
+ /******/ if(!__webpack_require__.o(exports, key)) {
17
+ /******/ if(binding === 0) {
18
+ /******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
19
+ /******/ } else {
20
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
21
+ /******/ }
22
+ /******/ } else if(binding === 0) { i++; }
23
+ /******/ }
24
+ /******/ } else {
25
+ /******/ for(var key in definition) {
26
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
27
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
28
+ /******/ }
29
+ /******/ }
30
+ /******/ }
31
+ /******/ };
32
+ /******/ })();
33
+ /******/
34
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
35
+ /******/ (() => {
36
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
37
+ /******/ })();
38
+ /******/
39
+ /******/ /* webpack/runtime/make namespace object */
40
+ /******/ (() => {
41
+ /******/ // define __esModule on exports
42
+ /******/ __webpack_require__.r = (exports) => {
43
+ /******/ if(Symbol.toStringTag) {
44
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
45
+ /******/ }
46
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
47
+ /******/ };
48
+ /******/ })();
49
+ /******/
50
+ /************************************************************************/
51
+ let __webpack_exports__ = {};
52
+ /*!*******************************!*\
53
+ !*** ./src/HandleMustache.js ***!
54
+ \*******************************/
55
+ __webpack_require__.r(__webpack_exports__);
56
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
57
+ /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
58
+ /* harmony export */ });
59
+ let errorType = ["Empty Mustache Not allowed", "missing ',' in helper function parameters", "Unexpected token ", "Misplaced ','", "Callback invocation is not supported", "Only helper function calls are allowed", "Syntax error encountered while accessing object", "Syntax Error invalid '.' Dot operator", `String started and never closed`, "Syntax Error unmatched ", " Array Without indexing ", "Syntax Error"],
60
+ capturedError = undefined;
61
+ function isAlpha(str){
62
+ return /^[a-zA-Z]$/.test(str);
63
+ }
64
+ function isAlphaNumeric(str) {
65
+ return /^[a-zA-Z0-9]$/.test(str);
66
+ }
67
+ function isNumeric(code) {
68
+ return /^[0-9]$/.test(code);
69
+ }
70
+
71
+ function validKeysString(val) {
72
+ return isAlphaNumeric(val) || "!@#$%^&*_+-=".indexOf(val) != -1;
73
+ }
74
+
75
+ function isValidSquareBracket(val) {
76
+ return isAlphaNumeric(val) || val == "]" || val == ")" || val == "_" || val == "$" || val == " ";
77
+ }
78
+
79
+ function isValidDot(val) {
80
+ return isValidSquareBracket(val) || "!@#$%^&*_+-=".indexOf(val) != -1;
81
+ }
82
+
83
+ function updateSqBracket(val) {
84
+ for (let i = 0; i < val.length; i++) {
85
+ val[i]++;
86
+ }
87
+ return val;
88
+ }
89
+
90
+ function isValidVariableName(name) {
91
+ return /^[a-zA-Z_$][a-zA-Z_$0-9]*$/.test(name);
92
+ }
93
+ function createErroObj(errType,errorIndex,offset = "",bool = false){
94
+ return {
95
+ bool,
96
+ errType,
97
+ errorIndex,
98
+ err : errorType[errType] + offset
99
+ }
100
+ }
101
+ function getObservedAttributes(str, check) {
102
+ let observedAttributes = [],
103
+ string = "",
104
+ variableStarted = false,
105
+ doubleQuoteStringStarted = false,
106
+ singleQuoteStringStarted = false,
107
+ dotStarted = false;
108
+
109
+ for (let i = 0; i < str.length; i++) {
110
+ if (str[i] == "'" && str[i - 1] != "\\") {
111
+ doubleQuoteStringStarted = !doubleQuoteStringStarted;
112
+ } else if (str[i] == '"' && str[i - 1] != "\\") {
113
+ singleQuoteStringStarted = !singleQuoteStringStarted;
114
+ } else if (!doubleQuoteStringStarted && !singleQuoteStringStarted) {
115
+ if (isAlphaNumeric(str[i]) || str[i] == '_') {
116
+ variableStarted = true;
117
+ string += str[i];
118
+ } else {
119
+ if (str[i] == " ") {
120
+ continue;
121
+ }
122
+
123
+ if (dotStarted) {
124
+ string = ""
125
+ if (str[i] != ".") {
126
+ dotStarted = false;
127
+ } else {
128
+ continue;
129
+ }
130
+ }
131
+ if (str[i] == ".") {
132
+ dotStarted = true;
133
+ }
134
+ if (string.length > 0 && str[i] != '(' && isValidVariableName(string)) {
135
+
136
+ check.observedAttributes[string] = true;
137
+ }
138
+ variableStarted = false;
139
+ }
140
+ }
141
+ if (!variableStarted) {
142
+ string = "";
143
+ }
144
+ }
145
+ return observedAttributes
146
+ }
147
+
148
+ function checkForMixedCase(val) {
149
+ let seenDoubleQuotes = false,
150
+ seenSingleQuotes = false,
151
+ mustacheStarted = false,
152
+ mixedCase = false,
153
+ slashCount = 0,
154
+ mustacheSpots = [],
155
+ res = "",
156
+ mus={};
157
+ for (let i = 0; i < val.length; i++) {
158
+ if (mustacheStarted ) {
159
+ if(((seenDoubleQuotes || seenSingleQuotes) || val[i].match(/\S/))){
160
+ res += val[i];
161
+ }
162
+ else if (val[i+1] && val[i].match(/\s/) && /^\s*\+\+|--|[+\-*/%\w]|\*\*/.test(val[i+1])) {
163
+ res += val[i];
164
+ }
165
+ }
166
+ if (val[i - 1] != "\\" && val[i] == "{" && val[i + 1] == "{" && !seenDoubleQuotes && !seenSingleQuotes) {
167
+ if(mustacheStarted){
168
+ let dynamicValue;
169
+ if(mus && mus.index && mus.index[0]!=undefined){
170
+ dynamicValue = val.substring(mus.index[0], i);
171
+ }
172
+ return {
173
+ bool:false,
174
+ dynamicValue,
175
+ errorIndex:i,
176
+ err:"Invalid dynamic value inside dynamic value `{{`"
177
+ };
178
+ }
179
+ if (!mixedCase && i != 0) {
180
+ mixedCase = true
181
+ }
182
+ mus = {}
183
+ mus.index = [i];
184
+ mustacheStarted = true;
185
+ }
186
+ if (val[i] == "}" && val[i + 1] == "}" && !seenDoubleQuotes && !seenSingleQuotes && mustacheStarted) {
187
+ if (!mixedCase && i + 1 != val.length - 1) {
188
+ mixedCase = true
189
+ }
190
+ mus.index[1] = i + 1;
191
+ mus.orgMus = val.substring(mus.index[0],mus.index[1]+1);
192
+ mus.mus = "{"+res+"}";
193
+ res = "";
194
+ mustacheSpots.push(mus);
195
+ mustacheStarted = false;
196
+ }
197
+ if (val[i] == "\\") {
198
+ slashCount++;
199
+ }
200
+ if (val[i - 1] != "\\" || (val[i - 1] == "\\" && slashCount % 2 == 0)) {
201
+ if (val[i] == "'" && !seenDoubleQuotes && mustacheStarted) {
202
+ seenSingleQuotes = !seenSingleQuotes;
203
+ }
204
+ if (val[i] == '"' && !seenSingleQuotes && mustacheStarted) {
205
+ seenDoubleQuotes = !seenDoubleQuotes;
206
+ }
207
+ }
208
+ if (val[i] != "\\") {
209
+ slashCount = 0;
210
+ }
211
+
212
+ }
213
+ return {
214
+ bool:true,
215
+ mixedCase: mixedCase,
216
+ mustacheSpots: mustacheSpots
217
+ };
218
+ }
219
+
220
+ function getLineAndColIndex(val, obj, mSpot) {
221
+ let beforeContextSplit = val.substring(0, mSpot).split("\n");
222
+ return {
223
+ colIndex: (beforeContextSplit.length - 1) ? beforeContextSplit[beforeContextSplit.length - 1].length : obj.colIndex + mSpot,
224
+ lineIndex: obj.lineIndex + beforeContextSplit.length - 1
225
+ };
226
+ }
227
+
228
+ function syntaxCheckWorkerNew(val, check = undefined, errorObj = {mustacheSyntax:{arr:[],obj:{}}}, index = {},attr) {
229
+ if (!check.Compile) {
230
+ // console.error("Error: `can't get trimAttr scope`");
231
+ return {
232
+ text: val
233
+ };
234
+ } else {
235
+ let syn = undefined,
236
+ observedAttributes = undefined,
237
+ mixedCaseCheck = false,
238
+ origMustache = val;
239
+ if (val.indexOf("{{") !== -1) {
240
+ attr && (val = val.trim().replace(/^@nbsp@|@nbsp@$/gm,""));
241
+ let tempCopy, valCopy = val,
242
+ res = checkForMixedCase(val);
243
+ if (res.bool) {
244
+ const {
245
+ mixedCase,
246
+ mustacheSpots
247
+ } = res;
248
+ mixedCaseCheck = mixedCase;
249
+ if (mustacheSpots.length && mustacheSpots.length > 0) {
250
+ for (let j = 0; j < mustacheSpots.length; j++) {
251
+ let mustache = mustacheSpots[j].mus,
252
+ x = mustache,
253
+ spots = mustacheSpots[j].index;
254
+ if(mustache.match(/\&|\||\!|\=|\+|-|\*|\/|<|>|\?|:|%/gm)){
255
+ x = check.Compile.trimAttr(mustache, [], {}, undefined, "", check);
256
+
257
+ }
258
+ val = val.replace(mustacheSpots[j].orgMus, () => {
259
+ return x;
260
+ });
261
+ tempCopy = x;
262
+ syn = processAttr(x);
263
+ if (!syn.bool) {
264
+ if (errorObj.hasOwnProperty("mustacheSyntax")) {
265
+ syn = Object.assign(syn, getLineAndColIndex(val, index, spots[0]));
266
+ syn.dynamicValue = x;
267
+ syn.fileName = check.fileName;
268
+ syn.musEnd = getLineAndColIndex(val, index, spots[1]);
269
+ errorObj.mustacheSyntax.arr.push(syn);
270
+ if (errorObj.mustacheSyntax.obj[errorType[syn.errType]]) {
271
+ errorObj.mustacheSyntax.obj[errorType[syn.errType]].push(check.fileName)
272
+ } else {
273
+ errorObj.mustacheSyntax.obj[errorType[syn.errType]] = [check.fileName]
274
+ }
275
+ }
276
+ }
277
+ if (check && check.emberFlag && ((syn && syn.bool) || (!capturedError))) {
278
+ getObservedAttributes(tempCopy, check);
279
+ }
280
+
281
+ }
282
+ } else {
283
+ syn = processAttr(val);
284
+ if (!syn.bool) {
285
+ syn.dynamicValue = val;
286
+ if ( errorObj.hasOwnProperty("mustacheSyntax") ) {
287
+ syn = Object.assign(syn, getLineAndColIndex(val, index, val.indexOf("{{")));
288
+ syn.fileName = check.fileName;
289
+ errorObj.mustacheSyntax.arr.push(syn);
290
+ if (errorObj.mustacheSyntax.obj[errorType[syn.errType]]) {
291
+ errorObj.mustacheSyntax.obj[errorType[syn.errType]].push(check.fileName)
292
+ } else {
293
+ errorObj.mustacheSyntax.obj[errorType[syn.errType]] = [check.fileName]
294
+ }
295
+ }
296
+ }
297
+ }
298
+ }
299
+ else{
300
+ res = Object.assign(res, getLineAndColIndex(val, index, val.indexOf("{{")));
301
+ if(!res.dynamicValue){
302
+ res.dynamicValue = val;
303
+ }
304
+ res.fileName = check.fileName;
305
+ errorObj.mustacheSyntax.arr.push(res);
306
+ if (errorObj.mustacheSyntax.obj[res.err]) {
307
+ errorObj.mustacheSyntax.obj[res.err].push(check.fileName)
308
+ } else {
309
+ errorObj.mustacheSyntax.obj[res.err] = [check.fileName]
310
+ }
311
+ }
312
+ }
313
+ if (!check.fromInternal && check.withoutTemplateConversion) {
314
+ val = origMustache;
315
+ }
316
+ val = val.replace(/@nbsp@/gm, "&nbsp;");
317
+ let res = {
318
+ text: val,
319
+ type: syn ? ((mixedCaseCheck) ? "Mixed" : syn.type) : syn,
320
+ "observedAttributes": (observedAttributes && observedAttributes.length > 0) ? observedAttributes : undefined
321
+ }
322
+ if(res.type == "helper"){
323
+ res.capturedHelper = syn.capturedHelper;
324
+ }
325
+ return res;
326
+ }
327
+ }
328
+
329
+ function processAttr(val) {
330
+ let parsingMustache,
331
+ mustacheIndex = 0,
332
+ typeStarted,
333
+ type = null,
334
+ mustache = 0,
335
+ retObj = {
336
+ mustache: 0,
337
+ bool: true,
338
+ err: null,
339
+ errorIndex: 0
340
+ },
341
+ valueBeforeSpace = undefined,
342
+ stringStartIndex = 0,
343
+ seenTextBeforeNextcomma = undefined,
344
+ seenTokenBefore = false,
345
+ stringStartCheck = false,
346
+ dotStarted = false,
347
+ IdentifierStarted = false,
348
+ hashStarted = false,
349
+ prevToken = "",
350
+ capturedToken = "",
351
+ capturedHelper;
352
+ if (val == '{{}}') {
353
+ return createErroObj(0,0);
354
+ }
355
+ for (let i = 0; i < val.length; i++) {
356
+ if (parsingMustache) {
357
+ if ((validKeysString(val[i]))) {
358
+ if ((!stringStarted && !dotStarted && "!@%^&*+-=".indexOf(val[i]) != -1) || (val[i - 1] == " " && seenTokenBefore) || (stringStartCheck && val[i - 1] == " ")) {
359
+ return createErroObj(2, i, val[i]);
360
+ }
361
+ if (!stringStarted) {
362
+ seenTokenBefore = true;
363
+ capturedToken+=val[i];
364
+ }
365
+
366
+ } else if (val[i] != " ") {
367
+ if (!stringStarted && (val[i] == "'" || val[i] == '"')) {
368
+ if (val[i - 1] == " " && seenTokenBefore) {
369
+ return createErroObj(2, i, val[i]);
370
+ }
371
+ }
372
+ if (!stringStarted && val[i] == ".") {
373
+ dotStarted = true;
374
+ } else {
375
+ dotStarted = false;
376
+ }
377
+ stringStartCheck = false;
378
+ seenTokenBefore = false;
379
+ if(capturedToken){
380
+ prevToken = capturedToken;
381
+ }
382
+ capturedToken="";
383
+ }
384
+ if (seenTextBeforeNextcomma == false && val[i] != " " && val[i] != ",") {
385
+ seenTextBeforeNextcomma = true;
386
+ }
387
+ if (sqBrackets.length > 0 && ![" ", "]", "["].includes(val[i])) {
388
+ sqBrackets = updateSqBracket(sqBrackets);
389
+ }
390
+ if (spaceStarted && val[i] == "," && !stringStarted) {
391
+ spaceStarted = false;
392
+ valueBeforeSpace = undefined;
393
+ }
394
+ if (!stringStarted && !commaSeen && (isAlphaNumeric(val[i]) || val[i]=="#") && ((valueBeforeSpace && isAlphaNumeric(valueBeforeSpace)) || (valueBeforeSpace && ["'", '"'].includes(valueBeforeSpace)) || ["'", '"'].includes(val[i - 1]))) {
395
+ return createErroObj(2, i, val[i]);
396
+ }
397
+ if (spaceStarted && ![",", " "].includes(val[i]) && !stringStarted && !commaSeen && paranthesis != 0) {
398
+
399
+ if (val[i] == "(" || val[i] == "[" || ((val[i] == ")" || val[i]=="'" || val[i] == '"') && paranthesis >= 1) || (val[i] == "]" && squareBracketCount >= 1) || isAlphaNumeric(val[i]) || val[i] == "_") {
400
+ spaceStarted = false;
401
+ valueBeforeSpace = undefined;
402
+ }
403
+ else {
404
+ return createErroObj(2, i, val[i]);
405
+ }
406
+ } else if (!stringStarted && "," == val[i] && paranthesis == 0) {
407
+ return createErroObj(3, i);
408
+ } else if (!stringStarted && val[i] == ',') {
409
+ seenTextBeforeNextcomma = false;
410
+ commaSeen = true;
411
+ }
412
+ if (checkThis) {
413
+ if (![",", " ", "}"].includes(val[i])) {
414
+ if ([")", "]"].includes(checkThis) || (['"', "'"].includes(checkThis) && !stringStarted)) {
415
+ if (((val[i] == ")" && paranthesis >= 0) || (val[i] == "]" && sqBrackets.length > 0) || (val[i] == '[') || (val[i] == '.'))) {
416
+ checkThis = undefined;
417
+ }
418
+ else if (!commaSeen && !spaceStarted && !stringStarted && !(!stringStarted && checkThis == '"') && !(!stringStarted && checkThis == "'")) {
419
+ if (paranthesis > 0 && checkThis == ']') {
420
+ return createErroObj(4, i);
421
+ } else {
422
+ if (val[i] == '(' && checkThis == ')') {
423
+ return createErroObj(11, i);
424
+ }
425
+ if (val[i] == ']' && checkThis == ')') {
426
+ return createErroObj(5, i);
427
+ }
428
+ if ((val[i] == ']' && checkThis != ']') || (val[i] == ')' && checkThis != ')')) {
429
+ return createErroObj(11, i);
430
+ }
431
+ if (val[i - 1] == ')') {
432
+ return createErroObj(2,i,val[i]);
433
+ }
434
+
435
+ }
436
+ }
437
+ } else if (checkThis == '.') {
438
+ if (val[i].toUpperCase() != val[i].toLowerCase() || "!@#$%^&*_+-={[".indexOf(val[i]) != -1 || isNumeric(val[i])) {
439
+ checkThis = undefined;
440
+ } else if (!spaceStarted) {
441
+ return createErroObj(6, i);
442
+ }
443
+ }
444
+ } else if (!stringStarted && val[i] == "," && paranthesis == 0) {
445
+ return createErroObj(11, i);
446
+
447
+ } else if (!stringStarted && val[i] == ',') {
448
+ checkThis = undefined;
449
+ }
450
+ }
451
+ if (paranthesis == 0 && val[i - 1] == ')' && ['.', '['].includes(val[i])) {
452
+ type = "Extra Helper";
453
+ }
454
+ if(hashStarted){
455
+ if(!(isAlpha(val[i]) || val[i] == "_")){
456
+ return {
457
+ bool: false,
458
+ err: `Invalid character '${val[i]}' after #`,
459
+ errorIndex: i + 1
460
+ };
461
+ }
462
+ hashStarted = false;
463
+ }
464
+ if (val[i] == "\\") {
465
+ i = i + 1;
466
+ } else if (val[i] == "'") {
467
+ if (lastString != '"') {
468
+ if (!stringStarted) {
469
+ if(!(paranthesis>0 || (squareBracket && squareBracket.length>0))){
470
+ return createErroObj(2, i, "'");
471
+ }
472
+ stringStarted = true;
473
+ stringStartIndex = i;
474
+ lastString = "'";
475
+ } else {
476
+ let count = undefined;
477
+ if (val[i - 1] == "\\") {
478
+ count = 0;
479
+ for (let j = i - 1; j >= 0; j--) {
480
+ if (val[j] == "\\") {
481
+ count++;
482
+ } else {
483
+ break;
484
+ }
485
+ }
486
+ }
487
+ if (count == undefined || count % 2 == 0) {
488
+ stringStarted = false;
489
+ stringStartCheck = true;
490
+ lastString = undefined;
491
+ }
492
+ }
493
+
494
+ }
495
+ } else if (val[i] == '"') {
496
+ if (lastString != "'") {
497
+ if (!stringStarted) {
498
+ if(!(paranthesis>0 || (squareBracket && squareBracket.length>0))){
499
+ return createErroObj(2, i, '"');
500
+ }
501
+ stringStarted = true;
502
+ stringStartIndex = i;
503
+ lastString = '"'
504
+ } else {
505
+ let count = undefined;
506
+ if (val[i - 1] == "\\") {
507
+ count = 0;
508
+ for (let j = i - 1; j >= 0; j--) {
509
+ if (val[j] == "\\") {
510
+ count++;
511
+ } else {
512
+ break;
513
+ }
514
+ }
515
+ }
516
+ if (count == undefined || count % 2 == 0) {
517
+ stringStarted = false;
518
+ stringStartCheck = true;
519
+ lastString = undefined;
520
+ }
521
+ }
522
+ }
523
+ } else if (val[i] == "{" && !stringStarted && dotStarted) {
524
+ return createErroObj(2, i, "'{' bracket ");
525
+ } else if (val[i] == "{" && stringStarted && val[i - 1] == "{") {
526
+ retObj.mustache++;
527
+ } else if (val[i] == "}" && val[i - 1] == "}" && !stringStarted) {
528
+ if (curlyBracket.length) {
529
+ return createErroObj(9, i, "'(' bracket ");
530
+ }
531
+ if (squareBracket.length) {
532
+ return createErroObj(9, i, "'[' bracket ");
533
+ }
534
+ parsingMustache = false;
535
+
536
+ } else if (val[i] == "[" && !stringStarted) {
537
+ if (isValidSquareBracket(val[i - 1])) {
538
+ squareBracket.push("[");
539
+ sqBrackets.push(0);
540
+ }
541
+ if (!typeStarted) {
542
+ typeStarted = 1
543
+ }
544
+ if (typeStarted == 1) {
545
+ if (!squareBracketCount && squareBracketCount != 0) {
546
+ squareBracketCount = 1
547
+ } else {
548
+ squareBracketCount += 1;
549
+ }
550
+
551
+ if (squareBracketCount > 1) {
552
+ type = "Multi-dimensional array"
553
+ }
554
+
555
+ }
556
+
557
+ } else if (val[i] == "]" && !stringStarted) {
558
+ let check;
559
+ if (squareBracket.length) {
560
+ squareBracket.pop();
561
+ check = sqBrackets.pop();
562
+ } else {
563
+ return createErroObj(9, i, "']' bracket ");
564
+ }
565
+ if (check == 0) {
566
+ return createErroObj(10, i);
567
+ }
568
+ squareBracketCount -= 1;
569
+
570
+ } else if (val[i] == "(" && !stringStarted) {
571
+ if (i > 0 && (isAlphaNumeric(val[i - 1]) || val[i] == '_')) {
572
+ curlyBracket.push('(');
573
+ } else {
574
+ return createErroObj(2, i, val[i]);
575
+ }
576
+ paranthesis += 1
577
+ if (paranthesisLog == 0) {
578
+ continue;
579
+ }
580
+ if (!typeStarted) {
581
+ typeStarted = 2
582
+ }
583
+ if (typeStarted == 1 && squareBracketCount > 0) {
584
+ type = "Multi-dimensional array"
585
+ }
586
+ if (typeStarted == 3 && sqBrackets.length == 0) {
587
+ return createErroObj(5, dotIndex);
588
+ }
589
+ if (typeStarted == 2) {
590
+ if (!paranthesisLog && paranthesisLog != 0) {
591
+ paranthesisLog = 1
592
+ } else {
593
+ paranthesisLog += 1;
594
+ }
595
+ if(paranthesisLog == 1){
596
+ if(!capturedHelper){
597
+ capturedHelper = prevToken;
598
+ }
599
+ }
600
+ if (paranthesisLog > 1) {
601
+ type = "helper";
602
+ }
603
+ }
604
+ } else if (val[i] == ")" && !stringStarted) {
605
+ if (curlyBracket.length) {
606
+ curlyBracket.pop();
607
+ } else {
608
+ return createErroObj(9, i, "')' bracket ");
609
+ }
610
+ paranthesis -= 1;
611
+ paranthesisLog -= 1;
612
+ if (!typeStarted) {
613
+ typeStarted = 2;
614
+ }
615
+ if (typeStarted == 2) {
616
+ if (paranthesisLog == 0 && !type) {
617
+ type = "helper";
618
+ }
619
+ }
620
+ } else if (val[i] == "." && !stringStarted) {
621
+
622
+ if (!isValidDot(val[i - 1])) {
623
+ return createErroObj(7, i);
624
+ }
625
+ if (!typeStarted) {
626
+ typeStarted = 3;
627
+ }
628
+ if (typeStarted == 1 && sqBrackets.length > 0) {
629
+ type = "Multi-dimensional array"
630
+ }
631
+ dotIndex = i;
632
+ } else if (val[i] == "#" && !stringStarted) {
633
+ if(dotStarted || IdentifierStarted){
634
+ return createErroObj(2, i, "'#' operator");
635
+ }
636
+ hashStarted = true;
637
+ }
638
+ if((isAlphaNumeric(val[i]) || val[i] == "_") && !stringStarted){
639
+ if(val[i + 1] == "'" || val[i + 1] == '"'){
640
+ return createErroObj(2, i + 1, val[i + 1]);
641
+ }
642
+ IdentifierStarted = true;
643
+ } else {
644
+ IdentifierStarted = false;
645
+ }
646
+ if (!stringStarted && commaSeen && ![" ", ","].includes(val[i])) {
647
+ commaSeen = false;
648
+ seenTextBeforeNextcomma = undefined;
649
+ spaceStarted = false;
650
+ valueBeforeSpace = undefined;
651
+ }
652
+ if (paranthesis > 0) {
653
+ if (val[i + 1] == " " && !stringStarted) {
654
+ spaceStarted = true;
655
+ valueBeforeSpace = val[i];
656
+ continue;
657
+ }
658
+ if (spaceStarted) {
659
+ continue;
660
+ }
661
+
662
+ };
663
+ if (!stringStarted && paranthesis >= 0 && [")", "]", ".", "'", '"'].includes(val[i])) {
664
+ checkThis = val[i];
665
+
666
+ }
667
+
668
+ } else if ((val[i] == "{" && val[i - 1] == "{" && val[i - 2] != "\\")) {
669
+ mustache++;
670
+ var curlyBracket = [],
671
+ squareBracket = [],
672
+ stringStarted, lastString,
673
+ paranthesis = 0,
674
+ squareBracketCount,
675
+ spaceStarted, checkThis, paranthesisLog,
676
+ sqBrackets = [],
677
+ commaSeen,
678
+ dotIndex;
679
+ typeStarted = null;
680
+ type = null;
681
+ parsingMustache = true;
682
+ checkThis = undefined;
683
+ mustacheIndex = i;
684
+ }
685
+ }
686
+ if (stringStarted) {
687
+ return createErroObj(8, stringStartIndex);
688
+ }
689
+ if (parsingMustache) {
690
+ return createErroObj(9, mustacheIndex, "'{' bracket");
691
+ }
692
+ if (!type) {
693
+ type = "Normal Data"
694
+ }
695
+ if (mustache > 1) {
696
+ type = "mixed mustache";
697
+ }
698
+ retObj.type = type;
699
+ if(type == "helper"){
700
+ retObj.capturedHelper = capturedHelper;
701
+ }
702
+ return retObj;
703
+ }
704
+ /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (syntaxCheckWorkerNew);
705
+ Object(window["html-parser"]).HandleMustache = __webpack_exports__["default"];
706
+ /******/ })()
707
+ ;