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