Code Duplication    Length = 125-146 lines in 2 locations

formio/node_modules/esquery/parser.js 2 locations

@@ 1348-1493 (lines=146) @@
1345
        if (result0 === null) {
1346
          pos = pos0;
1347
        }
1348
        if (result0 === null) {
1349
          pos0 = pos;
1350
          pos1 = pos;
1351
          if (input.charCodeAt(pos) === 39) {
1352
            result0 = "'";
1353
            pos++;
1354
          } else {
1355
            result0 = null;
1356
            if (reportFailures === 0) {
1357
              matchFailed("\"'\"");
1358
            }
1359
          }
1360
          if (result0 !== null) {
1361
            result1 = [];
1362
            if (/^[^\\']/.test(input.charAt(pos))) {
1363
              result2 = input.charAt(pos);
1364
              pos++;
1365
            } else {
1366
              result2 = null;
1367
              if (reportFailures === 0) {
1368
                matchFailed("[^\\\\']");
1369
              }
1370
            }
1371
            if (result2 === null) {
1372
              pos2 = pos;
1373
              pos3 = pos;
1374
              if (input.charCodeAt(pos) === 92) {
1375
                result2 = "\\";
1376
                pos++;
1377
              } else {
1378
                result2 = null;
1379
                if (reportFailures === 0) {
1380
                  matchFailed("\"\\\\\"");
1381
                }
1382
              }
1383
              if (result2 !== null) {
1384
                if (input.length > pos) {
1385
                  result3 = input.charAt(pos);
1386
                  pos++;
1387
                } else {
1388
                  result3 = null;
1389
                  if (reportFailures === 0) {
1390
                    matchFailed("any character");
1391
                  }
1392
                }
1393
                if (result3 !== null) {
1394
                  result2 = [result2, result3];
1395
                } else {
1396
                  result2 = null;
1397
                  pos = pos3;
1398
                }
1399
              } else {
1400
                result2 = null;
1401
                pos = pos3;
1402
              }
1403
              if (result2 !== null) {
1404
                result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]);
1405
              }
1406
              if (result2 === null) {
1407
                pos = pos2;
1408
              }
1409
            }
1410
            while (result2 !== null) {
1411
              result1.push(result2);
1412
              if (/^[^\\']/.test(input.charAt(pos))) {
1413
                result2 = input.charAt(pos);
1414
                pos++;
1415
              } else {
1416
                result2 = null;
1417
                if (reportFailures === 0) {
1418
                  matchFailed("[^\\\\']");
1419
                }
1420
              }
1421
              if (result2 === null) {
1422
                pos2 = pos;
1423
                pos3 = pos;
1424
                if (input.charCodeAt(pos) === 92) {
1425
                  result2 = "\\";
1426
                  pos++;
1427
                } else {
1428
                  result2 = null;
1429
                  if (reportFailures === 0) {
1430
                    matchFailed("\"\\\\\"");
1431
                  }
1432
                }
1433
                if (result2 !== null) {
1434
                  if (input.length > pos) {
1435
                    result3 = input.charAt(pos);
1436
                    pos++;
1437
                  } else {
1438
                    result3 = null;
1439
                    if (reportFailures === 0) {
1440
                      matchFailed("any character");
1441
                    }
1442
                  }
1443
                  if (result3 !== null) {
1444
                    result2 = [result2, result3];
1445
                  } else {
1446
                    result2 = null;
1447
                    pos = pos3;
1448
                  }
1449
                } else {
1450
                  result2 = null;
1451
                  pos = pos3;
1452
                }
1453
                if (result2 !== null) {
1454
                  result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]);
1455
                }
1456
                if (result2 === null) {
1457
                  pos = pos2;
1458
                }
1459
              }
1460
            }
1461
            if (result1 !== null) {
1462
              if (input.charCodeAt(pos) === 39) {
1463
                result2 = "'";
1464
                pos++;
1465
              } else {
1466
                result2 = null;
1467
                if (reportFailures === 0) {
1468
                  matchFailed("\"'\"");
1469
                }
1470
              }
1471
              if (result2 !== null) {
1472
                result0 = [result0, result1, result2];
1473
              } else {
1474
                result0 = null;
1475
                pos = pos1;
1476
              }
1477
            } else {
1478
              result0 = null;
1479
              pos = pos1;
1480
            }
1481
          } else {
1482
            result0 = null;
1483
            pos = pos1;
1484
          }
1485
          if (result0 !== null) {
1486
            result0 = (function(offset, d) {
1487
                  return { type: 'literal', value: strUnescape(d.join('')) };
1488
                })(pos0, result0[1]);
1489
          }
1490
          if (result0 === null) {
1491
            pos = pos0;
1492
          }
1493
        }
1494
        
1495
        cache[cacheKey] = {
1496
          nextPos: pos,
@@ 1215-1339 (lines=125) @@
1212
            matchFailed("\"\\\"\"");
1213
          }
1214
        }
1215
        if (result0 !== null) {
1216
          result1 = [];
1217
          if (/^[^\\"]/.test(input.charAt(pos))) {
1218
            result2 = input.charAt(pos);
1219
            pos++;
1220
          } else {
1221
            result2 = null;
1222
            if (reportFailures === 0) {
1223
              matchFailed("[^\\\\\"]");
1224
            }
1225
          }
1226
          if (result2 === null) {
1227
            pos2 = pos;
1228
            pos3 = pos;
1229
            if (input.charCodeAt(pos) === 92) {
1230
              result2 = "\\";
1231
              pos++;
1232
            } else {
1233
              result2 = null;
1234
              if (reportFailures === 0) {
1235
                matchFailed("\"\\\\\"");
1236
              }
1237
            }
1238
            if (result2 !== null) {
1239
              if (input.length > pos) {
1240
                result3 = input.charAt(pos);
1241
                pos++;
1242
              } else {
1243
                result3 = null;
1244
                if (reportFailures === 0) {
1245
                  matchFailed("any character");
1246
                }
1247
              }
1248
              if (result3 !== null) {
1249
                result2 = [result2, result3];
1250
              } else {
1251
                result2 = null;
1252
                pos = pos3;
1253
              }
1254
            } else {
1255
              result2 = null;
1256
              pos = pos3;
1257
            }
1258
            if (result2 !== null) {
1259
              result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]);
1260
            }
1261
            if (result2 === null) {
1262
              pos = pos2;
1263
            }
1264
          }
1265
          while (result2 !== null) {
1266
            result1.push(result2);
1267
            if (/^[^\\"]/.test(input.charAt(pos))) {
1268
              result2 = input.charAt(pos);
1269
              pos++;
1270
            } else {
1271
              result2 = null;
1272
              if (reportFailures === 0) {
1273
                matchFailed("[^\\\\\"]");
1274
              }
1275
            }
1276
            if (result2 === null) {
1277
              pos2 = pos;
1278
              pos3 = pos;
1279
              if (input.charCodeAt(pos) === 92) {
1280
                result2 = "\\";
1281
                pos++;
1282
              } else {
1283
                result2 = null;
1284
                if (reportFailures === 0) {
1285
                  matchFailed("\"\\\\\"");
1286
                }
1287
              }
1288
              if (result2 !== null) {
1289
                if (input.length > pos) {
1290
                  result3 = input.charAt(pos);
1291
                  pos++;
1292
                } else {
1293
                  result3 = null;
1294
                  if (reportFailures === 0) {
1295
                    matchFailed("any character");
1296
                  }
1297
                }
1298
                if (result3 !== null) {
1299
                  result2 = [result2, result3];
1300
                } else {
1301
                  result2 = null;
1302
                  pos = pos3;
1303
                }
1304
              } else {
1305
                result2 = null;
1306
                pos = pos3;
1307
              }
1308
              if (result2 !== null) {
1309
                result2 = (function(offset, a, b) { return a + b; })(pos2, result2[0], result2[1]);
1310
              }
1311
              if (result2 === null) {
1312
                pos = pos2;
1313
              }
1314
            }
1315
          }
1316
          if (result1 !== null) {
1317
            if (input.charCodeAt(pos) === 34) {
1318
              result2 = "\"";
1319
              pos++;
1320
            } else {
1321
              result2 = null;
1322
              if (reportFailures === 0) {
1323
                matchFailed("\"\\\"\"");
1324
              }
1325
            }
1326
            if (result2 !== null) {
1327
              result0 = [result0, result1, result2];
1328
            } else {
1329
              result0 = null;
1330
              pos = pos1;
1331
            }
1332
          } else {
1333
            result0 = null;
1334
            pos = pos1;
1335
          }
1336
        } else {
1337
          result0 = null;
1338
          pos = pos1;
1339
        }
1340
        if (result0 !== null) {
1341
          result0 = (function(offset, d) {
1342
                return { type: 'literal', value: strUnescape(d.join('')) };