Best JavaScript code snippet using mountebank
expressions.js
Source:expressions.js
1(function (root, name, factory) {2 'use strict';3 var freeExports = typeof exports === 'object' && exports4 , freeModule = typeof module === 'object' && module && module.exports === freeExports && module5 , freeGlobal = typeof global === 'object' && global;6 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) root = freeGlobal;7 if (typeof define === 'function' && define.amd) define(['exports'], factory);8 else if (freeExports && !freeExports.nodeType) {9 if (freeModule) factory(freeModule.exports);10 else factory(freeExports);11 }12 else factory((root[name] = {}));13}(this, 'expressions', function (exports) {14 'use strict';15 exports.name = 'expressions';16 exports.spec = [17 {18 "source": "a =",19 "result": "[1:3] <expression> expected near '<eof>'"20 },21 {22 "source": "a = [[foo]]",23 "result": {24 "type": "Chunk",25 "body": [26 {27 "type": "AssignmentStatement",28 "variables": [29 {30 "type": "Identifier",31 "name": "a",32 "loc": {33 "start": {34 "line": 1,35 "column": 036 },37 "end": {38 "line": 1,39 "column": 140 }41 },42 "range": [43 0,44 145 ],46 "isLocal": false47 }48 ],49 "init": [50 {51 "type": "StringLiteral",52 "value": null,53 "raw": "[[foo]]",54 "loc": {55 "start": {56 "line": 1,57 "column": 458 },59 "end": {60 "line": 1,61 "column": 1162 }63 },64 "range": [65 4,66 1167 ]68 }69 ],70 "loc": {71 "start": {72 "line": 1,73 "column": 074 },75 "end": {76 "line": 1,77 "column": 1178 }79 },80 "range": [81 0,82 1183 ]84 }85 ],86 "loc": {87 "start": {88 "line": 1,89 "column": 090 },91 "end": {92 "line": 1,93 "column": 1194 }95 },96 "range": [97 0,98 1199 ],100 "comments": [],101 "globals": [102 {103 "type": "Identifier",104 "name": "a",105 "loc": {106 "start": {107 "line": 1,108 "column": 0109 },110 "end": {111 "line": 1,112 "column": 1113 }114 },115 "range": [116 0,117 1118 ],119 "isLocal": false120 }121 ]122 }123 },124 {125 "source": "a = {}",126 "result": {127 "type": "Chunk",128 "body": [129 {130 "type": "AssignmentStatement",131 "variables": [132 {133 "type": "Identifier",134 "name": "a",135 "loc": {136 "start": {137 "line": 1,138 "column": 0139 },140 "end": {141 "line": 1,142 "column": 1143 }144 },145 "range": [146 0,147 1148 ],149 "isLocal": false150 }151 ],152 "init": [153 {154 "type": "TableConstructorExpression",155 "fields": [],156 "loc": {157 "start": {158 "line": 1,159 "column": 4160 },161 "end": {162 "line": 1,163 "column": 6164 }165 },166 "range": [167 4,168 6169 ]170 }171 ],172 "loc": {173 "start": {174 "line": 1,175 "column": 0176 },177 "end": {178 "line": 1,179 "column": 6180 }181 },182 "range": [183 0,184 6185 ]186 }187 ],188 "loc": {189 "start": {190 "line": 1,191 "column": 0192 },193 "end": {194 "line": 1,195 "column": 6196 }197 },198 "range": [199 0,200 6201 ],202 "comments": [],203 "globals": [204 {205 "type": "Identifier",206 "name": "a",207 "loc": {208 "start": {209 "line": 1,210 "column": 0211 },212 "end": {213 "line": 1,214 "column": 1215 }216 },217 "range": [218 0,219 1220 ],221 "isLocal": false222 }223 ]224 }225 },226 {227 "source": "a = (a)",228 "result": {229 "type": "Chunk",230 "body": [231 {232 "type": "AssignmentStatement",233 "variables": [234 {235 "type": "Identifier",236 "name": "a",237 "loc": {238 "start": {239 "line": 1,240 "column": 0241 },242 "end": {243 "line": 1,244 "column": 1245 }246 },247 "range": [248 0,249 1250 ],251 "isLocal": false252 }253 ],254 "init": [255 {256 "type": "Identifier",257 "name": "a",258 "loc": {259 "start": {260 "line": 1,261 "column": 5262 },263 "end": {264 "line": 1,265 "column": 6266 }267 },268 "range": [269 5,270 6271 ],272 "isLocal": false273 }274 ],275 "loc": {276 "start": {277 "line": 1,278 "column": 0279 },280 "end": {281 "line": 1,282 "column": 7283 }284 },285 "range": [286 0,287 7288 ]289 }290 ],291 "loc": {292 "start": {293 "line": 1,294 "column": 0295 },296 "end": {297 "line": 1,298 "column": 7299 }300 },301 "range": [302 0,303 7304 ],305 "comments": [],306 "globals": [307 {308 "type": "Identifier",309 "name": "a",310 "loc": {311 "start": {312 "line": 1,313 "column": 0314 },315 "end": {316 "line": 1,317 "column": 1318 }319 },320 "range": [321 0,322 1323 ],324 "isLocal": false325 }326 ]327 }328 },329 {330 "source": "a = (nil)",331 "result": {332 "type": "Chunk",333 "body": [334 {335 "type": "AssignmentStatement",336 "variables": [337 {338 "type": "Identifier",339 "name": "a",340 "loc": {341 "start": {342 "line": 1,343 "column": 0344 },345 "end": {346 "line": 1,347 "column": 1348 }349 },350 "range": [351 0,352 1353 ],354 "isLocal": false355 }356 ],357 "init": [358 {359 "type": "NilLiteral",360 "value": null,361 "raw": "nil",362 "loc": {363 "start": {364 "line": 1,365 "column": 5366 },367 "end": {368 "line": 1,369 "column": 8370 }371 },372 "range": [373 5,374 8375 ]376 }377 ],378 "loc": {379 "start": {380 "line": 1,381 "column": 0382 },383 "end": {384 "line": 1,385 "column": 9386 }387 },388 "range": [389 0,390 9391 ]392 }393 ],394 "loc": {395 "start": {396 "line": 1,397 "column": 0398 },399 "end": {400 "line": 1,401 "column": 9402 }403 },404 "range": [405 0,406 9407 ],408 "comments": [],409 "globals": [410 {411 "type": "Identifier",412 "name": "a",413 "loc": {414 "start": {415 "line": 1,416 "column": 0417 },418 "end": {419 "line": 1,420 "column": 1421 }422 },423 "range": [424 0,425 1426 ],427 "isLocal": false428 }429 ]430 }431 },432 {433 "source": "a = (true)",434 "result": {435 "type": "Chunk",436 "body": [437 {438 "type": "AssignmentStatement",439 "variables": [440 {441 "type": "Identifier",442 "name": "a",443 "loc": {444 "start": {445 "line": 1,446 "column": 0447 },448 "end": {449 "line": 1,450 "column": 1451 }452 },453 "range": [454 0,455 1456 ],457 "isLocal": false458 }459 ],460 "init": [461 {462 "type": "BooleanLiteral",463 "value": true,464 "raw": "true",465 "loc": {466 "start": {467 "line": 1,468 "column": 5469 },470 "end": {471 "line": 1,472 "column": 9473 }474 },475 "range": [476 5,477 9478 ]479 }480 ],481 "loc": {482 "start": {483 "line": 1,484 "column": 0485 },486 "end": {487 "line": 1,488 "column": 10489 }490 },491 "range": [492 0,493 10494 ]495 }496 ],497 "loc": {498 "start": {499 "line": 1,500 "column": 0501 },502 "end": {503 "line": 1,504 "column": 10505 }506 },507 "range": [508 0,509 10510 ],511 "comments": [],512 "globals": [513 {514 "type": "Identifier",515 "name": "a",516 "loc": {517 "start": {518 "line": 1,519 "column": 0520 },521 "end": {522 "line": 1,523 "column": 1524 }525 },526 "range": [527 0,528 1529 ],530 "isLocal": false531 }532 ]533 }534 },535 {536 "source": "a = (1)",537 "result": {538 "type": "Chunk",539 "body": [540 {541 "type": "AssignmentStatement",542 "variables": [543 {544 "type": "Identifier",545 "name": "a",546 "loc": {547 "start": {548 "line": 1,549 "column": 0550 },551 "end": {552 "line": 1,553 "column": 1554 }555 },556 "range": [557 0,558 1559 ],560 "isLocal": false561 }562 ],563 "init": [564 {565 "type": "NumericLiteral",566 "value": 1,567 "raw": "1",568 "loc": {569 "start": {570 "line": 1,571 "column": 5572 },573 "end": {574 "line": 1,575 "column": 6576 }577 },578 "range": [579 5,580 6581 ]582 }583 ],584 "loc": {585 "start": {586 "line": 1,587 "column": 0588 },589 "end": {590 "line": 1,591 "column": 7592 }593 },594 "range": [595 0,596 7597 ]598 }599 ],600 "loc": {601 "start": {602 "line": 1,603 "column": 0604 },605 "end": {606 "line": 1,607 "column": 7608 }609 },610 "range": [611 0,612 7613 ],614 "comments": [],615 "globals": [616 {617 "type": "Identifier",618 "name": "a",619 "loc": {620 "start": {621 "line": 1,622 "column": 0623 },624 "end": {625 "line": 1,626 "column": 1627 }628 },629 "range": [630 0,631 1632 ],633 "isLocal": false634 }635 ]636 }637 },638 {639 "source": "a = (\"foo\")",640 "result": {641 "type": "Chunk",642 "body": [643 {644 "type": "AssignmentStatement",645 "variables": [646 {647 "type": "Identifier",648 "name": "a",649 "loc": {650 "start": {651 "line": 1,652 "column": 0653 },654 "end": {655 "line": 1,656 "column": 1657 }658 },659 "range": [660 0,661 1662 ],663 "isLocal": false664 }665 ],666 "init": [667 {668 "type": "StringLiteral",669 "value": null,670 "raw": "\"foo\"",671 "loc": {672 "start": {673 "line": 1,674 "column": 5675 },676 "end": {677 "line": 1,678 "column": 10679 }680 },681 "range": [682 5,683 10684 ]685 }686 ],687 "loc": {688 "start": {689 "line": 1,690 "column": 0691 },692 "end": {693 "line": 1,694 "column": 11695 }696 },697 "range": [698 0,699 11700 ]701 }702 ],703 "loc": {704 "start": {705 "line": 1,706 "column": 0707 },708 "end": {709 "line": 1,710 "column": 11711 }712 },713 "range": [714 0,715 11716 ],717 "comments": [],718 "globals": [719 {720 "type": "Identifier",721 "name": "a",722 "loc": {723 "start": {724 "line": 1,725 "column": 0726 },727 "end": {728 "line": 1,729 "column": 1730 }731 },732 "range": [733 0,734 1735 ],736 "isLocal": false737 }738 ]739 }740 },741 {742 "source": "a = ([[foo]])",743 "result": {744 "type": "Chunk",745 "body": [746 {747 "type": "AssignmentStatement",748 "variables": [749 {750 "type": "Identifier",751 "name": "a",752 "loc": {753 "start": {754 "line": 1,755 "column": 0756 },757 "end": {758 "line": 1,759 "column": 1760 }761 },762 "range": [763 0,764 1765 ],766 "isLocal": false767 }768 ],769 "init": [770 {771 "type": "StringLiteral",772 "value": null,773 "raw": "[[foo]]",774 "loc": {775 "start": {776 "line": 1,777 "column": 5778 },779 "end": {780 "line": 1,781 "column": 12782 }783 },784 "range": [785 5,786 12787 ]788 }789 ],790 "loc": {791 "start": {792 "line": 1,793 "column": 0794 },795 "end": {796 "line": 1,797 "column": 13798 }799 },800 "range": [801 0,802 13803 ]804 }805 ],806 "loc": {807 "start": {808 "line": 1,809 "column": 0810 },811 "end": {812 "line": 1,813 "column": 13814 }815 },816 "range": [817 0,818 13819 ],820 "comments": [],821 "globals": [822 {823 "type": "Identifier",824 "name": "a",825 "loc": {826 "start": {827 "line": 1,828 "column": 0829 },830 "end": {831 "line": 1,832 "column": 1833 }834 },835 "range": [836 0,837 1838 ],839 "isLocal": false840 }841 ]842 }843 },844 {845 "source": "a = ({})",846 "result": {847 "type": "Chunk",848 "body": [849 {850 "type": "AssignmentStatement",851 "variables": [852 {853 "type": "Identifier",854 "name": "a",855 "loc": {856 "start": {857 "line": 1,858 "column": 0859 },860 "end": {861 "line": 1,862 "column": 1863 }864 },865 "range": [866 0,867 1868 ],869 "isLocal": false870 }871 ],872 "init": [873 {874 "type": "TableConstructorExpression",875 "fields": [],876 "loc": {877 "start": {878 "line": 1,879 "column": 5880 },881 "end": {882 "line": 1,883 "column": 7884 }885 },886 "range": [887 5,888 7889 ]890 }891 ],892 "loc": {893 "start": {894 "line": 1,895 "column": 0896 },897 "end": {898 "line": 1,899 "column": 8900 }901 },902 "range": [903 0,904 8905 ]906 }907 ],908 "loc": {909 "start": {910 "line": 1,911 "column": 0912 },913 "end": {914 "line": 1,915 "column": 8916 }917 },918 "range": [919 0,920 8921 ],922 "comments": [],923 "globals": [924 {925 "type": "Identifier",926 "name": "a",927 "loc": {928 "start": {929 "line": 1,930 "column": 0931 },932 "end": {933 "line": 1,934 "column": 1935 }936 },937 "range": [938 0,939 1940 ],941 "isLocal": false942 }943 ]944 }945 },946 {947 "source": "a = a.b",948 "result": {949 "type": "Chunk",950 "body": [951 {952 "type": "AssignmentStatement",953 "variables": [954 {955 "type": "Identifier",956 "name": "a",957 "loc": {958 "start": {959 "line": 1,960 "column": 0961 },962 "end": {963 "line": 1,964 "column": 1965 }966 },967 "range": [968 0,969 1970 ],971 "isLocal": false972 }973 ],974 "init": [975 {976 "type": "MemberExpression",977 "indexer": ".",978 "identifier": {979 "type": "Identifier",980 "name": "b",981 "loc": {982 "start": {983 "line": 1,984 "column": 6985 },986 "end": {987 "line": 1,988 "column": 7989 }990 },991 "range": [992 6,993 7994 ]995 },996 "base": {997 "type": "Identifier",998 "name": "a",999 "loc": {1000 "start": {1001 "line": 1,1002 "column": 41003 },1004 "end": {1005 "line": 1,1006 "column": 51007 }1008 },1009 "range": [1010 4,1011 51012 ],1013 "isLocal": false1014 },1015 "loc": {1016 "start": {1017 "line": 1,1018 "column": 41019 },1020 "end": {1021 "line": 1,1022 "column": 71023 }1024 },1025 "range": [1026 4,1027 71028 ]1029 }1030 ],1031 "loc": {1032 "start": {1033 "line": 1,1034 "column": 01035 },1036 "end": {1037 "line": 1,1038 "column": 71039 }1040 },1041 "range": [1042 0,1043 71044 ]1045 }1046 ],1047 "loc": {1048 "start": {1049 "line": 1,1050 "column": 01051 },1052 "end": {1053 "line": 1,1054 "column": 71055 }1056 },1057 "range": [1058 0,1059 71060 ],1061 "comments": [],1062 "globals": [1063 {1064 "type": "Identifier",1065 "name": "a",1066 "loc": {1067 "start": {1068 "line": 1,1069 "column": 01070 },1071 "end": {1072 "line": 1,1073 "column": 11074 }1075 },1076 "range": [1077 0,1078 11079 ],1080 "isLocal": false1081 }1082 ]1083 }1084 },1085 {1086 "source": "a = a.b.",1087 "result": "[1:8] <name> expected near '<eof>'"1088 },1089 {1090 "source": "a = a.b.c",1091 "result": {1092 "type": "Chunk",1093 "body": [1094 {1095 "type": "AssignmentStatement",1096 "variables": [1097 {1098 "type": "Identifier",1099 "name": "a",1100 "loc": {1101 "start": {1102 "line": 1,1103 "column": 01104 },1105 "end": {1106 "line": 1,1107 "column": 11108 }1109 },1110 "range": [1111 0,1112 11113 ],1114 "isLocal": false1115 }1116 ],1117 "init": [1118 {1119 "type": "MemberExpression",1120 "indexer": ".",1121 "identifier": {1122 "type": "Identifier",1123 "name": "c",1124 "loc": {1125 "start": {1126 "line": 1,1127 "column": 81128 },1129 "end": {1130 "line": 1,1131 "column": 91132 }1133 },1134 "range": [1135 8,1136 91137 ]1138 },1139 "base": {1140 "type": "MemberExpression",1141 "indexer": ".",1142 "identifier": {1143 "type": "Identifier",1144 "name": "b",1145 "loc": {1146 "start": {1147 "line": 1,1148 "column": 61149 },1150 "end": {1151 "line": 1,1152 "column": 71153 }1154 },1155 "range": [1156 6,1157 71158 ]1159 },1160 "base": {1161 "type": "Identifier",1162 "name": "a",1163 "loc": {1164 "start": {1165 "line": 1,1166 "column": 41167 },1168 "end": {1169 "line": 1,1170 "column": 51171 }1172 },1173 "range": [1174 4,1175 51176 ],1177 "isLocal": false1178 },1179 "loc": {1180 "start": {1181 "line": 1,1182 "column": 41183 },1184 "end": {1185 "line": 1,1186 "column": 71187 }1188 },1189 "range": [1190 4,1191 71192 ]1193 },1194 "loc": {1195 "start": {1196 "line": 1,1197 "column": 41198 },1199 "end": {1200 "line": 1,1201 "column": 91202 }1203 },1204 "range": [1205 4,1206 91207 ]1208 }1209 ],1210 "loc": {1211 "start": {1212 "line": 1,1213 "column": 01214 },1215 "end": {1216 "line": 1,1217 "column": 91218 }1219 },1220 "range": [1221 0,1222 91223 ]1224 }1225 ],1226 "loc": {1227 "start": {1228 "line": 1,1229 "column": 01230 },1231 "end": {1232 "line": 1,1233 "column": 91234 }1235 },1236 "range": [1237 0,1238 91239 ],1240 "comments": [],1241 "globals": [1242 {1243 "type": "Identifier",1244 "name": "a",1245 "loc": {1246 "start": {1247 "line": 1,1248 "column": 01249 },1250 "end": {1251 "line": 1,1252 "column": 11253 }1254 },1255 "range": [1256 0,1257 11258 ],1259 "isLocal": false1260 }1261 ]1262 }1263 },1264 {1265 "source": "a = a:b",1266 "result": "[1:7] function arguments expected near '<eof>'"1267 },1268 {1269 "source": "a = a[]",1270 "result": "[1:6] <expression> expected near ']'"1271 },1272 {1273 "source": "a = a[b]",1274 "result": {1275 "type": "Chunk",1276 "body": [1277 {1278 "type": "AssignmentStatement",1279 "variables": [1280 {1281 "type": "Identifier",1282 "name": "a",1283 "loc": {1284 "start": {1285 "line": 1,1286 "column": 01287 },1288 "end": {1289 "line": 1,1290 "column": 11291 }1292 },1293 "range": [1294 0,1295 11296 ],1297 "isLocal": false1298 }1299 ],1300 "init": [1301 {1302 "type": "IndexExpression",1303 "base": {1304 "type": "Identifier",1305 "name": "a",1306 "loc": {1307 "start": {1308 "line": 1,1309 "column": 41310 },1311 "end": {1312 "line": 1,1313 "column": 51314 }1315 },1316 "range": [1317 4,1318 51319 ],1320 "isLocal": false1321 },1322 "index": {1323 "type": "Identifier",1324 "name": "b",1325 "loc": {1326 "start": {1327 "line": 1,1328 "column": 61329 },1330 "end": {1331 "line": 1,1332 "column": 71333 }1334 },1335 "range": [1336 6,1337 71338 ],1339 "isLocal": false1340 },1341 "loc": {1342 "start": {1343 "line": 1,1344 "column": 41345 },1346 "end": {1347 "line": 1,1348 "column": 81349 }1350 },1351 "range": [1352 4,1353 81354 ]1355 }1356 ],1357 "loc": {1358 "start": {1359 "line": 1,1360 "column": 01361 },1362 "end": {1363 "line": 1,1364 "column": 81365 }1366 },1367 "range": [1368 0,1369 81370 ]1371 }1372 ],1373 "loc": {1374 "start": {1375 "line": 1,1376 "column": 01377 },1378 "end": {1379 "line": 1,1380 "column": 81381 }1382 },1383 "range": [1384 0,1385 81386 ],1387 "comments": [],1388 "globals": [1389 {1390 "type": "Identifier",1391 "name": "a",1392 "loc": {1393 "start": {1394 "line": 1,1395 "column": 01396 },1397 "end": {1398 "line": 1,1399 "column": 11400 }1401 },1402 "range": [1403 0,1404 11405 ],1406 "isLocal": false1407 },1408 {1409 "type": "Identifier",1410 "name": "b",1411 "loc": {1412 "start": {1413 "line": 1,1414 "column": 61415 },1416 "end": {1417 "line": 1,1418 "column": 71419 }1420 },1421 "range": [1422 6,1423 71424 ],1425 "isLocal": false1426 }1427 ]1428 }1429 },1430 {1431 "source": "a = a[1]",1432 "result": {1433 "type": "Chunk",1434 "body": [1435 {1436 "type": "AssignmentStatement",1437 "variables": [1438 {1439 "type": "Identifier",1440 "name": "a",1441 "loc": {1442 "start": {1443 "line": 1,1444 "column": 01445 },1446 "end": {1447 "line": 1,1448 "column": 11449 }1450 },1451 "range": [1452 0,1453 11454 ],1455 "isLocal": false1456 }1457 ],1458 "init": [1459 {1460 "type": "IndexExpression",1461 "base": {1462 "type": "Identifier",1463 "name": "a",1464 "loc": {1465 "start": {1466 "line": 1,1467 "column": 41468 },1469 "end": {1470 "line": 1,1471 "column": 51472 }1473 },1474 "range": [1475 4,1476 51477 ],1478 "isLocal": false1479 },1480 "index": {1481 "type": "NumericLiteral",1482 "value": 1,1483 "raw": "1",1484 "loc": {1485 "start": {1486 "line": 1,1487 "column": 61488 },1489 "end": {1490 "line": 1,1491 "column": 71492 }1493 },1494 "range": [1495 6,1496 71497 ]1498 },1499 "loc": {1500 "start": {1501 "line": 1,1502 "column": 41503 },1504 "end": {1505 "line": 1,1506 "column": 81507 }1508 },1509 "range": [1510 4,1511 81512 ]1513 }1514 ],1515 "loc": {1516 "start": {1517 "line": 1,1518 "column": 01519 },1520 "end": {1521 "line": 1,1522 "column": 81523 }1524 },1525 "range": [1526 0,1527 81528 ]1529 }1530 ],1531 "loc": {1532 "start": {1533 "line": 1,1534 "column": 01535 },1536 "end": {1537 "line": 1,1538 "column": 81539 }1540 },1541 "range": [1542 0,1543 81544 ],1545 "comments": [],1546 "globals": [1547 {1548 "type": "Identifier",1549 "name": "a",1550 "loc": {1551 "start": {1552 "line": 1,1553 "column": 01554 },1555 "end": {1556 "line": 1,1557 "column": 11558 }1559 },1560 "range": [1561 0,1562 11563 ],1564 "isLocal": false1565 }1566 ]1567 }1568 },1569 {1570 "source": "a = a[\"foo\"]",1571 "result": {1572 "type": "Chunk",1573 "body": [1574 {1575 "type": "AssignmentStatement",1576 "variables": [1577 {1578 "type": "Identifier",1579 "name": "a",1580 "loc": {1581 "start": {1582 "line": 1,1583 "column": 01584 },1585 "end": {1586 "line": 1,1587 "column": 11588 }1589 },1590 "range": [1591 0,1592 11593 ],1594 "isLocal": false1595 }1596 ],1597 "init": [1598 {1599 "type": "IndexExpression",1600 "base": {1601 "type": "Identifier",1602 "name": "a",1603 "loc": {1604 "start": {1605 "line": 1,1606 "column": 41607 },1608 "end": {1609 "line": 1,1610 "column": 51611 }1612 },1613 "range": [1614 4,1615 51616 ],1617 "isLocal": false1618 },1619 "index": {1620 "type": "StringLiteral",1621 "value": null,1622 "raw": "\"foo\"",1623 "loc": {1624 "start": {1625 "line": 1,1626 "column": 61627 },1628 "end": {1629 "line": 1,1630 "column": 111631 }1632 },1633 "range": [1634 6,1635 111636 ]1637 },1638 "loc": {1639 "start": {1640 "line": 1,1641 "column": 41642 },1643 "end": {1644 "line": 1,1645 "column": 121646 }1647 },1648 "range": [1649 4,1650 121651 ]1652 }1653 ],1654 "loc": {1655 "start": {1656 "line": 1,1657 "column": 01658 },1659 "end": {1660 "line": 1,1661 "column": 121662 }1663 },1664 "range": [1665 0,1666 121667 ]1668 }1669 ],1670 "loc": {1671 "start": {1672 "line": 1,1673 "column": 01674 },1675 "end": {1676 "line": 1,1677 "column": 121678 }1679 },1680 "range": [1681 0,1682 121683 ],1684 "comments": [],1685 "globals": [1686 {1687 "type": "Identifier",1688 "name": "a",1689 "loc": {1690 "start": {1691 "line": 1,1692 "column": 01693 },1694 "end": {1695 "line": 1,1696 "column": 11697 }1698 },1699 "range": [1700 0,1701 11702 ],1703 "isLocal": false1704 }1705 ]1706 }1707 },1708 {1709 "source": "a = ()",1710 "result": "[1:5] <expression> expected near ')'"1711 },1712 {1713 "source": "a = function",1714 "result": "[1:12] '(' expected near '<eof>'"1715 },1716 {1717 "source": "a = function 1",1718 "result": "[1:13] '(' expected near '1'"1719 },1720 {1721 "source": "a = function a",1722 "result": "[1:13] '(' expected near 'a'"1723 },1724 {1725 "source": "a = function end",1726 "result": "[1:13] '(' expected near 'end'"1727 },1728 {1729 "source": "a = function(",1730 "result": "[1:13] <name> or '...' expected near '<eof>'"1731 },1732 {1733 "source": "a = function() end",1734 "result": {1735 "type": "Chunk",1736 "body": [1737 {1738 "type": "AssignmentStatement",1739 "variables": [1740 {1741 "type": "Identifier",1742 "name": "a",1743 "loc": {1744 "start": {1745 "line": 1,1746 "column": 01747 },1748 "end": {1749 "line": 1,1750 "column": 11751 }1752 },1753 "range": [1754 0,1755 11756 ],1757 "isLocal": false1758 }1759 ],1760 "init": [1761 {1762 "type": "FunctionDeclaration",1763 "identifier": null,1764 "isLocal": false,1765 "parameters": [],1766 "body": [],1767 "loc": {1768 "start": {1769 "line": 1,1770 "column": 41771 },1772 "end": {1773 "line": 1,1774 "column": 181775 }1776 },1777 "range": [1778 4,1779 181780 ]1781 }1782 ],1783 "loc": {1784 "start": {1785 "line": 1,1786 "column": 01787 },1788 "end": {1789 "line": 1,1790 "column": 181791 }1792 },1793 "range": [1794 0,1795 181796 ]1797 }1798 ],1799 "loc": {1800 "start": {1801 "line": 1,1802 "column": 01803 },1804 "end": {1805 "line": 1,1806 "column": 181807 }1808 },1809 "range": [1810 0,1811 181812 ],1813 "comments": [],1814 "globals": [1815 {1816 "type": "Identifier",1817 "name": "a",1818 "loc": {1819 "start": {1820 "line": 1,1821 "column": 01822 },1823 "end": {1824 "line": 1,1825 "column": 11826 }1827 },1828 "range": [1829 0,1830 11831 ],1832 "isLocal": false1833 }1834 ]1835 }1836 },1837 {1838 "source": "a = function(1",1839 "result": "[1:13] <name> or '...' expected near '1'"1840 },1841 {1842 "source": "a = function(p) end",1843 "result": {1844 "type": "Chunk",1845 "body": [1846 {1847 "type": "AssignmentStatement",1848 "variables": [1849 {1850 "type": "Identifier",1851 "name": "a",1852 "loc": {1853 "start": {1854 "line": 1,1855 "column": 01856 },1857 "end": {1858 "line": 1,1859 "column": 11860 }1861 },1862 "range": [1863 0,1864 11865 ],1866 "isLocal": false1867 }1868 ],1869 "init": [1870 {1871 "type": "FunctionDeclaration",1872 "identifier": null,1873 "isLocal": false,1874 "parameters": [1875 {1876 "type": "Identifier",1877 "name": "p",1878 "loc": {1879 "start": {1880 "line": 1,1881 "column": 131882 },1883 "end": {1884 "line": 1,1885 "column": 141886 }1887 },1888 "range": [1889 13,1890 141891 ],1892 "isLocal": true1893 }1894 ],1895 "body": [],1896 "loc": {1897 "start": {1898 "line": 1,1899 "column": 41900 },1901 "end": {1902 "line": 1,1903 "column": 191904 }1905 },1906 "range": [1907 4,1908 191909 ]1910 }1911 ],1912 "loc": {1913 "start": {1914 "line": 1,1915 "column": 01916 },1917 "end": {1918 "line": 1,1919 "column": 191920 }1921 },1922 "range": [1923 0,1924 191925 ]1926 }1927 ],1928 "loc": {1929 "start": {1930 "line": 1,1931 "column": 01932 },1933 "end": {1934 "line": 1,1935 "column": 191936 }1937 },1938 "range": [1939 0,1940 191941 ],1942 "comments": [],1943 "globals": [1944 {1945 "type": "Identifier",1946 "name": "a",1947 "loc": {1948 "start": {1949 "line": 1,1950 "column": 01951 },1952 "end": {1953 "line": 1,1954 "column": 11955 }1956 },1957 "range": [1958 0,1959 11960 ],1961 "isLocal": false1962 }1963 ]1964 }1965 },1966 {1967 "source": "a = function(p,q) end",1968 "result": {1969 "type": "Chunk",1970 "body": [1971 {1972 "type": "AssignmentStatement",1973 "variables": [1974 {1975 "type": "Identifier",1976 "name": "a",1977 "loc": {1978 "start": {1979 "line": 1,1980 "column": 01981 },1982 "end": {1983 "line": 1,1984 "column": 11985 }1986 },1987 "range": [1988 0,1989 11990 ],1991 "isLocal": false1992 }1993 ],1994 "init": [1995 {1996 "type": "FunctionDeclaration",1997 "identifier": null,1998 "isLocal": false,1999 "parameters": [2000 {2001 "type": "Identifier",2002 "name": "p",2003 "loc": {2004 "start": {2005 "line": 1,2006 "column": 132007 },2008 "end": {2009 "line": 1,2010 "column": 142011 }2012 },2013 "range": [2014 13,2015 142016 ],2017 "isLocal": true2018 },2019 {2020 "type": "Identifier",2021 "name": "q",2022 "loc": {2023 "start": {2024 "line": 1,2025 "column": 152026 },2027 "end": {2028 "line": 1,2029 "column": 162030 }2031 },2032 "range": [2033 15,2034 162035 ],2036 "isLocal": true2037 }2038 ],2039 "body": [],2040 "loc": {2041 "start": {2042 "line": 1,2043 "column": 42044 },2045 "end": {2046 "line": 1,2047 "column": 212048 }2049 },2050 "range": [2051 4,2052 212053 ]2054 }2055 ],2056 "loc": {2057 "start": {2058 "line": 1,2059 "column": 02060 },2061 "end": {2062 "line": 1,2063 "column": 212064 }2065 },2066 "range": [2067 0,2068 212069 ]2070 }2071 ],2072 "loc": {2073 "start": {2074 "line": 1,2075 "column": 02076 },2077 "end": {2078 "line": 1,2079 "column": 212080 }2081 },2082 "range": [2083 0,2084 212085 ],2086 "comments": [],2087 "globals": [2088 {2089 "type": "Identifier",2090 "name": "a",2091 "loc": {2092 "start": {2093 "line": 1,2094 "column": 02095 },2096 "end": {2097 "line": 1,2098 "column": 12099 }2100 },2101 "range": [2102 0,2103 12104 ],2105 "isLocal": false2106 }2107 ]2108 }2109 },2110 {2111 "source": "a = function(p q) end",2112 "result": "[1:15] ')' expected near 'q'"2113 },2114 {2115 "source": "a = function(p,)",2116 "result": "[1:15] <name> or '...' expected near ')'"2117 },2118 {2119 "source": "a = function(p q",2120 "result": "[1:15] ')' expected near 'q'"2121 },2122 {2123 "source": "a = function(p,q,r) end",2124 "result": {2125 "type": "Chunk",2126 "body": [2127 {2128 "type": "AssignmentStatement",2129 "variables": [2130 {2131 "type": "Identifier",2132 "name": "a",2133 "loc": {2134 "start": {2135 "line": 1,2136 "column": 02137 },2138 "end": {2139 "line": 1,2140 "column": 12141 }2142 },2143 "range": [2144 0,2145 12146 ],2147 "isLocal": false2148 }2149 ],2150 "init": [2151 {2152 "type": "FunctionDeclaration",2153 "identifier": null,2154 "isLocal": false,2155 "parameters": [2156 {2157 "type": "Identifier",2158 "name": "p",2159 "loc": {2160 "start": {2161 "line": 1,2162 "column": 132163 },2164 "end": {2165 "line": 1,2166 "column": 142167 }2168 },2169 "range": [2170 13,2171 142172 ],2173 "isLocal": true2174 },2175 {2176 "type": "Identifier",2177 "name": "q",2178 "loc": {2179 "start": {2180 "line": 1,2181 "column": 152182 },2183 "end": {2184 "line": 1,2185 "column": 162186 }2187 },2188 "range": [2189 15,2190 162191 ],2192 "isLocal": true2193 },2194 {2195 "type": "Identifier",2196 "name": "r",2197 "loc": {2198 "start": {2199 "line": 1,2200 "column": 172201 },2202 "end": {2203 "line": 1,2204 "column": 182205 }2206 },2207 "range": [2208 17,2209 182210 ],2211 "isLocal": true2212 }2213 ],2214 "body": [],2215 "loc": {2216 "start": {2217 "line": 1,2218 "column": 42219 },2220 "end": {2221 "line": 1,2222 "column": 232223 }2224 },2225 "range": [2226 4,2227 232228 ]2229 }2230 ],2231 "loc": {2232 "start": {2233 "line": 1,2234 "column": 02235 },2236 "end": {2237 "line": 1,2238 "column": 232239 }2240 },2241 "range": [2242 0,2243 232244 ]2245 }2246 ],2247 "loc": {2248 "start": {2249 "line": 1,2250 "column": 02251 },2252 "end": {2253 "line": 1,2254 "column": 232255 }2256 },2257 "range": [2258 0,2259 232260 ],2261 "comments": [],2262 "globals": [2263 {2264 "type": "Identifier",2265 "name": "a",2266 "loc": {2267 "start": {2268 "line": 1,2269 "column": 02270 },2271 "end": {2272 "line": 1,2273 "column": 12274 }2275 },2276 "range": [2277 0,2278 12279 ],2280 "isLocal": false2281 }2282 ]2283 }2284 },2285 {2286 "source": "a = function(p,q,1",2287 "result": "[1:17] <name> or '...' expected near '1'"2288 },2289 {2290 "source": "a = function(...) end",2291 "result": {2292 "type": "Chunk",2293 "body": [2294 {2295 "type": "AssignmentStatement",2296 "variables": [2297 {2298 "type": "Identifier",2299 "name": "a",2300 "loc": {2301 "start": {2302 "line": 1,2303 "column": 02304 },2305 "end": {2306 "line": 1,2307 "column": 12308 }2309 },2310 "range": [2311 0,2312 12313 ],2314 "isLocal": false2315 }2316 ],2317 "init": [2318 {2319 "type": "FunctionDeclaration",2320 "identifier": null,2321 "isLocal": false,2322 "parameters": [2323 {2324 "type": "VarargLiteral",2325 "value": "...",2326 "raw": "...",2327 "loc": {2328 "start": {2329 "line": 1,2330 "column": 132331 },2332 "end": {2333 "line": 1,2334 "column": 162335 }2336 },2337 "range": [2338 13,2339 162340 ]2341 }2342 ],2343 "body": [],2344 "loc": {2345 "start": {2346 "line": 1,2347 "column": 42348 },2349 "end": {2350 "line": 1,2351 "column": 212352 }2353 },2354 "range": [2355 4,2356 212357 ]2358 }2359 ],2360 "loc": {2361 "start": {2362 "line": 1,2363 "column": 02364 },2365 "end": {2366 "line": 1,2367 "column": 212368 }2369 },2370 "range": [2371 0,2372 212373 ]2374 }2375 ],2376 "loc": {2377 "start": {2378 "line": 1,2379 "column": 02380 },2381 "end": {2382 "line": 1,2383 "column": 212384 }2385 },2386 "range": [2387 0,2388 212389 ],2390 "comments": [],2391 "globals": [2392 {2393 "type": "Identifier",2394 "name": "a",2395 "loc": {2396 "start": {2397 "line": 1,2398 "column": 02399 },2400 "end": {2401 "line": 1,2402 "column": 12403 }2404 },2405 "range": [2406 0,2407 12408 ],2409 "isLocal": false2410 }2411 ]2412 }2413 },2414 {2415 "source": "a = function(...,",2416 "result": "[1:16] ')' expected near ','"2417 },2418 {2419 "source": "a = function(p,...) end",2420 "result": {2421 "type": "Chunk",2422 "body": [2423 {2424 "type": "AssignmentStatement",2425 "variables": [2426 {2427 "type": "Identifier",2428 "name": "a",2429 "loc": {2430 "start": {2431 "line": 1,2432 "column": 02433 },2434 "end": {2435 "line": 1,2436 "column": 12437 }2438 },2439 "range": [2440 0,2441 12442 ],2443 "isLocal": false2444 }2445 ],2446 "init": [2447 {2448 "type": "FunctionDeclaration",2449 "identifier": null,2450 "isLocal": false,2451 "parameters": [2452 {2453 "type": "Identifier",2454 "name": "p",2455 "loc": {2456 "start": {2457 "line": 1,2458 "column": 132459 },2460 "end": {2461 "line": 1,2462 "column": 142463 }2464 },2465 "range": [2466 13,2467 142468 ],2469 "isLocal": true2470 },2471 {2472 "type": "VarargLiteral",2473 "value": "...",2474 "raw": "...",2475 "loc": {2476 "start": {2477 "line": 1,2478 "column": 152479 },2480 "end": {2481 "line": 1,2482 "column": 182483 }2484 },2485 "range": [2486 15,2487 182488 ]2489 }2490 ],2491 "body": [],2492 "loc": {2493 "start": {2494 "line": 1,2495 "column": 42496 },2497 "end": {2498 "line": 1,2499 "column": 232500 }2501 },2502 "range": [2503 4,2504 232505 ]2506 }2507 ],2508 "loc": {2509 "start": {2510 "line": 1,2511 "column": 02512 },2513 "end": {2514 "line": 1,2515 "column": 232516 }2517 },2518 "range": [2519 0,2520 232521 ]2522 }2523 ],2524 "loc": {2525 "start": {2526 "line": 1,2527 "column": 02528 },2529 "end": {2530 "line": 1,2531 "column": 232532 }2533 },2534 "range": [2535 0,2536 232537 ],2538 "comments": [],2539 "globals": [2540 {2541 "type": "Identifier",2542 "name": "a",2543 "loc": {2544 "start": {2545 "line": 1,2546 "column": 02547 },2548 "end": {2549 "line": 1,2550 "column": 12551 }2552 },2553 "range": [2554 0,2555 12556 ],2557 "isLocal": false2558 }2559 ]2560 }2561 },2562 {2563 "source": "a = function(p,q,r,...) end",2564 "result": {2565 "type": "Chunk",2566 "body": [2567 {2568 "type": "AssignmentStatement",2569 "variables": [2570 {2571 "type": "Identifier",2572 "name": "a",2573 "loc": {2574 "start": {2575 "line": 1,2576 "column": 02577 },2578 "end": {2579 "line": 1,2580 "column": 12581 }2582 },2583 "range": [2584 0,2585 12586 ],2587 "isLocal": false2588 }2589 ],2590 "init": [2591 {2592 "type": "FunctionDeclaration",2593 "identifier": null,2594 "isLocal": false,2595 "parameters": [2596 {2597 "type": "Identifier",2598 "name": "p",2599 "loc": {2600 "start": {2601 "line": 1,2602 "column": 132603 },2604 "end": {2605 "line": 1,2606 "column": 142607 }2608 },2609 "range": [2610 13,2611 142612 ],2613 "isLocal": true2614 },2615 {2616 "type": "Identifier",2617 "name": "q",2618 "loc": {2619 "start": {2620 "line": 1,2621 "column": 152622 },2623 "end": {2624 "line": 1,2625 "column": 162626 }2627 },2628 "range": [2629 15,2630 162631 ],2632 "isLocal": true2633 },2634 {2635 "type": "Identifier",2636 "name": "r",2637 "loc": {2638 "start": {2639 "line": 1,2640 "column": 172641 },2642 "end": {2643 "line": 1,2644 "column": 182645 }2646 },2647 "range": [2648 17,2649 182650 ],2651 "isLocal": true2652 },2653 {2654 "type": "VarargLiteral",2655 "value": "...",2656 "raw": "...",2657 "loc": {2658 "start": {2659 "line": 1,2660 "column": 192661 },2662 "end": {2663 "line": 1,2664 "column": 222665 }2666 },2667 "range": [2668 19,2669 222670 ]2671 }2672 ],2673 "body": [],2674 "loc": {2675 "start": {2676 "line": 1,2677 "column": 42678 },2679 "end": {2680 "line": 1,2681 "column": 272682 }2683 },2684 "range": [2685 4,2686 272687 ]2688 }2689 ],2690 "loc": {2691 "start": {2692 "line": 1,2693 "column": 02694 },2695 "end": {2696 "line": 1,2697 "column": 272698 }2699 },2700 "range": [2701 0,2702 272703 ]2704 }2705 ],2706 "loc": {2707 "start": {2708 "line": 1,2709 "column": 02710 },2711 "end": {2712 "line": 1,2713 "column": 272714 }2715 },2716 "range": [2717 0,2718 272719 ],2720 "comments": [],2721 "globals": [2722 {2723 "type": "Identifier",2724 "name": "a",2725 "loc": {2726 "start": {2727 "line": 1,2728 "column": 02729 },2730 "end": {2731 "line": 1,2732 "column": 12733 }2734 },2735 "range": [2736 0,2737 12738 ],2739 "isLocal": false2740 }2741 ]2742 }2743 },2744 {2745 "source": "a = {'-'}",2746 "result": {2747 "type": "Chunk",2748 "body": [2749 {2750 "type": "AssignmentStatement",2751 "variables": [2752 {2753 "type": "Identifier",2754 "name": "a",2755 "loc": {2756 "start": {2757 "line": 1,2758 "column": 02759 },2760 "end": {2761 "line": 1,2762 "column": 12763 }2764 },2765 "range": [2766 0,2767 12768 ],2769 "isLocal": false2770 }2771 ],2772 "init": [2773 {2774 "type": "TableConstructorExpression",2775 "fields": [2776 {2777 "type": "TableValue",2778 "value": {2779 "type": "StringLiteral",2780 "value": null,2781 "raw": "'-'",2782 "loc": {2783 "start": {2784 "line": 1,2785 "column": 52786 },2787 "end": {2788 "line": 1,2789 "column": 82790 }2791 },2792 "range": [2793 5,2794 82795 ]2796 },2797 "loc": {2798 "start": {2799 "line": 1,2800 "column": 52801 },2802 "end": {2803 "line": 1,2804 "column": 82805 }2806 },2807 "range": [2808 5,2809 82810 ]2811 }2812 ],2813 "loc": {2814 "start": {2815 "line": 1,2816 "column": 42817 },2818 "end": {2819 "line": 1,2820 "column": 92821 }2822 },2823 "range": [2824 4,2825 92826 ]2827 }2828 ],2829 "loc": {2830 "start": {2831 "line": 1,2832 "column": 02833 },2834 "end": {2835 "line": 1,2836 "column": 92837 }2838 },2839 "range": [2840 0,2841 92842 ]2843 }2844 ],2845 "loc": {2846 "start": {2847 "line": 1,2848 "column": 02849 },2850 "end": {2851 "line": 1,2852 "column": 92853 }2854 },2855 "range": [2856 0,2857 92858 ],2859 "comments": [],2860 "globals": [2861 {2862 "type": "Identifier",2863 "name": "a",2864 "loc": {2865 "start": {2866 "line": 1,2867 "column": 02868 },2869 "end": {2870 "line": 1,2871 "column": 12872 }2873 },2874 "range": [2875 0,2876 12877 ],2878 "isLocal": false2879 }2880 ]2881 }2882 },2883 {2884 "source": "a = {'not'}",2885 "result": {2886 "type": "Chunk",2887 "body": [2888 {2889 "type": "AssignmentStatement",2890 "variables": [2891 {2892 "type": "Identifier",2893 "name": "a",2894 "loc": {2895 "start": {2896 "line": 1,2897 "column": 02898 },2899 "end": {2900 "line": 1,2901 "column": 12902 }2903 },2904 "range": [2905 0,2906 12907 ],2908 "isLocal": false2909 }2910 ],2911 "init": [2912 {2913 "type": "TableConstructorExpression",2914 "fields": [2915 {2916 "type": "TableValue",2917 "value": {2918 "type": "StringLiteral",2919 "value": null,2920 "raw": "'not'",2921 "loc": {2922 "start": {2923 "line": 1,2924 "column": 52925 },2926 "end": {2927 "line": 1,2928 "column": 102929 }2930 },2931 "range": [2932 5,2933 102934 ]2935 },2936 "loc": {2937 "start": {2938 "line": 1,2939 "column": 52940 },2941 "end": {2942 "line": 1,2943 "column": 102944 }2945 },2946 "range": [2947 5,2948 102949 ]2950 }2951 ],2952 "loc": {2953 "start": {2954 "line": 1,2955 "column": 42956 },2957 "end": {2958 "line": 1,2959 "column": 112960 }2961 },2962 "range": [2963 4,2964 112965 ]2966 }2967 ],2968 "loc": {2969 "start": {2970 "line": 1,2971 "column": 02972 },2973 "end": {2974 "line": 1,2975 "column": 112976 }2977 },2978 "range": [2979 0,2980 112981 ]2982 }2983 ],2984 "loc": {2985 "start": {2986 "line": 1,2987 "column": 02988 },2989 "end": {2990 "line": 1,2991 "column": 112992 }2993 },2994 "range": [2995 0,2996 112997 ],2998 "comments": [],2999 "globals": [3000 {3001 "type": "Identifier",3002 "name": "a",3003 "loc": {3004 "start": {3005 "line": 1,3006 "column": 03007 },3008 "end": {3009 "line": 1,3010 "column": 13011 }3012 },3013 "range": [3014 0,3015 13016 ],3017 "isLocal": false3018 }3019 ]3020 }3021 },3022 {3023 "source": "a = {not true}",3024 "result": {3025 "type": "Chunk",3026 "body": [3027 {3028 "type": "AssignmentStatement",3029 "variables": [3030 {3031 "type": "Identifier",3032 "name": "a",3033 "loc": {3034 "start": {3035 "line": 1,3036 "column": 03037 },3038 "end": {3039 "line": 1,3040 "column": 13041 }3042 },3043 "range": [3044 0,3045 13046 ],3047 "isLocal": false3048 }3049 ],3050 "init": [3051 {3052 "type": "TableConstructorExpression",3053 "fields": [3054 {3055 "type": "TableValue",3056 "value": {3057 "type": "UnaryExpression",3058 "operator": "not",3059 "argument": {3060 "type": "BooleanLiteral",3061 "value": true,3062 "raw": "true",3063 "loc": {3064 "start": {3065 "line": 1,3066 "column": 93067 },3068 "end": {3069 "line": 1,3070 "column": 133071 }3072 },3073 "range": [3074 9,3075 133076 ]3077 },3078 "loc": {3079 "start": {3080 "line": 1,3081 "column": 53082 },3083 "end": {3084 "line": 1,3085 "column": 133086 }3087 },3088 "range": [3089 5,3090 133091 ]3092 },3093 "loc": {3094 "start": {3095 "line": 1,3096 "column": 53097 },3098 "end": {3099 "line": 1,3100 "column": 133101 }3102 },3103 "range": [3104 5,3105 133106 ]3107 }3108 ],3109 "loc": {3110 "start": {3111 "line": 1,3112 "column": 43113 },3114 "end": {3115 "line": 1,3116 "column": 143117 }3118 },3119 "range": [3120 4,3121 143122 ]3123 }3124 ],3125 "loc": {3126 "start": {3127 "line": 1,3128 "column": 03129 },3130 "end": {3131 "line": 1,3132 "column": 143133 }3134 },3135 "range": [3136 0,3137 143138 ]3139 }3140 ],3141 "loc": {3142 "start": {3143 "line": 1,3144 "column": 03145 },3146 "end": {3147 "line": 1,3148 "column": 143149 }3150 },3151 "range": [3152 0,3153 143154 ],3155 "comments": [],3156 "globals": [3157 {3158 "type": "Identifier",3159 "name": "a",3160 "loc": {3161 "start": {3162 "line": 1,3163 "column": 03164 },3165 "end": {3166 "line": 1,3167 "column": 13168 }3169 },3170 "range": [3171 0,3172 13173 ],3174 "isLocal": false3175 }3176 ]3177 }3178 }3179 ];...
functions.js
Source:functions.js
1(function (root, name, factory) {2 'use strict';3 var freeExports = typeof exports === 'object' && exports4 , freeModule = typeof module === 'object' && module && module.exports === freeExports && module5 , freeGlobal = typeof global === 'object' && global;6 if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) root = freeGlobal;7 if (typeof define === 'function' && define.amd) define(['exports'], factory);8 else if (freeExports && !freeExports.nodeType) {9 if (freeModule) factory(freeModule.exports);10 else factory(freeExports);11 }12 else factory((root[name] = {}));13}(this, 'functions', function (exports) {14 'use strict';15 exports.name = 'functions';16 exports.spec = [17 {18 "source": "function",19 "result": "[1:8] <name> expected near '<eof>'"20 },21 {22 "source": "function 1",23 "result": "[1:9] <name> expected near '1'"24 },25 {26 "source": "function end",27 "result": "[1:9] <name> expected near 'end'"28 },29 {30 "source": "function a",31 "result": "[1:10] '(' expected near '<eof>'"32 },33 {34 "source": "function a end",35 "result": "[1:11] '(' expected near 'end'"36 },37 {38 "source": "function a( end",39 "result": "[1:12] <name> or '...' expected near 'end'"40 },41 {42 "source": "function a() end",43 "result": {44 "type": "Chunk",45 "body": [46 {47 "type": "FunctionDeclaration",48 "identifier": {49 "type": "Identifier",50 "name": "a",51 "loc": {52 "start": {53 "line": 1,54 "column": 955 },56 "end": {57 "line": 1,58 "column": 1059 }60 },61 "range": [62 9,63 1064 ],65 "isLocal": false66 },67 "isLocal": false,68 "parameters": [],69 "body": [],70 "loc": {71 "start": {72 "line": 1,73 "column": 074 },75 "end": {76 "line": 1,77 "column": 1678 }79 },80 "range": [81 0,82 1683 ]84 }85 ],86 "loc": {87 "start": {88 "line": 1,89 "column": 090 },91 "end": {92 "line": 1,93 "column": 1694 }95 },96 "range": [97 0,98 1699 ],100 "comments": [],101 "globals": [102 {103 "type": "Identifier",104 "name": "a",105 "loc": {106 "start": {107 "line": 1,108 "column": 9109 },110 "end": {111 "line": 1,112 "column": 10113 }114 },115 "range": [116 9,117 10118 ],119 "isLocal": false120 }121 ]122 }123 },124 {125 "source": "function a(1",126 "result": "[1:11] <name> or '...' expected near '1'"127 },128 {129 "source": "function a(\"foo\"",130 "result": "[1:11] <name> or '...' expected near '\"foo\"'"131 },132 {133 "source": "function a(p",134 "result": "[1:12] ')' expected near '<eof>'"135 },136 {137 "source": "function a(p,)",138 "result": "[1:13] <name> or '...' expected near ')'"139 },140 {141 "source": "function a(p q",142 "result": "[1:13] ')' expected near 'q'"143 },144 {145 "source": "function a(p) end",146 "result": {147 "type": "Chunk",148 "body": [149 {150 "type": "FunctionDeclaration",151 "identifier": {152 "type": "Identifier",153 "name": "a",154 "loc": {155 "start": {156 "line": 1,157 "column": 9158 },159 "end": {160 "line": 1,161 "column": 10162 }163 },164 "range": [165 9,166 10167 ],168 "isLocal": false169 },170 "isLocal": false,171 "parameters": [172 {173 "type": "Identifier",174 "name": "p",175 "loc": {176 "start": {177 "line": 1,178 "column": 11179 },180 "end": {181 "line": 1,182 "column": 12183 }184 },185 "range": [186 11,187 12188 ],189 "isLocal": true190 }191 ],192 "body": [],193 "loc": {194 "start": {195 "line": 1,196 "column": 0197 },198 "end": {199 "line": 1,200 "column": 17201 }202 },203 "range": [204 0,205 17206 ]207 }208 ],209 "loc": {210 "start": {211 "line": 1,212 "column": 0213 },214 "end": {215 "line": 1,216 "column": 17217 }218 },219 "range": [220 0,221 17222 ],223 "comments": [],224 "globals": [225 {226 "type": "Identifier",227 "name": "a",228 "loc": {229 "start": {230 "line": 1,231 "column": 9232 },233 "end": {234 "line": 1,235 "column": 10236 }237 },238 "range": [239 9,240 10241 ],242 "isLocal": false243 }244 ]245 }246 },247 {248 "source": "function a(p,q) end",249 "result": {250 "type": "Chunk",251 "body": [252 {253 "type": "FunctionDeclaration",254 "identifier": {255 "type": "Identifier",256 "name": "a",257 "loc": {258 "start": {259 "line": 1,260 "column": 9261 },262 "end": {263 "line": 1,264 "column": 10265 }266 },267 "range": [268 9,269 10270 ],271 "isLocal": false272 },273 "isLocal": false,274 "parameters": [275 {276 "type": "Identifier",277 "name": "p",278 "loc": {279 "start": {280 "line": 1,281 "column": 11282 },283 "end": {284 "line": 1,285 "column": 12286 }287 },288 "range": [289 11,290 12291 ],292 "isLocal": true293 },294 {295 "type": "Identifier",296 "name": "q",297 "loc": {298 "start": {299 "line": 1,300 "column": 13301 },302 "end": {303 "line": 1,304 "column": 14305 }306 },307 "range": [308 13,309 14310 ],311 "isLocal": true312 }313 ],314 "body": [],315 "loc": {316 "start": {317 "line": 1,318 "column": 0319 },320 "end": {321 "line": 1,322 "column": 19323 }324 },325 "range": [326 0,327 19328 ]329 }330 ],331 "loc": {332 "start": {333 "line": 1,334 "column": 0335 },336 "end": {337 "line": 1,338 "column": 19339 }340 },341 "range": [342 0,343 19344 ],345 "comments": [],346 "globals": [347 {348 "type": "Identifier",349 "name": "a",350 "loc": {351 "start": {352 "line": 1,353 "column": 9354 },355 "end": {356 "line": 1,357 "column": 10358 }359 },360 "range": [361 9,362 10363 ],364 "isLocal": false365 }366 ]367 }368 },369 {370 "source": "function a(p q) end",371 "result": "[1:13] ')' expected near 'q'"372 },373 {374 "source": "function a(p,q,) end",375 "result": "[1:15] <name> or '...' expected near ')'"376 },377 {378 "source": "function a(p,q,r) end",379 "result": {380 "type": "Chunk",381 "body": [382 {383 "type": "FunctionDeclaration",384 "identifier": {385 "type": "Identifier",386 "name": "a",387 "loc": {388 "start": {389 "line": 1,390 "column": 9391 },392 "end": {393 "line": 1,394 "column": 10395 }396 },397 "range": [398 9,399 10400 ],401 "isLocal": false402 },403 "isLocal": false,404 "parameters": [405 {406 "type": "Identifier",407 "name": "p",408 "loc": {409 "start": {410 "line": 1,411 "column": 11412 },413 "end": {414 "line": 1,415 "column": 12416 }417 },418 "range": [419 11,420 12421 ],422 "isLocal": true423 },424 {425 "type": "Identifier",426 "name": "q",427 "loc": {428 "start": {429 "line": 1,430 "column": 13431 },432 "end": {433 "line": 1,434 "column": 14435 }436 },437 "range": [438 13,439 14440 ],441 "isLocal": true442 },443 {444 "type": "Identifier",445 "name": "r",446 "loc": {447 "start": {448 "line": 1,449 "column": 15450 },451 "end": {452 "line": 1,453 "column": 16454 }455 },456 "range": [457 15,458 16459 ],460 "isLocal": true461 }462 ],463 "body": [],464 "loc": {465 "start": {466 "line": 1,467 "column": 0468 },469 "end": {470 "line": 1,471 "column": 21472 }473 },474 "range": [475 0,476 21477 ]478 }479 ],480 "loc": {481 "start": {482 "line": 1,483 "column": 0484 },485 "end": {486 "line": 1,487 "column": 21488 }489 },490 "range": [491 0,492 21493 ],494 "comments": [],495 "globals": [496 {497 "type": "Identifier",498 "name": "a",499 "loc": {500 "start": {501 "line": 1,502 "column": 9503 },504 "end": {505 "line": 1,506 "column": 10507 }508 },509 "range": [510 9,511 10512 ],513 "isLocal": false514 }515 ]516 }517 },518 {519 "source": "function a(p,q,1",520 "result": "[1:15] <name> or '...' expected near '1'"521 },522 {523 "source": "function a(p) do",524 "result": "[1:16] 'end' expected near '<eof>'"525 },526 {527 "source": "function a(p) 1 end",528 "result": "[1:14] unexpected number '1' near 'end'"529 },530 {531 "source": "function a(p) return end",532 "result": {533 "type": "Chunk",534 "body": [535 {536 "type": "FunctionDeclaration",537 "identifier": {538 "type": "Identifier",539 "name": "a",540 "loc": {541 "start": {542 "line": 1,543 "column": 9544 },545 "end": {546 "line": 1,547 "column": 10548 }549 },550 "range": [551 9,552 10553 ],554 "isLocal": false555 },556 "isLocal": false,557 "parameters": [558 {559 "type": "Identifier",560 "name": "p",561 "loc": {562 "start": {563 "line": 1,564 "column": 11565 },566 "end": {567 "line": 1,568 "column": 12569 }570 },571 "range": [572 11,573 12574 ],575 "isLocal": true576 }577 ],578 "body": [579 {580 "type": "ReturnStatement",581 "arguments": [],582 "loc": {583 "start": {584 "line": 1,585 "column": 14586 },587 "end": {588 "line": 1,589 "column": 20590 }591 },592 "range": [593 14,594 20595 ]596 }597 ],598 "loc": {599 "start": {600 "line": 1,601 "column": 0602 },603 "end": {604 "line": 1,605 "column": 24606 }607 },608 "range": [609 0,610 24611 ]612 }613 ],614 "loc": {615 "start": {616 "line": 1,617 "column": 0618 },619 "end": {620 "line": 1,621 "column": 24622 }623 },624 "range": [625 0,626 24627 ],628 "comments": [],629 "globals": [630 {631 "type": "Identifier",632 "name": "a",633 "loc": {634 "start": {635 "line": 1,636 "column": 9637 },638 "end": {639 "line": 1,640 "column": 10641 }642 },643 "range": [644 9,645 10646 ],647 "isLocal": false648 }649 ]650 }651 },652 {653 "source": "function a(p) return return end",654 "result": "[1:21] 'end' expected near 'return'"655 },656 {657 "source": "function a(p) do end end",658 "result": {659 "type": "Chunk",660 "body": [661 {662 "type": "FunctionDeclaration",663 "identifier": {664 "type": "Identifier",665 "name": "a",666 "loc": {667 "start": {668 "line": 1,669 "column": 9670 },671 "end": {672 "line": 1,673 "column": 10674 }675 },676 "range": [677 9,678 10679 ],680 "isLocal": false681 },682 "isLocal": false,683 "parameters": [684 {685 "type": "Identifier",686 "name": "p",687 "loc": {688 "start": {689 "line": 1,690 "column": 11691 },692 "end": {693 "line": 1,694 "column": 12695 }696 },697 "range": [698 11,699 12700 ],701 "isLocal": true702 }703 ],704 "body": [705 {706 "type": "DoStatement",707 "body": [],708 "loc": {709 "start": {710 "line": 1,711 "column": 14712 },713 "end": {714 "line": 1,715 "column": 20716 }717 },718 "range": [719 14,720 20721 ]722 }723 ],724 "loc": {725 "start": {726 "line": 1,727 "column": 0728 },729 "end": {730 "line": 1,731 "column": 24732 }733 },734 "range": [735 0,736 24737 ]738 }739 ],740 "loc": {741 "start": {742 "line": 1,743 "column": 0744 },745 "end": {746 "line": 1,747 "column": 24748 }749 },750 "range": [751 0,752 24753 ],754 "comments": [],755 "globals": [756 {757 "type": "Identifier",758 "name": "a",759 "loc": {760 "start": {761 "line": 1,762 "column": 9763 },764 "end": {765 "line": 1,766 "column": 10767 }768 },769 "range": [770 9,771 10772 ],773 "isLocal": false774 }775 ]776 }777 },778 {779 "source": "function a.(",780 "result": "[1:11] <name> expected near '('"781 },782 {783 "source": "function a.1",784 "result": "[1:10] '(' expected near '.1'"785 },786 {787 "source": "function a.b() end",788 "result": {789 "type": "Chunk",790 "body": [791 {792 "type": "FunctionDeclaration",793 "identifier": {794 "type": "MemberExpression",795 "indexer": ".",796 "identifier": {797 "type": "Identifier",798 "name": "b",799 "loc": {800 "start": {801 "line": 1,802 "column": 11803 },804 "end": {805 "line": 1,806 "column": 12807 }808 },809 "range": [810 11,811 12812 ]813 },814 "base": {815 "type": "Identifier",816 "name": "a",817 "loc": {818 "start": {819 "line": 1,820 "column": 9821 },822 "end": {823 "line": 1,824 "column": 10825 }826 },827 "range": [828 9,829 10830 ],831 "isLocal": false832 },833 "loc": {834 "start": {835 "line": 1,836 "column": 9837 },838 "end": {839 "line": 1,840 "column": 12841 }842 },843 "range": [844 9,845 12846 ]847 },848 "isLocal": false,849 "parameters": [],850 "body": [],851 "loc": {852 "start": {853 "line": 1,854 "column": 0855 },856 "end": {857 "line": 1,858 "column": 18859 }860 },861 "range": [862 0,863 18864 ]865 }866 ],867 "loc": {868 "start": {869 "line": 1,870 "column": 0871 },872 "end": {873 "line": 1,874 "column": 18875 }876 },877 "range": [878 0,879 18880 ],881 "comments": [],882 "globals": [883 {884 "type": "Identifier",885 "name": "a",886 "loc": {887 "start": {888 "line": 1,889 "column": 9890 },891 "end": {892 "line": 1,893 "column": 10894 }895 },896 "range": [897 9,898 10899 ],900 "isLocal": false901 }902 ]903 }904 },905 {906 "source": "function a.b,",907 "result": "[1:12] '(' expected near ','"908 },909 {910 "source": "function a.b.(",911 "result": "[1:13] <name> expected near '('"912 },913 {914 "source": "function a.b.c.d() end",915 "result": {916 "type": "Chunk",917 "body": [918 {919 "type": "FunctionDeclaration",920 "identifier": {921 "type": "MemberExpression",922 "indexer": ".",923 "identifier": {924 "type": "Identifier",925 "name": "d",926 "loc": {927 "start": {928 "line": 1,929 "column": 15930 },931 "end": {932 "line": 1,933 "column": 16934 }935 },936 "range": [937 15,938 16939 ]940 },941 "base": {942 "type": "MemberExpression",943 "indexer": ".",944 "identifier": {945 "type": "Identifier",946 "name": "c",947 "loc": {948 "start": {949 "line": 1,950 "column": 13951 },952 "end": {953 "line": 1,954 "column": 14955 }956 },957 "range": [958 13,959 14960 ]961 },962 "base": {963 "type": "MemberExpression",964 "indexer": ".",965 "identifier": {966 "type": "Identifier",967 "name": "b",968 "loc": {969 "start": {970 "line": 1,971 "column": 11972 },973 "end": {974 "line": 1,975 "column": 12976 }977 },978 "range": [979 11,980 12981 ]982 },983 "base": {984 "type": "Identifier",985 "name": "a",986 "loc": {987 "start": {988 "line": 1,989 "column": 9990 },991 "end": {992 "line": 1,993 "column": 10994 }995 },996 "range": [997 9,998 10999 ],1000 "isLocal": false1001 },1002 "loc": {1003 "start": {1004 "line": 1,1005 "column": 91006 },1007 "end": {1008 "line": 1,1009 "column": 121010 }1011 },1012 "range": [1013 9,1014 121015 ]1016 },1017 "loc": {1018 "start": {1019 "line": 1,1020 "column": 91021 },1022 "end": {1023 "line": 1,1024 "column": 141025 }1026 },1027 "range": [1028 9,1029 141030 ]1031 },1032 "loc": {1033 "start": {1034 "line": 1,1035 "column": 91036 },1037 "end": {1038 "line": 1,1039 "column": 161040 }1041 },1042 "range": [1043 9,1044 161045 ]1046 },1047 "isLocal": false,1048 "parameters": [],1049 "body": [],1050 "loc": {1051 "start": {1052 "line": 1,1053 "column": 01054 },1055 "end": {1056 "line": 1,1057 "column": 221058 }1059 },1060 "range": [1061 0,1062 221063 ]1064 }1065 ],1066 "loc": {1067 "start": {1068 "line": 1,1069 "column": 01070 },1071 "end": {1072 "line": 1,1073 "column": 221074 }1075 },1076 "range": [1077 0,1078 221079 ],1080 "comments": [],1081 "globals": [1082 {1083 "type": "Identifier",1084 "name": "a",1085 "loc": {1086 "start": {1087 "line": 1,1088 "column": 91089 },1090 "end": {1091 "line": 1,1092 "column": 101093 }1094 },1095 "range": [1096 9,1097 101098 ],1099 "isLocal": false1100 }1101 ]1102 }1103 },1104 {1105 "source": "function a:",1106 "result": "[1:11] <name> expected near '<eof>'"1107 },1108 {1109 "source": "function a:1",1110 "result": "[1:11] <name> expected near '1'"1111 },1112 {1113 "source": "function a:b() end",1114 "result": {1115 "type": "Chunk",1116 "body": [1117 {1118 "type": "FunctionDeclaration",1119 "identifier": {1120 "type": "MemberExpression",1121 "indexer": ":",1122 "identifier": {1123 "type": "Identifier",1124 "name": "b",1125 "loc": {1126 "start": {1127 "line": 1,1128 "column": 111129 },1130 "end": {1131 "line": 1,1132 "column": 121133 }1134 },1135 "range": [1136 11,1137 121138 ]1139 },1140 "base": {1141 "type": "Identifier",1142 "name": "a",1143 "loc": {1144 "start": {1145 "line": 1,1146 "column": 91147 },1148 "end": {1149 "line": 1,1150 "column": 101151 }1152 },1153 "range": [1154 9,1155 101156 ],1157 "isLocal": false1158 },1159 "loc": {1160 "start": {1161 "line": 1,1162 "column": 91163 },1164 "end": {1165 "line": 1,1166 "column": 121167 }1168 },1169 "range": [1170 9,1171 121172 ]1173 },1174 "isLocal": false,1175 "parameters": [],1176 "body": [],1177 "loc": {1178 "start": {1179 "line": 1,1180 "column": 01181 },1182 "end": {1183 "line": 1,1184 "column": 181185 }1186 },1187 "range": [1188 0,1189 181190 ]1191 }1192 ],1193 "loc": {1194 "start": {1195 "line": 1,1196 "column": 01197 },1198 "end": {1199 "line": 1,1200 "column": 181201 }1202 },1203 "range": [1204 0,1205 181206 ],1207 "comments": [],1208 "globals": [1209 {1210 "type": "Identifier",1211 "name": "a",1212 "loc": {1213 "start": {1214 "line": 1,1215 "column": 91216 },1217 "end": {1218 "line": 1,1219 "column": 101220 }1221 },1222 "range": [1223 9,1224 101225 ],1226 "isLocal": false1227 }1228 ]1229 }1230 },1231 {1232 "source": "function a:b:",1233 "result": "[1:12] '(' expected near ':'"1234 },1235 {1236 "source": "function a:b.",1237 "result": "[1:12] '(' expected near '.'"1238 },1239 {1240 "source": "function a.b.c:d() end",1241 "result": {1242 "type": "Chunk",1243 "body": [1244 {1245 "type": "FunctionDeclaration",1246 "identifier": {1247 "type": "MemberExpression",1248 "indexer": ":",1249 "identifier": {1250 "type": "Identifier",1251 "name": "d",1252 "loc": {1253 "start": {1254 "line": 1,1255 "column": 151256 },1257 "end": {1258 "line": 1,1259 "column": 161260 }1261 },1262 "range": [1263 15,1264 161265 ]1266 },1267 "base": {1268 "type": "MemberExpression",1269 "indexer": ".",1270 "identifier": {1271 "type": "Identifier",1272 "name": "c",1273 "loc": {1274 "start": {1275 "line": 1,1276 "column": 131277 },1278 "end": {1279 "line": 1,1280 "column": 141281 }1282 },1283 "range": [1284 13,1285 141286 ]1287 },1288 "base": {1289 "type": "MemberExpression",1290 "indexer": ".",1291 "identifier": {1292 "type": "Identifier",1293 "name": "b",1294 "loc": {1295 "start": {1296 "line": 1,1297 "column": 111298 },1299 "end": {1300 "line": 1,1301 "column": 121302 }1303 },1304 "range": [1305 11,1306 121307 ]1308 },1309 "base": {1310 "type": "Identifier",1311 "name": "a",1312 "loc": {1313 "start": {1314 "line": 1,1315 "column": 91316 },1317 "end": {1318 "line": 1,1319 "column": 101320 }1321 },1322 "range": [1323 9,1324 101325 ],1326 "isLocal": false1327 },1328 "loc": {1329 "start": {1330 "line": 1,1331 "column": 91332 },1333 "end": {1334 "line": 1,1335 "column": 121336 }1337 },1338 "range": [1339 9,1340 121341 ]1342 },1343 "loc": {1344 "start": {1345 "line": 1,1346 "column": 91347 },1348 "end": {1349 "line": 1,1350 "column": 141351 }1352 },1353 "range": [1354 9,1355 141356 ]1357 },1358 "loc": {1359 "start": {1360 "line": 1,1361 "column": 91362 },1363 "end": {1364 "line": 1,1365 "column": 161366 }1367 },1368 "range": [1369 9,1370 161371 ]1372 },1373 "isLocal": false,1374 "parameters": [],1375 "body": [],1376 "loc": {1377 "start": {1378 "line": 1,1379 "column": 01380 },1381 "end": {1382 "line": 1,1383 "column": 221384 }1385 },1386 "range": [1387 0,1388 221389 ]1390 }1391 ],1392 "loc": {1393 "start": {1394 "line": 1,1395 "column": 01396 },1397 "end": {1398 "line": 1,1399 "column": 221400 }1401 },1402 "range": [1403 0,1404 221405 ],1406 "comments": [],1407 "globals": [1408 {1409 "type": "Identifier",1410 "name": "a",1411 "loc": {1412 "start": {1413 "line": 1,1414 "column": 91415 },1416 "end": {1417 "line": 1,1418 "column": 101419 }1420 },1421 "range": [1422 9,1423 101424 ],1425 "isLocal": false1426 }1427 ]1428 }1429 },1430 {1431 "source": "function a(...) end",1432 "result": {1433 "type": "Chunk",1434 "body": [1435 {1436 "type": "FunctionDeclaration",1437 "identifier": {1438 "type": "Identifier",1439 "name": "a",1440 "loc": {1441 "start": {1442 "line": 1,1443 "column": 91444 },1445 "end": {1446 "line": 1,1447 "column": 101448 }1449 },1450 "range": [1451 9,1452 101453 ],1454 "isLocal": false1455 },1456 "isLocal": false,1457 "parameters": [1458 {1459 "type": "VarargLiteral",1460 "value": "...",1461 "raw": "...",1462 "loc": {1463 "start": {1464 "line": 1,1465 "column": 111466 },1467 "end": {1468 "line": 1,1469 "column": 141470 }1471 },1472 "range": [1473 11,1474 141475 ]1476 }1477 ],1478 "body": [],1479 "loc": {1480 "start": {1481 "line": 1,1482 "column": 01483 },1484 "end": {1485 "line": 1,1486 "column": 191487 }1488 },1489 "range": [1490 0,1491 191492 ]1493 }1494 ],1495 "loc": {1496 "start": {1497 "line": 1,1498 "column": 01499 },1500 "end": {1501 "line": 1,1502 "column": 191503 }1504 },1505 "range": [1506 0,1507 191508 ],1509 "comments": [],1510 "globals": [1511 {1512 "type": "Identifier",1513 "name": "a",1514 "loc": {1515 "start": {1516 "line": 1,1517 "column": 91518 },1519 "end": {1520 "line": 1,1521 "column": 101522 }1523 },1524 "range": [1525 9,1526 101527 ],1528 "isLocal": false1529 }1530 ]1531 }1532 },1533 {1534 "source": "function a(...,",1535 "result": "[1:14] ')' expected near ','"1536 },1537 {1538 "source": "function a(p,...) end",1539 "result": {1540 "type": "Chunk",1541 "body": [1542 {1543 "type": "FunctionDeclaration",1544 "identifier": {1545 "type": "Identifier",1546 "name": "a",1547 "loc": {1548 "start": {1549 "line": 1,1550 "column": 91551 },1552 "end": {1553 "line": 1,1554 "column": 101555 }1556 },1557 "range": [1558 9,1559 101560 ],1561 "isLocal": false1562 },1563 "isLocal": false,1564 "parameters": [1565 {1566 "type": "Identifier",1567 "name": "p",1568 "loc": {1569 "start": {1570 "line": 1,1571 "column": 111572 },1573 "end": {1574 "line": 1,1575 "column": 121576 }1577 },1578 "range": [1579 11,1580 121581 ],1582 "isLocal": true1583 },1584 {1585 "type": "VarargLiteral",1586 "value": "...",1587 "raw": "...",1588 "loc": {1589 "start": {1590 "line": 1,1591 "column": 131592 },1593 "end": {1594 "line": 1,1595 "column": 161596 }1597 },1598 "range": [1599 13,1600 161601 ]1602 }1603 ],1604 "body": [],1605 "loc": {1606 "start": {1607 "line": 1,1608 "column": 01609 },1610 "end": {1611 "line": 1,1612 "column": 211613 }1614 },1615 "range": [1616 0,1617 211618 ]1619 }1620 ],1621 "loc": {1622 "start": {1623 "line": 1,1624 "column": 01625 },1626 "end": {1627 "line": 1,1628 "column": 211629 }1630 },1631 "range": [1632 0,1633 211634 ],1635 "comments": [],1636 "globals": [1637 {1638 "type": "Identifier",1639 "name": "a",1640 "loc": {1641 "start": {1642 "line": 1,1643 "column": 91644 },1645 "end": {1646 "line": 1,1647 "column": 101648 }1649 },1650 "range": [1651 9,1652 101653 ],1654 "isLocal": false1655 }1656 ]1657 }1658 },1659 {1660 "source": "function a(...,p) end",1661 "result": "[1:14] ')' expected near ','"1662 },1663 {1664 "source": "function a(p,q,r,...) end",1665 "result": {1666 "type": "Chunk",1667 "body": [1668 {1669 "type": "FunctionDeclaration",1670 "identifier": {1671 "type": "Identifier",1672 "name": "a",1673 "loc": {1674 "start": {1675 "line": 1,1676 "column": 91677 },1678 "end": {1679 "line": 1,1680 "column": 101681 }1682 },1683 "range": [1684 9,1685 101686 ],1687 "isLocal": false1688 },1689 "isLocal": false,1690 "parameters": [1691 {1692 "type": "Identifier",1693 "name": "p",1694 "loc": {1695 "start": {1696 "line": 1,1697 "column": 111698 },1699 "end": {1700 "line": 1,1701 "column": 121702 }1703 },1704 "range": [1705 11,1706 121707 ],1708 "isLocal": true1709 },1710 {1711 "type": "Identifier",1712 "name": "q",1713 "loc": {1714 "start": {1715 "line": 1,1716 "column": 131717 },1718 "end": {1719 "line": 1,1720 "column": 141721 }1722 },1723 "range": [1724 13,1725 141726 ],1727 "isLocal": true1728 },1729 {1730 "type": "Identifier",1731 "name": "r",1732 "loc": {1733 "start": {1734 "line": 1,1735 "column": 151736 },1737 "end": {1738 "line": 1,1739 "column": 161740 }1741 },1742 "range": [1743 15,1744 161745 ],1746 "isLocal": true1747 },1748 {1749 "type": "VarargLiteral",1750 "value": "...",1751 "raw": "...",1752 "loc": {1753 "start": {1754 "line": 1,1755 "column": 171756 },1757 "end": {1758 "line": 1,1759 "column": 201760 }1761 },1762 "range": [1763 17,1764 201765 ]1766 }1767 ],1768 "body": [],1769 "loc": {1770 "start": {1771 "line": 1,1772 "column": 01773 },1774 "end": {1775 "line": 1,1776 "column": 251777 }1778 },1779 "range": [1780 0,1781 251782 ]1783 }1784 ],1785 "loc": {1786 "start": {1787 "line": 1,1788 "column": 01789 },1790 "end": {1791 "line": 1,1792 "column": 251793 }1794 },1795 "range": [1796 0,1797 251798 ],1799 "comments": [],1800 "globals": [1801 {1802 "type": "Identifier",1803 "name": "a",1804 "loc": {1805 "start": {1806 "line": 1,1807 "column": 91808 },1809 "end": {1810 "line": 1,1811 "column": 101812 }1813 },1814 "range": [1815 9,1816 101817 ],1818 "isLocal": false1819 }1820 ]1821 }1822 },1823 {1824 "source": "function a() local a local b end",1825 "result": {1826 "type": "Chunk",1827 "body": [1828 {1829 "type": "FunctionDeclaration",1830 "identifier": {1831 "type": "Identifier",1832 "name": "a",1833 "loc": {1834 "start": {1835 "line": 1,1836 "column": 91837 },1838 "end": {1839 "line": 1,1840 "column": 101841 }1842 },1843 "range": [1844 9,1845 101846 ],1847 "isLocal": false1848 },1849 "isLocal": false,1850 "parameters": [],1851 "body": [1852 {1853 "type": "LocalStatement",1854 "variables": [1855 {1856 "type": "Identifier",1857 "name": "a",1858 "loc": {1859 "start": {1860 "line": 1,1861 "column": 191862 },1863 "end": {1864 "line": 1,1865 "column": 201866 }1867 },1868 "range": [1869 19,1870 201871 ],1872 "isLocal": true1873 }1874 ],1875 "init": [],1876 "loc": {1877 "start": {1878 "line": 1,1879 "column": 131880 },1881 "end": {1882 "line": 1,1883 "column": 201884 }1885 },1886 "range": [1887 13,1888 201889 ]1890 },1891 {1892 "type": "LocalStatement",1893 "variables": [1894 {1895 "type": "Identifier",1896 "name": "b",1897 "loc": {1898 "start": {1899 "line": 1,1900 "column": 271901 },1902 "end": {1903 "line": 1,1904 "column": 281905 }1906 },1907 "range": [1908 27,1909 281910 ],1911 "isLocal": true1912 }1913 ],1914 "init": [],1915 "loc": {1916 "start": {1917 "line": 1,1918 "column": 211919 },1920 "end": {1921 "line": 1,1922 "column": 281923 }1924 },1925 "range": [1926 21,1927 281928 ]1929 }1930 ],1931 "loc": {1932 "start": {1933 "line": 1,1934 "column": 01935 },1936 "end": {1937 "line": 1,1938 "column": 321939 }1940 },1941 "range": [1942 0,1943 321944 ]1945 }1946 ],1947 "loc": {1948 "start": {1949 "line": 1,1950 "column": 01951 },1952 "end": {1953 "line": 1,1954 "column": 321955 }1956 },1957 "range": [1958 0,1959 321960 ],1961 "comments": [],1962 "globals": [1963 {1964 "type": "Identifier",1965 "name": "a",1966 "loc": {1967 "start": {1968 "line": 1,1969 "column": 91970 },1971 "end": {1972 "line": 1,1973 "column": 101974 }1975 },1976 "range": [1977 9,1978 101979 ],1980 "isLocal": false1981 }1982 ]1983 }1984 },1985 {1986 "source": "function a() local a; local b; end",1987 "result": {1988 "type": "Chunk",1989 "body": [1990 {1991 "type": "FunctionDeclaration",1992 "identifier": {1993 "type": "Identifier",1994 "name": "a",1995 "loc": {1996 "start": {1997 "line": 1,1998 "column": 91999 },2000 "end": {2001 "line": 1,2002 "column": 102003 }2004 },2005 "range": [2006 9,2007 102008 ],2009 "isLocal": false2010 },2011 "isLocal": false,2012 "parameters": [],2013 "body": [2014 {2015 "type": "LocalStatement",2016 "variables": [2017 {2018 "type": "Identifier",2019 "name": "a",2020 "loc": {2021 "start": {2022 "line": 1,2023 "column": 192024 },2025 "end": {2026 "line": 1,2027 "column": 202028 }2029 },2030 "range": [2031 19,2032 202033 ],2034 "isLocal": true2035 }2036 ],2037 "init": [],2038 "loc": {2039 "start": {2040 "line": 1,2041 "column": 132042 },2043 "end": {2044 "line": 1,2045 "column": 202046 }2047 },2048 "range": [2049 13,2050 202051 ]2052 },2053 {2054 "type": "LocalStatement",2055 "variables": [2056 {2057 "type": "Identifier",2058 "name": "b",2059 "loc": {2060 "start": {2061 "line": 1,2062 "column": 282063 },2064 "end": {2065 "line": 1,2066 "column": 292067 }2068 },2069 "range": [2070 28,2071 292072 ],2073 "isLocal": true2074 }2075 ],2076 "init": [],2077 "loc": {2078 "start": {2079 "line": 1,2080 "column": 222081 },2082 "end": {2083 "line": 1,2084 "column": 292085 }2086 },2087 "range": [2088 22,2089 292090 ]2091 }2092 ],2093 "loc": {2094 "start": {2095 "line": 1,2096 "column": 02097 },2098 "end": {2099 "line": 1,2100 "column": 342101 }2102 },2103 "range": [2104 0,2105 342106 ]2107 }2108 ],2109 "loc": {2110 "start": {2111 "line": 1,2112 "column": 02113 },2114 "end": {2115 "line": 1,2116 "column": 342117 }2118 },2119 "range": [2120 0,2121 342122 ],2123 "comments": [],2124 "globals": [2125 {2126 "type": "Identifier",2127 "name": "a",2128 "loc": {2129 "start": {2130 "line": 1,2131 "column": 92132 },2133 "end": {2134 "line": 1,2135 "column": 102136 }2137 },2138 "range": [2139 9,2140 102141 ],2142 "isLocal": false2143 }2144 ]2145 }2146 },2147 {2148 "source": "function a() end; function a() end;",2149 "result": {2150 "type": "Chunk",2151 "body": [2152 {2153 "type": "FunctionDeclaration",2154 "identifier": {2155 "type": "Identifier",2156 "name": "a",2157 "loc": {2158 "start": {2159 "line": 1,2160 "column": 92161 },2162 "end": {2163 "line": 1,2164 "column": 102165 }2166 },2167 "range": [2168 9,2169 102170 ],2171 "isLocal": false2172 },2173 "isLocal": false,2174 "parameters": [],2175 "body": [],2176 "loc": {2177 "start": {2178 "line": 1,2179 "column": 02180 },2181 "end": {2182 "line": 1,2183 "column": 162184 }2185 },2186 "range": [2187 0,2188 162189 ]2190 },2191 {2192 "type": "FunctionDeclaration",2193 "identifier": {2194 "type": "Identifier",2195 "name": "a",2196 "loc": {2197 "start": {2198 "line": 1,2199 "column": 272200 },2201 "end": {2202 "line": 1,2203 "column": 282204 }2205 },2206 "range": [2207 27,2208 282209 ],2210 "isLocal": false2211 },2212 "isLocal": false,2213 "parameters": [],2214 "body": [],2215 "loc": {2216 "start": {2217 "line": 1,2218 "column": 182219 },2220 "end": {2221 "line": 1,2222 "column": 342223 }2224 },2225 "range": [2226 18,2227 342228 ]2229 }2230 ],2231 "loc": {2232 "start": {2233 "line": 1,2234 "column": 02235 },2236 "end": {2237 "line": 1,2238 "column": 352239 }2240 },2241 "range": [2242 0,2243 352244 ],2245 "comments": [],2246 "globals": [2247 {2248 "type": "Identifier",2249 "name": "a",2250 "loc": {2251 "start": {2252 "line": 1,2253 "column": 92254 },2255 "end": {2256 "line": 1,2257 "column": 102258 }2259 },2260 "range": [2261 9,2262 102263 ],2264 "isLocal": false2265 }2266 ]2267 }2268 },2269 {2270 "source": "return ...",2271 "result": {2272 "type": "Chunk",2273 "body": [2274 {2275 "type": "ReturnStatement",2276 "arguments": [2277 {2278 "type": "VarargLiteral",2279 "value": "...",2280 "raw": "...",2281 "loc": {2282 "start": {2283 "line": 1,2284 "column": 72285 },2286 "end": {2287 "line": 1,2288 "column": 102289 }2290 },2291 "range": [2292 7,2293 102294 ]2295 }2296 ],2297 "loc": {2298 "start": {2299 "line": 1,2300 "column": 02301 },2302 "end": {2303 "line": 1,2304 "column": 102305 }2306 },2307 "range": [2308 0,2309 102310 ]2311 }2312 ],2313 "loc": {2314 "start": {2315 "line": 1,2316 "column": 02317 },2318 "end": {2319 "line": 1,2320 "column": 102321 }2322 },2323 "range": [2324 0,2325 102326 ],2327 "comments": [],2328 "globals": []2329 }2330 },2331 {2332 "source": "function a(...) return ... end",2333 "result": {2334 "type": "Chunk",2335 "body": [2336 {2337 "type": "FunctionDeclaration",2338 "identifier": {2339 "type": "Identifier",2340 "name": "a",2341 "loc": {2342 "start": {2343 "line": 1,2344 "column": 92345 },2346 "end": {2347 "line": 1,2348 "column": 102349 }2350 },2351 "range": [2352 9,2353 102354 ],2355 "isLocal": false2356 },2357 "isLocal": false,2358 "parameters": [2359 {2360 "type": "VarargLiteral",2361 "value": "...",2362 "raw": "...",2363 "loc": {2364 "start": {2365 "line": 1,2366 "column": 112367 },2368 "end": {2369 "line": 1,2370 "column": 142371 }2372 },2373 "range": [2374 11,2375 142376 ]2377 }2378 ],2379 "body": [2380 {2381 "type": "ReturnStatement",2382 "arguments": [2383 {2384 "type": "VarargLiteral",2385 "value": "...",2386 "raw": "...",2387 "loc": {2388 "start": {2389 "line": 1,2390 "column": 232391 },2392 "end": {2393 "line": 1,2394 "column": 262395 }2396 },2397 "range": [2398 23,2399 262400 ]2401 }2402 ],2403 "loc": {2404 "start": {2405 "line": 1,2406 "column": 162407 },2408 "end": {2409 "line": 1,2410 "column": 262411 }2412 },2413 "range": [2414 16,2415 262416 ]2417 }2418 ],2419 "loc": {2420 "start": {2421 "line": 1,2422 "column": 02423 },2424 "end": {2425 "line": 1,2426 "column": 302427 }2428 },2429 "range": [2430 0,2431 302432 ]2433 }2434 ],2435 "loc": {2436 "start": {2437 "line": 1,2438 "column": 02439 },2440 "end": {2441 "line": 1,2442 "column": 302443 }2444 },2445 "range": [2446 0,2447 302448 ],2449 "comments": [],2450 "globals": [2451 {2452 "type": "Identifier",2453 "name": "a",2454 "loc": {2455 "start": {2456 "line": 1,2457 "column": 92458 },2459 "end": {2460 "line": 1,2461 "column": 102462 }2463 },2464 "range": [2465 9,2466 102467 ],2468 "isLocal": false2469 }2470 ]2471 }2472 },2473 {2474 "source": "function a() return ... end",2475 "result": "[1:20] cannot use '...' outside a vararg function near '...'"2476 },2477 {2478 "source": "function a(...) function b() return ... end end",2479 "result": "[1:36] cannot use '...' outside a vararg function near '...'"2480 }2481 ];...
schedules.js
Source:schedules.js
1const schedule2021 = [2 { week: 1, team: 10, isLocal: 0 },3 { week: 2, team: 24, isLocal: 0 },4 { week: 3, team: 11, isLocal: 1 },5 { week: 4, team: 28, isLocal: 1 },6 { week: 5, team: 25, isLocal: 0 },7 { week: 7, team: 13, isLocal: 1 },8 { week: 8, team: 5, isLocal: 0 },9 { week: 9, team: 25, isLocal: 1 },10 { week: 10, team: 16, isLocal: 1 },11 { week: 11, team: 14, isLocal: 0 },12 { week: 12, team: 18, isLocal: 1 },13 { week: 13, team: 28, isLocal: 0 },14 { week: 14, team: 6, isLocal: 0 },15 { week: 15, team: 1, isLocal: 1 },16 { week: 16, team: 30, isLocal: 0 },17 { week: 17, team: 12, isLocal: 1 },18 { week: 18, team: 16, isLocal: 0 }19];2021const schedule2020 = [22 { week: 1, team: 25, isLocal: 1, teamWin: 0 },23 { week: 2, team: 22, isLocal: 0, teamWin: 1 },24 { week: 3, team: 21, isLocal: 0, teamWin: 1 },25 { week: 4, team: 24, isLocal: 1, teamWin: 0 },26 { week: 5, team: 17, isLocal: 1, teamWin: 0 },27 { week: 6, team: 16, isLocal: 1, teamWin: 1 },28 { week: 7, team: 19, isLocal: 0, teamWin: 1 },29 { week: 8, team: 28, isLocal: 0, teamWin: 0 },30 { week: 9, team: 11, isLocal: 1, teamWin: 0 },31 { week: 10, team: 20, isLocal: 0, teamWin: 0 },32 { week: 12, team: 16, isLocal: 0, teamWin: 1 },33 { week: 13, team: 3, isLocal: 1, teamWin: 0 },34 { week: 14, team: 31, isLocal: 1, teamWin: 0 },35 { week: 15, team: 8, isLocal: 0, teamWin: 0 },36 { week: 16, team: 25, isLocal: 0, teamWin: 1 },37 { week: 17, team: 28, isLocal: 1, teamWin: 0 }38];3940const getSchedules = year => {41 console.log({ year });42 switch(year) {43 case 2021:44 return schedule2021;45 case 2020: 46 return schedule2020;47 default:48 return schedule2021;49 }50};51
...
Using AI Code Generation
1const mb = require('mountebank');2const isLocal = mb.isLocal();3const mb = require('mountebank');4const isRemote = mb.isRemote();5const mb = require('mountebank');6const isRunning = mb.isRunning();7const mb = require('mountebank');8const imposters = mb.create({9 stubs: [{10 responses: [{11 is: {12 }13 }]14 }]15});16const mb = require('mountebank');17const imposters = mb.get();18const mb = require('mountebank');19const imposters = mb.get(2525);20const mb = require('mountebank');21const imposters = mb.delete();22const mb = require('mountebank');23const imposters = mb.delete(2525);24const mb = require('mountebank');25const imposters = mb.reset();26const mb = require('mountebank');27const imposters = mb.reset(2525);28const mb = require('mountebank');29const requests = mb.getRequests();30const mb = require('mountebank');31const requests = mb.getRequests(2525);32const mb = require('mountebank');33const requests = mb.getRequests(2525, 0);34const mb = require('mountebank');35const requests = mb.getRequests(2525, 0, 1);36const mb = require('mountebank');37const requests = mb.getRequests(2525, 0, 1, 'GET');
Using AI Code Generation
1const mb = require('mountebank');2const isLocal = mb.isLocal();3console.log(`isLocal: ${isLocal}`);4{5 "dependencies": {6 }7}8{9 "dependencies": {10 "mountebank": {11 "requires": {
Using AI Code Generation
1var mb = require('mountebank'),2 options = { allowInjection: true },3 stub = {4 predicates: [{ equals: { method: 'GET', path: '/test' } }],5 responses: [{ is: { body: 'Hello world!' } }]6 };7mb.start(port, options, function () {8 mb.create(stub, function (error, imposter) {9 console.log('imposter', imposter);10 mb.get('/imposters', function (error, response) {11 console.log('GET /imposters', response.body);12 mb.del('/imposters/' + imposter.port, function (error, response) {13 console.log('DELETE /imposters/' + imposter.port, response.body);14 mb.stop(function () {15 console.log('mb.stop');16 });17 });18 });19 });20});21var mb = require('mountebank'),22 options = { allowInjection: true },23 stub = {24 predicates: [{ equals: { method: 'GET', path: '/test' } }],25 responses: [{ is: { body: 'Hello world!' } }]26 };27mb.start(port, options, function () {28 mb.create(stub, function (error, imposter) {29 console.log('imposter', imposter);30 mb.get('/imposters', function (error, response) {31 console.log('GET /imposters', response.body);32 mb.del('/imposters/' + imposter.port, function (error, response) {33 console.log('DELETE /imposters/' + imposter.port, response.body);34 mb.stop(function () {35 console.log('mb.stop');36 });37 });38 });39 });40});41var mb = require('mountebank'),42 options = { allowInjection: true },43 stub = {44 predicates: [{ equals: { method: 'GET', path: '/test' } }],45 responses: [{ is: { body: '
Using AI Code Generation
1var mb = require('mountebank');2mb.isLocal(function (error, result) {3 console.log(result);4});5var mb = require('mountebank');6mb.isRunning(function (error, result) {7 console.log(result);8});9var mb = require('mountebank');10var options = {
Using AI Code Generation
1var mb = require('mountebank');2var fs = require('fs');3var test = function(){4var options = {5};6mb.start(options, function(){7 console.log("mountebank started");8 var imposter = {9 stubs: [{10 responses: [{11 is: {12 headers: {13 }14 }15 }]16 }]17 };18 mb.create(imposter, function(){19 console.log("imposter created");20 var request = {21 };22 mb.verify(request, function(){23 console.log("request verified");24 mb.stop(function(){25 console.log("mountebank stopped");26 });27 });28 });29});30};31test();32{ [Error: connect ECONNREFUSED
Using AI Code Generation
1var mb = require('mountebank');2 if (err) {3 console.log("error: " + err);4 }5 else {6 console.log("isLocal: " + isLocal);7 }8});9var mb = require('mountebank');10 if (err) {11 console.log("error: " + err);12 }13 else {14 console.log("isLocal: " + isLocal);15 }16});
Using AI Code Generation
1const mb = require('mountebank');2const mbHelper = require('./mbHelper');3const config = require('./config');4const mbServer = mb.create(config.mbServerConfig);5const mbHelperObj = new mbHelper(mbServer);6const imposterConfig = {7 {8 {9 {10 equals: {11 }12 },13 {14 not: {15 equals: {16 headers: {17 }18 }19 }20 }21 }22 {23 is: {24 headers: {25 },26 }27 }28 },29 {30 {31 {32 equals: {33 }34 },35 {36 equals: {37 headers: {38 }39 }40 }41 }42 {43 is: {44 headers: {45 },46 }47 }48 }49};50mbServer.start()51 .then(() => mbHelperObj.createImposter(imposterConfig))52 .then((imposter) => {53 console.log('Imposter started successfully');54 console.log(`Imposter URL: ${imposter.url}`);55 console.log(`Imposter Port: ${imposter.port}`);56 })57 .catch((err) => {58 console.error(err);59 });60const mb = require('mountebank');61class MbHelper {62 constructor(mbServer) {63 this.mbServer = mbServer;64 }65 createImposter(imposterConfig) {66 return new Promise((resolve, reject) => {67 this.mbServer.createImposter(imposterConfig, (err, imposter) => {68 if (err) {
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!