tocco-admin 1.0.7 → 1.0.11

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.
Files changed (438) hide show
  1. package/changelog.md +19 -0
  2. package/dist/010d0560a00a032c33da819e3c86596a.js +1 -368
  3. package/dist/029ed9161a8d24a9c2ba97124020989d.js +1 -9
  4. package/dist/02d5c4961ca855a88b1cd3e1b7fa7aa2.js +1 -113
  5. package/dist/03371bf1d5cbb1eab58e3a0130d1e9c2.js +1 -15001
  6. package/dist/03487ba89c7b63069d63c1b3802a472c.js +1 -24
  7. package/dist/03748243ac7148ca150ba06c2919ff81.js +1 -271
  8. package/dist/03980cb12dacd26148c22bb61fce440f.js +1 -9
  9. package/dist/03aae8272914723a7bf85b984385032c.js +1 -9
  10. package/dist/04770a551c5b6daa744be9b180a8d0fe.js +1 -13311
  11. package/dist/06d958315fc6cdbb28576b03e43203aa.js +1 -9
  12. package/dist/07101530302fe1d03dcd731992f7a899.js +1 -869
  13. package/dist/0731d7568a06d2e28351781370bc52bb.js +1 -445
  14. package/dist/0794fa2b9c882c72fa7d586069b61055.js +1 -3608
  15. package/dist/0872e65446d05c1c443180c6280b015f.js +1 -214
  16. package/dist/08b9f3e305b5e3e0b81f7848fa7f3b6b.js +1 -105
  17. package/dist/09563004132aabcfcc186943555a92a1.js +1 -263
  18. package/dist/0a1d9862d917663419ac2dd2e8193267.js +1 -9
  19. package/dist/0a858573915ab9b03fe79f98f8c51a04.js +1 -271
  20. package/dist/0a9cd3d62e7f1cd404606c50d9da86fb.js +1 -229
  21. package/dist/0beea7b55cf3b8c9f9b0bd46170bb30e.js +1 -238
  22. package/dist/0ec4bf56a876c2bf34ea174c584ce628.js +1 -97
  23. package/dist/0f418117fac55a859631143ad7d0e833.js +1 -1038
  24. package/dist/10132993df2cf9c9423b53a8a44379ab.js +1 -9
  25. package/dist/1034e3807d1bcf55cb564491950237ab.js +1 -9
  26. package/dist/104959bdb953a3792a203e98d2bf530f.js +1 -895
  27. package/dist/114c58e47951fe3f6d25f683e0cd54e7.js +1 -381
  28. package/dist/11b2d52156942feeb87b7c608276c49b.js +1 -119
  29. package/dist/11dc77ef2ea3a04834945a52f7de2072.js +1 -3208
  30. package/dist/12b520593765ef7e714d7fb3764633ed.js +1 -167
  31. package/dist/130340e2c62b9e858f186dab5f491e55.js +1 -9
  32. package/dist/1324f89bd8db0bae85b79b7f90f6c119.js +1 -418
  33. package/dist/13eda3507db9cbfb400f46b9b3ff6553.js +1 -9
  34. package/dist/1441681e52f3ae9ab33afbc5517359a0.js +1 -45
  35. package/dist/1533058f0ce13acdaa8d5bdc7d147bef.js +1 -9
  36. package/dist/1549fe09fd6b44aca96e2b1b7cbd93d0.js +1 -111
  37. package/dist/15f3800d33b854ba476c9daf1b9e0326.js +1 -9
  38. package/dist/16563bfaf4741097d38cc6ce3ccc1a2d.js +1 -2644
  39. package/dist/170487867de05784a96608617bdd544d.js +1 -9
  40. package/dist/179a93d3148b7edb72581279c3787d0c.js +1 -353
  41. package/dist/17dc98279d24649d3ca77cbce8c44e83.js +1 -9
  42. package/dist/1850762f1bfaf1a1044765b02b243ed4.js +1 -262
  43. package/dist/18cfa6de2de3832aa10439fbf963217a.js +1 -3035
  44. package/dist/18e63e724098792b95b076412a860636.js +1 -116
  45. package/dist/191feb6103c36b202bc01ba262916cdf.js +1 -9
  46. package/dist/19e684db1b08c82963634abc8b2c989f.js +1 -422
  47. package/dist/1abc9efccf77fd4527d1c2fc85d87e04.js +1 -647
  48. package/dist/1b15b9f88acaf59b96e59c6b5f32da12.js +1 -9
  49. package/dist/1b64f97eed4a3837a93f8bdd363295fb.js +1 -1873
  50. package/dist/1c02ec6ec024eee3ebb6b34fa8ff316f.js +1 -103
  51. package/dist/1c57b3481f295105588972ffa1305521.js +1 -9
  52. package/dist/1cc82820c232a82b5d8b6cb9e4152af3.js +1 -514
  53. package/dist/1cd3d09b5303cc37fa337225ed6a9132.js +1 -137
  54. package/dist/1e029a7f1f64457da4f54254d50ac59b.js +1 -95
  55. package/dist/1e26167b5f75d5b94add34f1f4d8b044.js +1 -380
  56. package/dist/1e4131e1241a5b81d54c7d9cb66b0e87.js +1 -254
  57. package/dist/1fe2d583da5f073431d81a6ea13ffc0c.js +1 -275
  58. package/dist/1fee62e3e043728a265935971fa26200.js +1 -981
  59. package/dist/211511e7b374f57ad31acaf49dbdccb1.js +1 -9
  60. package/dist/2183252fe9e1b88fcf2bc454d6fd9273.js +1 -115
  61. package/dist/222d52530e9db0a0ec565c6306c5db35.js +1 -104
  62. package/dist/2267d20fd89c81a461e38abecdb8fcdc.js +1 -282
  63. package/dist/2272c6632c52c3e402ab27b8045ab8f1.js +1 -9
  64. package/dist/23bb1a9f279e7a732bfd405350aab114.js +1 -9
  65. package/dist/23da8ba64540ff4aa68a34d3445db680.js +1 -232
  66. package/dist/243c0c0572ab9866e02e18821558a1c5.js +1 -89
  67. package/dist/244b1a234ec1728d0268214de601449d.js +1 -343
  68. package/dist/24a3ff38afde257888d755ece9bfd704.js +1 -9
  69. package/dist/25718a469574ade47e23567d8c543169.js +1 -9
  70. package/dist/25c99a71d30112583893bc5277402c46.js +1 -329
  71. package/dist/25eda4bb98e40a82cfd5b4bf9fbc06ec.js +1 -9
  72. package/dist/263f7107e9357b1c91997e1a21b59ff5.js +1 -2025
  73. package/dist/26fb247a2e0630e1f435cb4d91ec51fd.js +1 -397
  74. package/dist/27730a0bdc6f430cc85049a46a73a029.js +1 -9
  75. package/dist/27ccb71fa24357a0919a861351d5b82d.js +1 -2806
  76. package/dist/28474eb7ee45a125e49cc5cbe69e336f.js +1 -1193
  77. package/dist/28785bea435918d49b290d27bf660baa.js +1 -9
  78. package/dist/28acb3b48578dfd30dd555fff7c822f7.js +1 -312
  79. package/dist/291611f874a2bc54dbc291b52d74c512.js +1 -501
  80. package/dist/2b2fe1a34cdf81c656a47e493ca9d658.js +1 -257
  81. package/dist/2bcf741e1f2cb07989a722a6ba9c2ea7.js +1 -128
  82. package/dist/2d2a42eeeeec801ab35f2fff7d900e43.js +1 -330
  83. package/dist/2dd82c65030101b60dffccedd8741c6e.js +1 -9
  84. package/dist/2ddd0346681f9f12fd3a191245aa41df.js +1 -797
  85. package/dist/2f055ac4066041b9008dd6aebf9df34b.js +1 -9
  86. package/dist/2f5be3e3e9ab852d217168220854ea9b.js +1 -102
  87. package/dist/2f7c864f08b00c01f04ac22375f7ddd9.js +1 -520
  88. package/dist/2fc0239242a898632ca8aa451cb930c2.js +1 -9
  89. package/dist/2ff54aa3c655216f360438bc7f5b181a.js +1 -2742
  90. package/dist/30e80558090a09477e4466af8af4c40e.js +1 -135
  91. package/dist/34791bf31a4236531bc887b48f872c1c.js +1 -1090
  92. package/dist/34b3249d58303435b894a43d3776a5c3.js +1 -1433
  93. package/dist/3567d1ea443427e944a6f189a0898819.js +1 -9
  94. package/dist/3646668820dc96864fbed7746f805947.js +1 -452
  95. package/dist/36474100e81ab63c4ddbc94ab2cc8667.js +1 -799
  96. package/dist/365b89ceec577ebec0a39c938c2363f0.js +1 -263
  97. package/dist/367ad31e6d99d0021d05133b85bb9faf.js +1 -93
  98. package/dist/37172facd8a534a38f378ca2a9c7c11b.js +1 -9
  99. package/dist/37afa466cdb7fa8fc2e043164d48f29e.js +1 -13110
  100. package/dist/37ee3b5201ae2e2dc5dc8b1b20ad900e.js +1 -9
  101. package/dist/38270ad5088729f40c461c4a5a6bad5d.js +1 -248
  102. package/dist/3b190e5159c72fb7e27271956772bcba.js +1 -9
  103. package/dist/3b544bb2c5a4e7b225a4b50235a0fd6d.js +1 -9
  104. package/dist/3b6e7dc98c47eeafd851ca5072db4be6.js +1 -9
  105. package/dist/3bbf0faa999b08584dc971eab820113a.js +1 -1169
  106. package/dist/3c5b59a666c5d39d9ba9cc054d36a410.js +1 -9
  107. package/dist/3c71a5c0e85afc5486ee9ac29099843d.js +1 -230
  108. package/dist/3dcc18a5dee46b57ad7f85c0bee86802.js +1 -508
  109. package/dist/3df92508d7112d83474f31fe9590e289.js +1 -1015
  110. package/dist/3e277a4ce5486a806a00497aea8ecdd3.js +1 -502
  111. package/dist/3e3e2243675fa4fb4b320dc57daf2d4f.js +1 -346
  112. package/dist/3f55ba1c6515db2f98bb996c1a5bc9e3.js +1 -76
  113. package/dist/3f758ea78954547fed0a8d999691dd7c.js +1 -292
  114. package/dist/406884d5525e864955e9f5058526aa02.js +1 -101
  115. package/dist/40dc555a17f1c85020333a41f01dd9ba.js +1 -106
  116. package/dist/40e6f6cb52a24a747b1046614db3b164.js +1 -213
  117. package/dist/41d8a58fd52b6a06e8d3fb06cdabf67a.js +1 -989
  118. package/dist/42b4ce6de00994aa6bf7db7ff2f931a8.js +1 -1331
  119. package/dist/43a0e099f8283dc1c1c6bbd39148d98d.js +1 -867
  120. package/dist/440f4d477b586c7a6ba4c1c966ca79fc.js +1 -147
  121. package/dist/444ababf8edc26948943fbb45bd06a19.js +1 -259
  122. package/dist/44701e25bb6f2ab9ff18343f2357d1b0.js +1 -171
  123. package/dist/44ac2a2398075299754707d4bac7c276.js +1 -59
  124. package/dist/460c67d8fe31ef229704bd5ab6d1dd26.js +1 -942
  125. package/dist/4639c30a609d986a255ccc684404527e.js +1 -676
  126. package/dist/4700af84801dbda8a3880e3469c21130.js +1 -413
  127. package/dist/4736a562251eeaea46dd06892b489f35.js +1 -46
  128. package/dist/47541c23870e955fff15de4be490ba74.js +1 -112
  129. package/dist/47f0fbf038314894ac52f2d67466b5e9.js +1 -2848
  130. package/dist/4860a6a7c59b9ed5c779f7201dc1f591.js +1 -349
  131. package/dist/48e9351c5623d4da657ce7d5d0267ea6.js +1 -9
  132. package/dist/4a1dab236c2844d28f73c5c128afe299.js +1 -193
  133. package/dist/4b425eb8188febc5a89674b89a72d296.js +1 -798
  134. package/dist/4b61fe945e9e73aba22717e5d6f080df.js +1 -642
  135. package/dist/4bf3bc1fbdd26ac698fef1bdf26e3ff4.js +1 -9
  136. package/dist/4c2816c26725f7aae5b490142e31112f.js +1 -352
  137. package/dist/4ceabd28d8dc751f41002ebf2b6fed88.js +1 -539
  138. package/dist/4d143a2d103a9e376a9e3b55e680eef7.js +1 -310
  139. package/dist/4d8cb7033879cb7fcc7a43798e2bde22.js +1 -9
  140. package/dist/4e389cce6fb8f78845fab249bce43c0b.js +1 -9
  141. package/dist/4eed3725a00fc2bab78accdb014b7826.js +1 -325
  142. package/dist/4ef80ee74467e0297eec3cc03092da01.js +1 -9
  143. package/dist/506d44d8712a22011ce2bec8adbb19b2.js +1 -210
  144. package/dist/50c073327491a2ed3bfa2ebb466c4204.js +1 -25
  145. package/dist/51f903c5ce5284a63196247cffb5ca40.js +1 -9
  146. package/dist/5352ecd8e5f1a2637b48e18cc406edb1.js +1 -9
  147. package/dist/53e3600928916423671f3388e2d67844.js +1 -9
  148. package/dist/54b3396acd2c700969248de4b20cbf7c.js +1 -109
  149. package/dist/55892adefebc0d53993fb108151ed150.js +1 -207
  150. package/dist/57f4109bd1f06be4dc2bcb8ff7eaf1e5.js +1 -9
  151. package/dist/57f9654d8ecdebfb02c636e1889af2e4.js +1 -2698
  152. package/dist/582e24f5ba929e358fadfc7be4c18025.js +1 -9
  153. package/dist/58598705e7012f4ca1eb1dd21d3c59a5.js +1 -9
  154. package/dist/5861dfe4f2c7823623e82d0619c5bf06.js +1 -9
  155. package/dist/58aab872dbdb5e1607076e1935130e03.js +1 -9
  156. package/dist/595aef8d8b0a2017e2fc27db5703e0d1.js +1 -167
  157. package/dist/59cc05504a1c823b6d4796bf6b430822.js +1 -9
  158. package/dist/5a496ae20cc576bef1d35972548207cf.js +1 -9
  159. package/dist/5a67fdd5293af0a35defd2574c05cd04.js +1 -1803
  160. package/dist/5ada4185d70a1852b578b2063de58e37.js +1 -221
  161. package/dist/5b6a626249d0bc43e412fffa6a9ee177.js +1 -9
  162. package/dist/5bad2df0e3bfd8fdc1a332fb6276cb39.js +1 -360
  163. package/dist/5c53d90bf4029cfd1b6a0945d1cae142.js +1 -3550
  164. package/dist/5c96efcfd419a70a93c96557979bc66d.js +1 -371
  165. package/dist/5d3314103b00c8ea165c6f9f6757f794.js +1 -9
  166. package/dist/5d46734b57c7408a41473abcd515b64c.js +1 -387
  167. package/dist/5da9145440d57c9b84d469253e84898d.js +1 -154
  168. package/dist/5e37c1ef17a219449c8c6aa37a87a941.js +1 -101
  169. package/dist/5e3f006db26e9b277b1bdbc130611a14.js +1 -400
  170. package/dist/5e55b301888460bd06c8e26d1011e01a.js +1 -9
  171. package/dist/5e6c2744429a8fac6e536b179c1f31d0.js +1 -293
  172. package/dist/5ebdef8c548fca6c51280e915d6f4c3f.js +1 -168
  173. package/dist/5ede1aebde9d4e5f5cce2db3044495c7.js +1 -148
  174. package/dist/5f3ce6efab3c679ec1ad25ab0b3f6b2f.js +1 -9
  175. package/dist/5fb6059ab5d7abab7a74eb73028a3aeb.js +1 -361
  176. package/dist/5fc5c77d4df4f5d77f8530f6b23ecd1e.js +1 -135
  177. package/dist/5fedbf948ed123687f77167fac1faf8b.js +1 -9
  178. package/dist/60340be8eea1d704a17f399b3c3f9577.js +1 -200
  179. package/dist/621b99ed1a029c36b4e91ec35f36c344.js +1 -44
  180. package/dist/6292be0125d3720498496eaa7f541618.js +1 -56
  181. package/dist/63b15fb6fc8f897b22a4bf72b7e8452a.js +1 -57668
  182. package/dist/64a5f4d62507d032038dcd76d15188e1.js +1 -9
  183. package/dist/64c45b6610e353ba59a58afc6dd090ca.js +1 -450
  184. package/dist/64d6924350bd7706850cdc0dcc76ccf6.js +1 -9
  185. package/dist/6511453710d760c2682567b40ddb3301.js +1 -593
  186. package/dist/656f53e1b4c6e37a31799737faf6d639.js +1 -209
  187. package/dist/663234c150f2097f3812c6065491497c.js +1 -254
  188. package/dist/6903d8ef977a1424c4e2eb22b96feb77.js +1 -118
  189. package/dist/6a7bf4fb4484f6f48d8e4337f126a61d.js +1 -1246
  190. package/dist/6abb884bd4f1a54529c00b58c14741cc.js +1 -128
  191. package/dist/6bb61adbbc13088ee1c32d88b5c7e754.js +1 -1743
  192. package/dist/6c0a75dc5671c3f237a79f6e45b9891c.js +1 -9
  193. package/dist/6c67587c2093ac3a19da9f2196e040b7.js +1 -9
  194. package/dist/6d38cef4a006e6cfe54a6117aba7b600.js +1 -9
  195. package/dist/6f09754fd684f82e6c06ae526d15ac80.js +1 -740
  196. package/dist/6f64da239140d00b81d8b6c523e86daf.js +1 -116
  197. package/dist/6faa9e5f2a0122d2333fa450337a09b0.js +1 -9
  198. package/dist/6fd6a6ddbcbbebe735c9d21e594203ec.js +1 -145
  199. package/dist/6fe3f0823e345813c2084b243cb6650b.js +1 -6198
  200. package/dist/70074e0c785c9a808dea76c7c7d17af3.js +1 -9
  201. package/dist/70286c33cab463fd576766adecd2d5d9.js +1 -9
  202. package/dist/707fa1de4d2096da1951c4bc9d21cb6d.js +1 -75
  203. package/dist/7080d2a1db1608264a6d9d9fbaf2cce8.js +1 -9
  204. package/dist/716879b6ef8945d579595d88534ae402.js +1 -417
  205. package/dist/725da29f1643c2263a437c08a1454aea.js +1 -9
  206. package/dist/73c78b067c792ea8c737746e4671d3e0.js +1 -120
  207. package/dist/740f4264cd757fcf28331fd30daf295e.js +1 -18
  208. package/dist/7493f0c3c9bf268d6ad785019d993dd7.js +1 -150
  209. package/dist/74fa46809aba9625071aa51bc0a71561.js +1 -122
  210. package/dist/755114145e5b97e5571a160a39e716db.js +1 -9
  211. package/dist/75bffda9455d77087f34708ac4e85371.js +1 -2640
  212. package/dist/75d2dae20d7bac5ecfa9dafc48ec04eb.js +1 -277
  213. package/dist/760eb6458a048f3cba7bc3ae52ef2ba4.js +1 -137
  214. package/dist/7735af777659608bcd8cd6525e3bbe58.js +1 -135
  215. package/dist/77aaca51c1c32acaf32656d45f4dc017.js +1 -9
  216. package/dist/77dd68f6396b8ab4ce2c238d6ddb5354.js +1 -331
  217. package/dist/788819e459cdd8c4c1ef565fd303f519.js +1 -113
  218. package/dist/7a9a1dced0e327dc9cb1728bef25641d.js +1 -114
  219. package/dist/7bd84be066027e61c84c9c2aa9543c2a.js +1 -888
  220. package/dist/7c1cd1223bd45600763f8c152ad167d5.js +1 -873
  221. package/dist/7c27341a2599ffb713c8fb7beced7601.js +1 -306
  222. package/dist/7c317e61789b17749dfe6ea294c89b6b.js +1 -193
  223. package/dist/7c9c55eb1a1e5c1dfd63631511d9a1f0.js +1 -720
  224. package/dist/7dead8e2fcacc316bbfa632cd9f1c9bb.js +1 -163
  225. package/dist/7e4099fc2d04c7c1cf96892b962ba4ec.js +1 -9
  226. package/dist/7ef082035f74b3d7324f95a7498ea656.js +1 -2632
  227. package/dist/7f12d133c88ce53d0837a6c4c0287a37.js +1 -360
  228. package/dist/7f407a1006eb830d6f0aaad96c133d26.js +1 -430
  229. package/dist/805cb6232d7a9fa46025d48a43622ecf.js +1 -9
  230. package/dist/80a171b7595d1161735e23dec8efddd6.js +1 -363
  231. package/dist/82fed7ec74be91e0db61c500d9c6d7ee.js +1 -303
  232. package/dist/83387cb17a7680f59240e7b399e3ac2b.js +1 -9
  233. package/dist/8361542d34c46713c9aff6c4ce65a9a3.js +1 -2693
  234. package/dist/85a977f41a907dba8c672f9bf4943da0.js +1 -3028
  235. package/dist/866bf6ca5057dcb24503761af061d486.js +1 -478
  236. package/dist/870184211838006214be1c23c98672fc.js +1 -17
  237. package/dist/8707a7b49421dbbb842506674ff87fa3.js +1 -59
  238. package/dist/875e553a27bee88a73df34a90b3058e4.js +1 -2564
  239. package/dist/8772719d0f76ecabded160e32dc5eb77.js +1 -503
  240. package/dist/87932c8321c9985ed3b6979e86d2a50e.js +1 -96
  241. package/dist/87d6bf8becf2d5ebe2f71fda95a313ea.js +1 -83
  242. package/dist/88bbfb9fdb8730ffc23f546b42d8d620.js +1 -395
  243. package/dist/88e2feda80ac8cfb28f1dc0ec833b40d.js +1 -9
  244. package/dist/894720f1519e5eb34e1b4f33fca7a9dd.js +1 -185
  245. package/dist/894edcaf39c3c95818e3949d737ed459.js +1 -9
  246. package/dist/89d3c35a5ef97a600927b477a9ba06b4.js +1 -414
  247. package/dist/8ba6618773c9d8d0b4f6ecb785651e2c.js +1 -121
  248. package/dist/8bf75743fb14fea7cf02a5da1bda79d4.js +1 -73
  249. package/dist/8cb83aa3fea85e950c29450b8237fb72.js +1 -14
  250. package/dist/8d9bb1799d9b98db107e84f10132e17f.js +1 -9
  251. package/dist/8ed58ed9c7e1cb1ae1f2830d29011ffb.js +1 -9
  252. package/dist/909adc4a16e0f97d869e3dd16d561430.js +1 -122
  253. package/dist/90bafd962205e96c3285d27cbf95c55c.js +1 -68
  254. package/dist/91bd2b106800bd7812e2ab5a5fea985b.js +1 -110
  255. package/dist/92f4aab5c66f6269c7054c8fbcb3de13.js +1 -9
  256. package/dist/957970f69802c38a9092b9b6264cc1b9.js +1 -112
  257. package/dist/9600fed6a4508afbbcd2c75923d953c3.js +1 -125
  258. package/dist/962969a46fefcace3305abd4d6e14a2e.js +1 -9
  259. package/dist/964646d64dd3196a9c27fe302511414a.js +1 -10922
  260. package/dist/9671c350e11f1569edb5066cbfeb3334.js +1 -98
  261. package/dist/9696a4229fb787eeb25b26f1274b75ee.js +1 -9
  262. package/dist/97e72973d750ecb3bc2e75b75bf63c5b.js +1 -9000
  263. package/dist/9807cf1e443a7440371904b6525f37eb.js +1 -9
  264. package/dist/985d6749688c18f94994794f88492444.js +1 -278
  265. package/dist/99ade8b6895e3a1c3d6eb70583cb924e.js +1 -115
  266. package/dist/9b1fd9cf4206cc32e84150c49707d811.js +1 -9
  267. package/dist/9b8e2282f60f104ff3ace5b905af4d62.js +1 -64
  268. package/dist/9ff6d4a6592c0cb7d0b939113c3a6b31.js +1 -95
  269. package/dist/a164d0e40c4dfa485dcf8e6d5258d767.js +1 -122
  270. package/dist/a1c8660c5bcc6b6a43a7fb3c351174d9.js +1 -9
  271. package/dist/a2a705f6bc3a6827d6c94c5978aec36d.js +1 -243
  272. package/dist/a2c0fcb443c396b30a11fc1682a29c13.js +1 -115
  273. package/dist/a4306aa43824ec1a4ee422b59a851e6f.js +1 -2622
  274. package/dist/a4bedde07e392f8ebf64341b61f75df2.js +1 -9
  275. package/dist/a533e643002830be2da76c9527265860.js +1 -9
  276. package/dist/a5d364d12a8f7691339c497b2e725bcf.js +1 -145
  277. package/dist/a7824ec1ab22aeb22bb35ab8bf1ddc4a.js +1 -715
  278. package/dist/a934b622dd8bdcdcdc1dde985a07ac14.js +1 -36
  279. package/dist/a98ead014d010899b35ee25c7c225542.js +1 -411
  280. package/dist/aa0eee504d52a12d3a30bbd523afcc34.js +1 -9
  281. package/dist/aa5623ec68d23fedb9c9c115c7d99063.js +1 -9
  282. package/dist/aaddd877950d1e3bf1b3ef0fc0ff596e.js +1 -449
  283. package/dist/aaf5c3a4f1a188fd051577cea7b87209.js +1 -457
  284. package/dist/ab4b314445b23359319c14cce9a0e321.js +1 -3687
  285. package/dist/abb40a9a6ef0b2fe14c66dcadc9857a2.js +1 -248
  286. package/dist/ad215d7ba317c941cdcc96ae78e86666.js +1 -67
  287. package/dist/adc5e81257ed3f8d70d03cf79150eec1.js +1 -320
  288. package/dist/aedbf3a3ece39aab8c9f3b3a3779e79b.js +1 -115
  289. package/dist/af959c2a870f08dd8abccae97c9b9bae.js +1 -35
  290. package/dist/b0071564b0854c39e3de8b99d66e4dfd.js +1 -298
  291. package/dist/b02d982ccb1011197a5a24800b178a0a.js +1 -9
  292. package/dist/b0803f33b602bd3b26be70f259e38cee.js +1 -102
  293. package/dist/b1170472ae4b50e3b0070eb991e502fe.js +1 -9
  294. package/dist/b1ac30076824f72cdff7ea29ae0b6801.js +1 -489
  295. package/dist/b1f3f77a9279cdb38846ebe13c3438bc.js +1 -9
  296. package/dist/b20056c149af6b50c851ecfff90e0ccb.js +1 -2792
  297. package/dist/b20cd9acf45420fcacfd923754185663.js +1 -9
  298. package/dist/b25188cf2652d63136d5e54c38abf84e.js +1 -500
  299. package/dist/b2742fab9568b63c2274698af5d381fc.js +1 -135
  300. package/dist/b2ff96fbe6501ff45c37491b94c96c5f.js +1 -315
  301. package/dist/b33ef9b4202539d3690251cb8213a034.js +1 -9
  302. package/dist/b3bb2c8deddd8c2afcf73f6f5d711596.js +1 -61
  303. package/dist/b402b938ca2da72e0984a1360eda5897.js +1 -40
  304. package/dist/b460e24d77f9c0d8b21e65d899840adb.js +1 -363
  305. package/dist/b6a6a4adaab4f09a7835ff64a5096198.js +1 -80
  306. package/dist/b6df2278bd475169749bab512944b7ec.js +1 -207
  307. package/dist/b7b7be8216519adf62d75f123f9c6423.js +1 -1470
  308. package/dist/b808fb222140a85b23ebbe0fffa906d9.js +1 -9
  309. package/dist/b8197742452dd2e77090dde34cb2dc4d.js +1 -4105
  310. package/dist/b881dca9d9a80f61d87374b4bd5a2dd5.js +1 -9
  311. package/dist/b98206b2175363f1150c074608603942.js +1 -592
  312. package/dist/ba6b8b3e06cd9d0aee9c69278ee84647.js +1 -9
  313. package/dist/baa5bf4cfefed057a4657a1b02cfa114.js +1 -32
  314. package/dist/bb4d542cb170b3f7b27a42c69262975b.js +1 -1421
  315. package/dist/bb5bab7a675544fe31ddb7f4a77dffb9.js +1 -9
  316. package/dist/bc0551f89df16ee262a67c0431544a9e.js +1 -128
  317. package/dist/c0736a7477d7aac4c669bb94ccae25d9.js +1 -381
  318. package/dist/c0780e66c6b1ade0fa22283ce1f9c402.js +1 -1582
  319. package/dist/c1bc72d79cc6161590fc01c6b139fccd.js +1 -296
  320. package/dist/c32ec7d45ccd947b98fe458a8ca1405b.js +1 -412
  321. package/dist/c40023acde0f3d5f4806f5fccbb4284b.js +1 -160
  322. package/dist/c45445ab45defa960329c6f8e6224e57.js +1 -317
  323. package/dist/c51840077c684be0e7e13339f85cd4a9.js +1 -9
  324. package/dist/c530988d2b1966fd10a4d99fa3877e1b.js +1 -9
  325. package/dist/c631c95d9019218dfd22d028f215e1d1.js +1 -312
  326. package/dist/c728b4ef87cfd5f561d1601f0867c39d.js +1 -2509
  327. package/dist/c733414555a126e689832ffb55cc203f.js +1 -820
  328. package/dist/c797511423f91a877e7fdffa74d015cb.js +1 -914
  329. package/dist/c7ca9dccbac3af7ebc82b271dd2aa570.js +1 -400
  330. package/dist/c80e89199aef31e48addb2b35ea96365.js +1 -9
  331. package/dist/cb4175466ea600940f2927fa03a217e8.js +1 -472
  332. package/dist/cb652f200fc3dd740b2e7f678a9272ea.js +1 -9
  333. package/dist/cbdbd623038183a8c068dd24ecd90682.js +1 -9
  334. package/dist/cbdc4ca43a8c940a6c3f59a8b6f17df5.js +1 -9
  335. package/dist/ccde58de5468dd353dbee74d631ebdf0.js +1 -34
  336. package/dist/cd358d9acaaa7049d85b15ac766fc314.js +1 -311
  337. package/dist/cd9a17f94a922c7c88000b1b3cdd67df.js +1 -9
  338. package/dist/cda6c5c52fa5d595982da0fac9da25a5.js +1 -984
  339. package/dist/cf188b3f83735389d47bb12fc9f7069a.js +1 -9
  340. package/dist/cf3f6b1c74c72cb5d02870022dbc9f94.js +1 -9
  341. package/dist/cf90a39d245bf7e6c1b41c7a9a28f0a1.js +1 -681
  342. package/dist/chunk-207.20687707ce30d15f4eeb.js +2 -0
  343. package/dist/chunk-207.20687707ce30d15f4eeb.js.map +1 -0
  344. package/dist/chunk-404.9a698fdc051c69bf1ffa.js +2 -0
  345. package/dist/chunk-404.9a698fdc051c69bf1ffa.js.map +1 -0
  346. package/dist/chunk-actions.9378c1cdcd478a824cb8.js +2 -0
  347. package/dist/chunk-actions.9378c1cdcd478a824cb8.js.map +1 -0
  348. package/dist/chunk-code-editor.4932fdbfef27989069a5.js +2 -0
  349. package/dist/chunk-code-editor.4932fdbfef27989069a5.js.map +1 -0
  350. package/dist/{chunk-docs-actions.8a808416a2d69710472e.js → chunk-docs-actions.9c46b27e36cc37c3782e.js} +2 -2
  351. package/dist/chunk-docs-actions.9c46b27e36cc37c3782e.js.map +1 -0
  352. package/dist/chunk-vendor-icons.b0dcd1c0c79fe5b28fc5.js +1 -0
  353. package/dist/d04707d65591e86810ebc56d48b10810.js +1 -296
  354. package/dist/d1a58542777d072396d7cee5487304f9.js +1 -141
  355. package/dist/d1efdca26800423a363b769b1834cfcf.js +1 -223
  356. package/dist/d2a00e1726c71ca10fbaf4b9c4374458.js +1 -1003
  357. package/dist/d2fe7592ff2fdda099b2b6355abe8c06.js +1 -5240
  358. package/dist/d30fa4070abd6929228505790744e180.js +1 -279
  359. package/dist/d43ad5f9bad9a042b49b2592c7639c28.js +1 -9
  360. package/dist/d542dda7308361c34af2afb9b70d755a.js +1 -9
  361. package/dist/d5a6140d581e5c4eb200259ce372f40b.js +1 -9
  362. package/dist/d5f79987405c2169278f8de37bcc9d05.js +1 -9
  363. package/dist/d78d3b050ea95b068380d975fd413fd7.js +1 -9
  364. package/dist/d79b3962938d65fb85c6f844e86d92d9.js +1 -172
  365. package/dist/d7b57d5ebdcade0ce5e047509e06861a.js +1 -580
  366. package/dist/d7d616d4aa8fd3f51d681242853dcde9.js +1 -9
  367. package/dist/d83f2acd25388452582e5a4c727255b0.js +1 -174
  368. package/dist/da1c1b1569c4d5872c9a18c29f0b5c90.js +1 -3088
  369. package/dist/da55f4fe3daed3f79fc4565668ecf7dd.js +1 -97
  370. package/dist/db8ca5cfb6fe4aaef215f116f6991784.js +1 -9
  371. package/dist/dbc87324ecf271d088a2ab0823de9c5d.js +1 -75
  372. package/dist/dbd05051a3ecf6b10e2f7b8904153f2d.js +1 -3194
  373. package/dist/dc1eb6c1c92d7067c72b82b2833a7d2c.js +1 -2595
  374. package/dist/dcb197c0214e800da9d9436dfc9437d6.js +1 -162
  375. package/dist/ddbc961769cd2ff4d4a7a136168ebf4c.js +1 -9
  376. package/dist/de0fd4fd7c2d7a4887cbc99eed91f797.js +1 -9
  377. package/dist/df37029cdf8359ecac0aebdf4f257d03.js +1 -386
  378. package/dist/df5710d97a899b672060afaa8c4891c2.js +1 -316
  379. package/dist/dfb7dd1fab06b2403f76c23f80b15738.js +1 -1718
  380. package/dist/e07a0b284934d3a0e8c02c508edc9df1.js +1 -115
  381. package/dist/e0adad8a8579bf99f3e22f7c214a5c64.js +1 -9
  382. package/dist/e0e32c3798e8895695ce5b372a0c989f.js +1 -2166
  383. package/dist/e2b38a8393be2cf23f3894ace3efb1c3.js +1 -9
  384. package/dist/e3ba4b654313ae98884a6c9044197e09.js +1 -103
  385. package/dist/e4565878df49fd4ce3edd3f1022c1695.js +1 -244
  386. package/dist/e4917fa7632b01d28e99304d32d989f7.js +1 -9
  387. package/dist/e4968d8264b40c14f123f28419eb456d.js +1 -23
  388. package/dist/e6070e43daf8a9e5f13f515a5a03e66c.js +1 -498
  389. package/dist/e61779df91186b23e7adf2d1968b2708.js +1 -9
  390. package/dist/e6ad50b520736b595970c9e07029c3f1.js +1 -9
  391. package/dist/e6cf8898b285b71e2abe832717ac7060.js +1 -153
  392. package/dist/e6fae0b04a3000a57f22bb25325c8afe.js +1 -2635
  393. package/dist/e6fb5287a46e030336c006e3f50ade3a.js +1 -529
  394. package/dist/e7e1a807af3160b342e0a3550cf8f7c5.js +1 -9
  395. package/dist/e874d975c9128dc6eb9a513d088bed9f.js +1 -9
  396. package/dist/e8fa659263d5ca9e0d1be69c048133a8.js +1 -297
  397. package/dist/e97cfa120fde26da0359ca29afaf3171.js +1 -43
  398. package/dist/eaa55a522fb2cb2f0287711f42344984.js +1 -9
  399. package/dist/eba5ee3fb1f3e92af88c69e50b2a8fd1.js +1 -102
  400. package/dist/ec2d138afc9cc9e81c4c6ef36ed55228.js +1 -103
  401. package/dist/ec32839f8f3353e66b85450525fa3114.js +1 -2808
  402. package/dist/ecd02712f5a40fcdaa3bfa8190470024.js +1 -2596
  403. package/dist/ecd37b343c4dcc8dac849b1c680dcbef.js +1 -1010
  404. package/dist/ecdb4966f685f3e44b1f28fae46827a3.js +1 -9
  405. package/dist/ee694c1bcbdc9439e50f816c39fd1023.js +1 -2875
  406. package/dist/efc14cdf19554635e477781704353ec2.js +1 -9
  407. package/dist/f0548260c0ac6b0e7cdb8909df1a5333.js +1 -421
  408. package/dist/f0878cc386a608146dbc8fb3b6745c42.js +1 -422
  409. package/dist/f326f2f263b1498fedbe1d07d7254d10.js +1 -9
  410. package/dist/f3c7b9d832aa442df3d140f7697b4f62.js +1 -98
  411. package/dist/f42342b39da2c42adc65ebcf52839f90.js +1 -102
  412. package/dist/f4c53706e1721b08e8b2f650c8bd35c4.js +1 -166
  413. package/dist/f582d9feb91d31036d3dae4cdaea865f.js +1 -3533
  414. package/dist/f5bea0e1099339b99b21ee2d3c0fc489.js +1 -23
  415. package/dist/f7186078e00d958aa2b316483dfc7e1c.js +1 -1715
  416. package/dist/f79630d85284a7f6dadc25c1d256af0a.js +1 -33
  417. package/dist/f80efec9a63094f19edae0480a0f2cd8.js +1 -635
  418. package/dist/f90003058d7087f15baa27b80bf08c1d.js +1 -839
  419. package/dist/f980fd09c34c277299e2d3f83aebdba5.js +1 -102
  420. package/dist/fb59a7c154104a421146ab9e5bd71540.js +1 -462
  421. package/dist/fd40b62490e412d27bc67e660aacae19.js +1 -430
  422. package/dist/fd5bc50b18c9f46380cbe5ec1ac2127b.js +1 -9
  423. package/dist/fd5e2efd3b2d047abe8473f99c650a35.js +1 -677
  424. package/dist/fdf4d851b44839d8fdfa77b3419bce19.js +1 -204
  425. package/dist/ffd3b83e8b5878f4785591ff54b1dfff.js +1 -9
  426. package/dist/index.js +9 -9
  427. package/dist/index.js.map +1 -1
  428. package/package.json +4 -2
  429. package/dist/chunk-207.a88d16e56962fd4d2978.js +0 -2
  430. package/dist/chunk-207.a88d16e56962fd4d2978.js.map +0 -1
  431. package/dist/chunk-404.0ea933a6d9513f2665cf.js +0 -2
  432. package/dist/chunk-404.0ea933a6d9513f2665cf.js.map +0 -1
  433. package/dist/chunk-actions.1ad5d759ef5d8509c532.js +0 -2
  434. package/dist/chunk-actions.1ad5d759ef5d8509c532.js.map +0 -1
  435. package/dist/chunk-code-editor.c86cda6aae761ec82d57.js +0 -2
  436. package/dist/chunk-code-editor.c86cda6aae761ec82d57.js.map +0 -1
  437. package/dist/chunk-docs-actions.8a808416a2d69710472e.js.map +0 -1
  438. package/dist/chunk-vendor-icons.7f0d1996a77d090b3d9c.js +0 -1
@@ -1,3608 +1 @@
1
- "no use strict";
2
- !(function(window) {
3
- if (typeof window.window != "undefined" && window.document)
4
- return;
5
- if (window.require && window.define)
6
- return;
7
-
8
- if (!window.console) {
9
- window.console = function() {
10
- var msgs = Array.prototype.slice.call(arguments, 0);
11
- postMessage({type: "log", data: msgs});
12
- };
13
- window.console.error =
14
- window.console.warn =
15
- window.console.log =
16
- window.console.trace = window.console;
17
- }
18
- window.window = window;
19
- window.ace = window;
20
-
21
- window.onerror = function(message, file, line, col, err) {
22
- postMessage({type: "error", data: {
23
- message: message,
24
- data: err.data,
25
- file: file,
26
- line: line,
27
- col: col,
28
- stack: err.stack
29
- }});
30
- };
31
-
32
- window.normalizeModule = function(parentId, moduleName) {
33
- // normalize plugin requires
34
- if (moduleName.indexOf("!") !== -1) {
35
- var chunks = moduleName.split("!");
36
- return window.normalizeModule(parentId, chunks[0]) + "!" + window.normalizeModule(parentId, chunks[1]);
37
- }
38
- // normalize relative requires
39
- if (moduleName.charAt(0) == ".") {
40
- var base = parentId.split("/").slice(0, -1).join("/");
41
- moduleName = (base ? base + "/" : "") + moduleName;
42
-
43
- while (moduleName.indexOf(".") !== -1 && previous != moduleName) {
44
- var previous = moduleName;
45
- moduleName = moduleName.replace(/^\.\//, "").replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
46
- }
47
- }
48
-
49
- return moduleName;
50
- };
51
-
52
- window.require = function require(parentId, id) {
53
- if (!id) {
54
- id = parentId;
55
- parentId = null;
56
- }
57
- if (!id.charAt)
58
- throw new Error("worker.js require() accepts only (parentId, id) as arguments");
59
-
60
- id = window.normalizeModule(parentId, id);
61
-
62
- var module = window.require.modules[id];
63
- if (module) {
64
- if (!module.initialized) {
65
- module.initialized = true;
66
- module.exports = module.factory().exports;
67
- }
68
- return module.exports;
69
- }
70
-
71
- if (!window.require.tlns)
72
- return console.log("unable to load " + id);
73
-
74
- var path = resolveModuleId(id, window.require.tlns);
75
- if (path.slice(-3) != ".js") path += ".js";
76
-
77
- window.require.id = id;
78
- window.require.modules[id] = {}; // prevent infinite loop on broken modules
79
- importScripts(path);
80
- return window.require(parentId, id);
81
- };
82
- function resolveModuleId(id, paths) {
83
- var testPath = id, tail = "";
84
- while (testPath) {
85
- var alias = paths[testPath];
86
- if (typeof alias == "string") {
87
- return alias + tail;
88
- } else if (alias) {
89
- return alias.location.replace(/\/*$/, "/") + (tail || alias.main || alias.name);
90
- } else if (alias === false) {
91
- return "";
92
- }
93
- var i = testPath.lastIndexOf("/");
94
- if (i === -1) break;
95
- tail = testPath.substr(i) + tail;
96
- testPath = testPath.slice(0, i);
97
- }
98
- return id;
99
- }
100
- window.require.modules = {};
101
- window.require.tlns = {};
102
-
103
- window.define = function(id, deps, factory) {
104
- if (arguments.length == 2) {
105
- factory = deps;
106
- if (typeof id != "string") {
107
- deps = id;
108
- id = window.require.id;
109
- }
110
- } else if (arguments.length == 1) {
111
- factory = id;
112
- deps = [];
113
- id = window.require.id;
114
- }
115
-
116
- if (typeof factory != "function") {
117
- window.require.modules[id] = {
118
- exports: factory,
119
- initialized: true
120
- };
121
- return;
122
- }
123
-
124
- if (!deps.length)
125
- // If there is no dependencies, we inject "require", "exports" and
126
- // "module" as dependencies, to provide CommonJS compatibility.
127
- deps = ["require", "exports", "module"];
128
-
129
- var req = function(childId) {
130
- return window.require(id, childId);
131
- };
132
-
133
- window.require.modules[id] = {
134
- exports: {},
135
- factory: function() {
136
- var module = this;
137
- var returnExports = factory.apply(this, deps.slice(0, factory.length).map(function(dep) {
138
- switch (dep) {
139
- // Because "require", "exports" and "module" aren't actual
140
- // dependencies, we must handle them seperately.
141
- case "require": return req;
142
- case "exports": return module.exports;
143
- case "module": return module;
144
- // But for all other dependencies, we can just go ahead and
145
- // require them.
146
- default: return req(dep);
147
- }
148
- }));
149
- if (returnExports)
150
- module.exports = returnExports;
151
- return module;
152
- }
153
- };
154
- };
155
- window.define.amd = {};
156
- require.tlns = {};
157
- window.initBaseUrls = function initBaseUrls(topLevelNamespaces) {
158
- for (var i in topLevelNamespaces)
159
- require.tlns[i] = topLevelNamespaces[i];
160
- };
161
-
162
- window.initSender = function initSender() {
163
-
164
- var EventEmitter = window.require("ace/lib/event_emitter").EventEmitter;
165
- var oop = window.require("ace/lib/oop");
166
-
167
- var Sender = function() {};
168
-
169
- (function() {
170
-
171
- oop.implement(this, EventEmitter);
172
-
173
- this.callback = function(data, callbackId) {
174
- postMessage({
175
- type: "call",
176
- id: callbackId,
177
- data: data
178
- });
179
- };
180
-
181
- this.emit = function(name, data) {
182
- postMessage({
183
- type: "event",
184
- name: name,
185
- data: data
186
- });
187
- };
188
-
189
- }).call(Sender.prototype);
190
-
191
- return new Sender();
192
- };
193
-
194
- var main = window.main = null;
195
- var sender = window.sender = null;
196
-
197
- window.onmessage = function(e) {
198
- var msg = e.data;
199
- if (msg.event && sender) {
200
- sender._signal(msg.event, msg.data);
201
- }
202
- else if (msg.command) {
203
- if (main[msg.command])
204
- main[msg.command].apply(main, msg.args);
205
- else if (window[msg.command])
206
- window[msg.command].apply(window, msg.args);
207
- else
208
- throw new Error("Unknown command:" + msg.command);
209
- }
210
- else if (msg.init) {
211
- window.initBaseUrls(msg.tlns);
212
- sender = window.sender = window.initSender();
213
- var clazz = require(msg.module)[msg.classname];
214
- main = window.main = new clazz(sender);
215
- }
216
- };
217
- })(this);
218
-
219
- ace.define("ace/lib/oop",[], function(require, exports, module) {
220
- "use strict";
221
-
222
- exports.inherits = function(ctor, superCtor) {
223
- ctor.super_ = superCtor;
224
- ctor.prototype = Object.create(superCtor.prototype, {
225
- constructor: {
226
- value: ctor,
227
- enumerable: false,
228
- writable: true,
229
- configurable: true
230
- }
231
- });
232
- };
233
-
234
- exports.mixin = function(obj, mixin) {
235
- for (var key in mixin) {
236
- obj[key] = mixin[key];
237
- }
238
- return obj;
239
- };
240
-
241
- exports.implement = function(proto, mixin) {
242
- exports.mixin(proto, mixin);
243
- };
244
-
245
- });
246
-
247
- ace.define("ace/range",[], function(require, exports, module) {
248
- "use strict";
249
- var comparePoints = function(p1, p2) {
250
- return p1.row - p2.row || p1.column - p2.column;
251
- };
252
- var Range = function(startRow, startColumn, endRow, endColumn) {
253
- this.start = {
254
- row: startRow,
255
- column: startColumn
256
- };
257
-
258
- this.end = {
259
- row: endRow,
260
- column: endColumn
261
- };
262
- };
263
-
264
- (function() {
265
- this.isEqual = function(range) {
266
- return this.start.row === range.start.row &&
267
- this.end.row === range.end.row &&
268
- this.start.column === range.start.column &&
269
- this.end.column === range.end.column;
270
- };
271
- this.toString = function() {
272
- return ("Range: [" + this.start.row + "/" + this.start.column +
273
- "] -> [" + this.end.row + "/" + this.end.column + "]");
274
- };
275
-
276
- this.contains = function(row, column) {
277
- return this.compare(row, column) == 0;
278
- };
279
- this.compareRange = function(range) {
280
- var cmp,
281
- end = range.end,
282
- start = range.start;
283
-
284
- cmp = this.compare(end.row, end.column);
285
- if (cmp == 1) {
286
- cmp = this.compare(start.row, start.column);
287
- if (cmp == 1) {
288
- return 2;
289
- } else if (cmp == 0) {
290
- return 1;
291
- } else {
292
- return 0;
293
- }
294
- } else if (cmp == -1) {
295
- return -2;
296
- } else {
297
- cmp = this.compare(start.row, start.column);
298
- if (cmp == -1) {
299
- return -1;
300
- } else if (cmp == 1) {
301
- return 42;
302
- } else {
303
- return 0;
304
- }
305
- }
306
- };
307
- this.comparePoint = function(p) {
308
- return this.compare(p.row, p.column);
309
- };
310
- this.containsRange = function(range) {
311
- return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
312
- };
313
- this.intersects = function(range) {
314
- var cmp = this.compareRange(range);
315
- return (cmp == -1 || cmp == 0 || cmp == 1);
316
- };
317
- this.isEnd = function(row, column) {
318
- return this.end.row == row && this.end.column == column;
319
- };
320
- this.isStart = function(row, column) {
321
- return this.start.row == row && this.start.column == column;
322
- };
323
- this.setStart = function(row, column) {
324
- if (typeof row == "object") {
325
- this.start.column = row.column;
326
- this.start.row = row.row;
327
- } else {
328
- this.start.row = row;
329
- this.start.column = column;
330
- }
331
- };
332
- this.setEnd = function(row, column) {
333
- if (typeof row == "object") {
334
- this.end.column = row.column;
335
- this.end.row = row.row;
336
- } else {
337
- this.end.row = row;
338
- this.end.column = column;
339
- }
340
- };
341
- this.inside = function(row, column) {
342
- if (this.compare(row, column) == 0) {
343
- if (this.isEnd(row, column) || this.isStart(row, column)) {
344
- return false;
345
- } else {
346
- return true;
347
- }
348
- }
349
- return false;
350
- };
351
- this.insideStart = function(row, column) {
352
- if (this.compare(row, column) == 0) {
353
- if (this.isEnd(row, column)) {
354
- return false;
355
- } else {
356
- return true;
357
- }
358
- }
359
- return false;
360
- };
361
- this.insideEnd = function(row, column) {
362
- if (this.compare(row, column) == 0) {
363
- if (this.isStart(row, column)) {
364
- return false;
365
- } else {
366
- return true;
367
- }
368
- }
369
- return false;
370
- };
371
- this.compare = function(row, column) {
372
- if (!this.isMultiLine()) {
373
- if (row === this.start.row) {
374
- return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
375
- }
376
- }
377
-
378
- if (row < this.start.row)
379
- return -1;
380
-
381
- if (row > this.end.row)
382
- return 1;
383
-
384
- if (this.start.row === row)
385
- return column >= this.start.column ? 0 : -1;
386
-
387
- if (this.end.row === row)
388
- return column <= this.end.column ? 0 : 1;
389
-
390
- return 0;
391
- };
392
- this.compareStart = function(row, column) {
393
- if (this.start.row == row && this.start.column == column) {
394
- return -1;
395
- } else {
396
- return this.compare(row, column);
397
- }
398
- };
399
- this.compareEnd = function(row, column) {
400
- if (this.end.row == row && this.end.column == column) {
401
- return 1;
402
- } else {
403
- return this.compare(row, column);
404
- }
405
- };
406
- this.compareInside = function(row, column) {
407
- if (this.end.row == row && this.end.column == column) {
408
- return 1;
409
- } else if (this.start.row == row && this.start.column == column) {
410
- return -1;
411
- } else {
412
- return this.compare(row, column);
413
- }
414
- };
415
- this.clipRows = function(firstRow, lastRow) {
416
- if (this.end.row > lastRow)
417
- var end = {row: lastRow + 1, column: 0};
418
- else if (this.end.row < firstRow)
419
- var end = {row: firstRow, column: 0};
420
-
421
- if (this.start.row > lastRow)
422
- var start = {row: lastRow + 1, column: 0};
423
- else if (this.start.row < firstRow)
424
- var start = {row: firstRow, column: 0};
425
-
426
- return Range.fromPoints(start || this.start, end || this.end);
427
- };
428
- this.extend = function(row, column) {
429
- var cmp = this.compare(row, column);
430
-
431
- if (cmp == 0)
432
- return this;
433
- else if (cmp == -1)
434
- var start = {row: row, column: column};
435
- else
436
- var end = {row: row, column: column};
437
-
438
- return Range.fromPoints(start || this.start, end || this.end);
439
- };
440
-
441
- this.isEmpty = function() {
442
- return (this.start.row === this.end.row && this.start.column === this.end.column);
443
- };
444
- this.isMultiLine = function() {
445
- return (this.start.row !== this.end.row);
446
- };
447
- this.clone = function() {
448
- return Range.fromPoints(this.start, this.end);
449
- };
450
- this.collapseRows = function() {
451
- if (this.end.column == 0)
452
- return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);
453
- else
454
- return new Range(this.start.row, 0, this.end.row, 0);
455
- };
456
- this.toScreenRange = function(session) {
457
- var screenPosStart = session.documentToScreenPosition(this.start);
458
- var screenPosEnd = session.documentToScreenPosition(this.end);
459
-
460
- return new Range(
461
- screenPosStart.row, screenPosStart.column,
462
- screenPosEnd.row, screenPosEnd.column
463
- );
464
- };
465
- this.moveBy = function(row, column) {
466
- this.start.row += row;
467
- this.start.column += column;
468
- this.end.row += row;
469
- this.end.column += column;
470
- };
471
-
472
- }).call(Range.prototype);
473
- Range.fromPoints = function(start, end) {
474
- return new Range(start.row, start.column, end.row, end.column);
475
- };
476
- Range.comparePoints = comparePoints;
477
-
478
- Range.comparePoints = function(p1, p2) {
479
- return p1.row - p2.row || p1.column - p2.column;
480
- };
481
-
482
-
483
- exports.Range = Range;
484
- });
485
-
486
- ace.define("ace/apply_delta",[], function(require, exports, module) {
487
- "use strict";
488
-
489
- function throwDeltaError(delta, errorText){
490
- console.log("Invalid Delta:", delta);
491
- throw "Invalid Delta: " + errorText;
492
- }
493
-
494
- function positionInDocument(docLines, position) {
495
- return position.row >= 0 && position.row < docLines.length &&
496
- position.column >= 0 && position.column <= docLines[position.row].length;
497
- }
498
-
499
- function validateDelta(docLines, delta) {
500
- if (delta.action != "insert" && delta.action != "remove")
501
- throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
502
- if (!(delta.lines instanceof Array))
503
- throwDeltaError(delta, "delta.lines must be an Array");
504
- if (!delta.start || !delta.end)
505
- throwDeltaError(delta, "delta.start/end must be an present");
506
- var start = delta.start;
507
- if (!positionInDocument(docLines, delta.start))
508
- throwDeltaError(delta, "delta.start must be contained in document");
509
- var end = delta.end;
510
- if (delta.action == "remove" && !positionInDocument(docLines, end))
511
- throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
512
- var numRangeRows = end.row - start.row;
513
- var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
514
- if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
515
- throwDeltaError(delta, "delta.range must match delta lines");
516
- }
517
-
518
- exports.applyDelta = function(docLines, delta, doNotValidate) {
519
-
520
- var row = delta.start.row;
521
- var startColumn = delta.start.column;
522
- var line = docLines[row] || "";
523
- switch (delta.action) {
524
- case "insert":
525
- var lines = delta.lines;
526
- if (lines.length === 1) {
527
- docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn);
528
- } else {
529
- var args = [row, 1].concat(delta.lines);
530
- docLines.splice.apply(docLines, args);
531
- docLines[row] = line.substring(0, startColumn) + docLines[row];
532
- docLines[row + delta.lines.length - 1] += line.substring(startColumn);
533
- }
534
- break;
535
- case "remove":
536
- var endColumn = delta.end.column;
537
- var endRow = delta.end.row;
538
- if (row === endRow) {
539
- docLines[row] = line.substring(0, startColumn) + line.substring(endColumn);
540
- } else {
541
- docLines.splice(
542
- row, endRow - row + 1,
543
- line.substring(0, startColumn) + docLines[endRow].substring(endColumn)
544
- );
545
- }
546
- break;
547
- }
548
- };
549
- });
550
-
551
- ace.define("ace/lib/event_emitter",[], function(require, exports, module) {
552
- "use strict";
553
-
554
- var EventEmitter = {};
555
- var stopPropagation = function() { this.propagationStopped = true; };
556
- var preventDefault = function() { this.defaultPrevented = true; };
557
-
558
- EventEmitter._emit =
559
- EventEmitter._dispatchEvent = function(eventName, e) {
560
- this._eventRegistry || (this._eventRegistry = {});
561
- this._defaultHandlers || (this._defaultHandlers = {});
562
-
563
- var listeners = this._eventRegistry[eventName] || [];
564
- var defaultHandler = this._defaultHandlers[eventName];
565
- if (!listeners.length && !defaultHandler)
566
- return;
567
-
568
- if (typeof e != "object" || !e)
569
- e = {};
570
-
571
- if (!e.type)
572
- e.type = eventName;
573
- if (!e.stopPropagation)
574
- e.stopPropagation = stopPropagation;
575
- if (!e.preventDefault)
576
- e.preventDefault = preventDefault;
577
-
578
- listeners = listeners.slice();
579
- for (var i=0; i<listeners.length; i++) {
580
- listeners[i](e, this);
581
- if (e.propagationStopped)
582
- break;
583
- }
584
-
585
- if (defaultHandler && !e.defaultPrevented)
586
- return defaultHandler(e, this);
587
- };
588
-
589
-
590
- EventEmitter._signal = function(eventName, e) {
591
- var listeners = (this._eventRegistry || {})[eventName];
592
- if (!listeners)
593
- return;
594
- listeners = listeners.slice();
595
- for (var i=0; i<listeners.length; i++)
596
- listeners[i](e, this);
597
- };
598
-
599
- EventEmitter.once = function(eventName, callback) {
600
- var _self = this;
601
- this.on(eventName, function newCallback() {
602
- _self.off(eventName, newCallback);
603
- callback.apply(null, arguments);
604
- });
605
- if (!callback) {
606
- return new Promise(function(resolve) {
607
- callback = resolve;
608
- });
609
- }
610
- };
611
-
612
-
613
- EventEmitter.setDefaultHandler = function(eventName, callback) {
614
- var handlers = this._defaultHandlers;
615
- if (!handlers)
616
- handlers = this._defaultHandlers = {_disabled_: {}};
617
-
618
- if (handlers[eventName]) {
619
- var old = handlers[eventName];
620
- var disabled = handlers._disabled_[eventName];
621
- if (!disabled)
622
- handlers._disabled_[eventName] = disabled = [];
623
- disabled.push(old);
624
- var i = disabled.indexOf(callback);
625
- if (i != -1)
626
- disabled.splice(i, 1);
627
- }
628
- handlers[eventName] = callback;
629
- };
630
- EventEmitter.removeDefaultHandler = function(eventName, callback) {
631
- var handlers = this._defaultHandlers;
632
- if (!handlers)
633
- return;
634
- var disabled = handlers._disabled_[eventName];
635
-
636
- if (handlers[eventName] == callback) {
637
- if (disabled)
638
- this.setDefaultHandler(eventName, disabled.pop());
639
- } else if (disabled) {
640
- var i = disabled.indexOf(callback);
641
- if (i != -1)
642
- disabled.splice(i, 1);
643
- }
644
- };
645
-
646
- EventEmitter.on =
647
- EventEmitter.addEventListener = function(eventName, callback, capturing) {
648
- this._eventRegistry = this._eventRegistry || {};
649
-
650
- var listeners = this._eventRegistry[eventName];
651
- if (!listeners)
652
- listeners = this._eventRegistry[eventName] = [];
653
-
654
- if (listeners.indexOf(callback) == -1)
655
- listeners[capturing ? "unshift" : "push"](callback);
656
- return callback;
657
- };
658
-
659
- EventEmitter.off =
660
- EventEmitter.removeListener =
661
- EventEmitter.removeEventListener = function(eventName, callback) {
662
- this._eventRegistry = this._eventRegistry || {};
663
-
664
- var listeners = this._eventRegistry[eventName];
665
- if (!listeners)
666
- return;
667
-
668
- var index = listeners.indexOf(callback);
669
- if (index !== -1)
670
- listeners.splice(index, 1);
671
- };
672
-
673
- EventEmitter.removeAllListeners = function(eventName) {
674
- if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
675
- if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
676
- if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
677
- };
678
-
679
- exports.EventEmitter = EventEmitter;
680
-
681
- });
682
-
683
- ace.define("ace/anchor",[], function(require, exports, module) {
684
- "use strict";
685
-
686
- var oop = require("./lib/oop");
687
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
688
-
689
- var Anchor = exports.Anchor = function(doc, row, column) {
690
- this.$onChange = this.onChange.bind(this);
691
- this.attach(doc);
692
-
693
- if (typeof column == "undefined")
694
- this.setPosition(row.row, row.column);
695
- else
696
- this.setPosition(row, column);
697
- };
698
-
699
- (function() {
700
-
701
- oop.implement(this, EventEmitter);
702
- this.getPosition = function() {
703
- return this.$clipPositionToDocument(this.row, this.column);
704
- };
705
- this.getDocument = function() {
706
- return this.document;
707
- };
708
- this.$insertRight = false;
709
- this.onChange = function(delta) {
710
- if (delta.start.row == delta.end.row && delta.start.row != this.row)
711
- return;
712
-
713
- if (delta.start.row > this.row)
714
- return;
715
-
716
- var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
717
- this.setPosition(point.row, point.column, true);
718
- };
719
-
720
- function $pointsInOrder(point1, point2, equalPointsInOrder) {
721
- var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
722
- return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
723
- }
724
-
725
- function $getTransformedPoint(delta, point, moveIfEqual) {
726
- var deltaIsInsert = delta.action == "insert";
727
- var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
728
- var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
729
- var deltaStart = delta.start;
730
- var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
731
- if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
732
- return {
733
- row: point.row,
734
- column: point.column
735
- };
736
- }
737
- if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
738
- return {
739
- row: point.row + deltaRowShift,
740
- column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
741
- };
742
- }
743
-
744
- return {
745
- row: deltaStart.row,
746
- column: deltaStart.column
747
- };
748
- }
749
- this.setPosition = function(row, column, noClip) {
750
- var pos;
751
- if (noClip) {
752
- pos = {
753
- row: row,
754
- column: column
755
- };
756
- } else {
757
- pos = this.$clipPositionToDocument(row, column);
758
- }
759
-
760
- if (this.row == pos.row && this.column == pos.column)
761
- return;
762
-
763
- var old = {
764
- row: this.row,
765
- column: this.column
766
- };
767
-
768
- this.row = pos.row;
769
- this.column = pos.column;
770
- this._signal("change", {
771
- old: old,
772
- value: pos
773
- });
774
- };
775
- this.detach = function() {
776
- this.document.off("change", this.$onChange);
777
- };
778
- this.attach = function(doc) {
779
- this.document = doc || this.document;
780
- this.document.on("change", this.$onChange);
781
- };
782
- this.$clipPositionToDocument = function(row, column) {
783
- var pos = {};
784
-
785
- if (row >= this.document.getLength()) {
786
- pos.row = Math.max(0, this.document.getLength() - 1);
787
- pos.column = this.document.getLine(pos.row).length;
788
- }
789
- else if (row < 0) {
790
- pos.row = 0;
791
- pos.column = 0;
792
- }
793
- else {
794
- pos.row = row;
795
- pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
796
- }
797
-
798
- if (column < 0)
799
- pos.column = 0;
800
-
801
- return pos;
802
- };
803
-
804
- }).call(Anchor.prototype);
805
-
806
- });
807
-
808
- ace.define("ace/document",[], function(require, exports, module) {
809
- "use strict";
810
-
811
- var oop = require("./lib/oop");
812
- var applyDelta = require("./apply_delta").applyDelta;
813
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
814
- var Range = require("./range").Range;
815
- var Anchor = require("./anchor").Anchor;
816
-
817
- var Document = function(textOrLines) {
818
- this.$lines = [""];
819
- if (textOrLines.length === 0) {
820
- this.$lines = [""];
821
- } else if (Array.isArray(textOrLines)) {
822
- this.insertMergedLines({row: 0, column: 0}, textOrLines);
823
- } else {
824
- this.insert({row: 0, column:0}, textOrLines);
825
- }
826
- };
827
-
828
- (function() {
829
-
830
- oop.implement(this, EventEmitter);
831
- this.setValue = function(text) {
832
- var len = this.getLength() - 1;
833
- this.remove(new Range(0, 0, len, this.getLine(len).length));
834
- this.insert({row: 0, column: 0}, text);
835
- };
836
- this.getValue = function() {
837
- return this.getAllLines().join(this.getNewLineCharacter());
838
- };
839
- this.createAnchor = function(row, column) {
840
- return new Anchor(this, row, column);
841
- };
842
- if ("aaa".split(/a/).length === 0) {
843
- this.$split = function(text) {
844
- return text.replace(/\r\n|\r/g, "\n").split("\n");
845
- };
846
- } else {
847
- this.$split = function(text) {
848
- return text.split(/\r\n|\r|\n/);
849
- };
850
- }
851
-
852
-
853
- this.$detectNewLine = function(text) {
854
- var match = text.match(/^.*?(\r\n|\r|\n)/m);
855
- this.$autoNewLine = match ? match[1] : "\n";
856
- this._signal("changeNewLineMode");
857
- };
858
- this.getNewLineCharacter = function() {
859
- switch (this.$newLineMode) {
860
- case "windows":
861
- return "\r\n";
862
- case "unix":
863
- return "\n";
864
- default:
865
- return this.$autoNewLine || "\n";
866
- }
867
- };
868
-
869
- this.$autoNewLine = "";
870
- this.$newLineMode = "auto";
871
- this.setNewLineMode = function(newLineMode) {
872
- if (this.$newLineMode === newLineMode)
873
- return;
874
-
875
- this.$newLineMode = newLineMode;
876
- this._signal("changeNewLineMode");
877
- };
878
- this.getNewLineMode = function() {
879
- return this.$newLineMode;
880
- };
881
- this.isNewLine = function(text) {
882
- return (text == "\r\n" || text == "\r" || text == "\n");
883
- };
884
- this.getLine = function(row) {
885
- return this.$lines[row] || "";
886
- };
887
- this.getLines = function(firstRow, lastRow) {
888
- return this.$lines.slice(firstRow, lastRow + 1);
889
- };
890
- this.getAllLines = function() {
891
- return this.getLines(0, this.getLength());
892
- };
893
- this.getLength = function() {
894
- return this.$lines.length;
895
- };
896
- this.getTextRange = function(range) {
897
- return this.getLinesForRange(range).join(this.getNewLineCharacter());
898
- };
899
- this.getLinesForRange = function(range) {
900
- var lines;
901
- if (range.start.row === range.end.row) {
902
- lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
903
- } else {
904
- lines = this.getLines(range.start.row, range.end.row);
905
- lines[0] = (lines[0] || "").substring(range.start.column);
906
- var l = lines.length - 1;
907
- if (range.end.row - range.start.row == l)
908
- lines[l] = lines[l].substring(0, range.end.column);
909
- }
910
- return lines;
911
- };
912
- this.insertLines = function(row, lines) {
913
- console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
914
- return this.insertFullLines(row, lines);
915
- };
916
- this.removeLines = function(firstRow, lastRow) {
917
- console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
918
- return this.removeFullLines(firstRow, lastRow);
919
- };
920
- this.insertNewLine = function(position) {
921
- console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
922
- return this.insertMergedLines(position, ["", ""]);
923
- };
924
- this.insert = function(position, text) {
925
- if (this.getLength() <= 1)
926
- this.$detectNewLine(text);
927
-
928
- return this.insertMergedLines(position, this.$split(text));
929
- };
930
- this.insertInLine = function(position, text) {
931
- var start = this.clippedPos(position.row, position.column);
932
- var end = this.pos(position.row, position.column + text.length);
933
-
934
- this.applyDelta({
935
- start: start,
936
- end: end,
937
- action: "insert",
938
- lines: [text]
939
- }, true);
940
-
941
- return this.clonePos(end);
942
- };
943
-
944
- this.clippedPos = function(row, column) {
945
- var length = this.getLength();
946
- if (row === undefined) {
947
- row = length;
948
- } else if (row < 0) {
949
- row = 0;
950
- } else if (row >= length) {
951
- row = length - 1;
952
- column = undefined;
953
- }
954
- var line = this.getLine(row);
955
- if (column == undefined)
956
- column = line.length;
957
- column = Math.min(Math.max(column, 0), line.length);
958
- return {row: row, column: column};
959
- };
960
-
961
- this.clonePos = function(pos) {
962
- return {row: pos.row, column: pos.column};
963
- };
964
-
965
- this.pos = function(row, column) {
966
- return {row: row, column: column};
967
- };
968
-
969
- this.$clipPosition = function(position) {
970
- var length = this.getLength();
971
- if (position.row >= length) {
972
- position.row = Math.max(0, length - 1);
973
- position.column = this.getLine(length - 1).length;
974
- } else {
975
- position.row = Math.max(0, position.row);
976
- position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
977
- }
978
- return position;
979
- };
980
- this.insertFullLines = function(row, lines) {
981
- row = Math.min(Math.max(row, 0), this.getLength());
982
- var column = 0;
983
- if (row < this.getLength()) {
984
- lines = lines.concat([""]);
985
- column = 0;
986
- } else {
987
- lines = [""].concat(lines);
988
- row--;
989
- column = this.$lines[row].length;
990
- }
991
- this.insertMergedLines({row: row, column: column}, lines);
992
- };
993
- this.insertMergedLines = function(position, lines) {
994
- var start = this.clippedPos(position.row, position.column);
995
- var end = {
996
- row: start.row + lines.length - 1,
997
- column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
998
- };
999
-
1000
- this.applyDelta({
1001
- start: start,
1002
- end: end,
1003
- action: "insert",
1004
- lines: lines
1005
- });
1006
-
1007
- return this.clonePos(end);
1008
- };
1009
- this.remove = function(range) {
1010
- var start = this.clippedPos(range.start.row, range.start.column);
1011
- var end = this.clippedPos(range.end.row, range.end.column);
1012
- this.applyDelta({
1013
- start: start,
1014
- end: end,
1015
- action: "remove",
1016
- lines: this.getLinesForRange({start: start, end: end})
1017
- });
1018
- return this.clonePos(start);
1019
- };
1020
- this.removeInLine = function(row, startColumn, endColumn) {
1021
- var start = this.clippedPos(row, startColumn);
1022
- var end = this.clippedPos(row, endColumn);
1023
-
1024
- this.applyDelta({
1025
- start: start,
1026
- end: end,
1027
- action: "remove",
1028
- lines: this.getLinesForRange({start: start, end: end})
1029
- }, true);
1030
-
1031
- return this.clonePos(start);
1032
- };
1033
- this.removeFullLines = function(firstRow, lastRow) {
1034
- firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
1035
- lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
1036
- var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
1037
- var deleteLastNewLine = lastRow < this.getLength() - 1;
1038
- var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
1039
- var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
1040
- var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
1041
- var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
1042
- var range = new Range(startRow, startCol, endRow, endCol);
1043
- var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
1044
-
1045
- this.applyDelta({
1046
- start: range.start,
1047
- end: range.end,
1048
- action: "remove",
1049
- lines: this.getLinesForRange(range)
1050
- });
1051
- return deletedLines;
1052
- };
1053
- this.removeNewLine = function(row) {
1054
- if (row < this.getLength() - 1 && row >= 0) {
1055
- this.applyDelta({
1056
- start: this.pos(row, this.getLine(row).length),
1057
- end: this.pos(row + 1, 0),
1058
- action: "remove",
1059
- lines: ["", ""]
1060
- });
1061
- }
1062
- };
1063
- this.replace = function(range, text) {
1064
- if (!(range instanceof Range))
1065
- range = Range.fromPoints(range.start, range.end);
1066
- if (text.length === 0 && range.isEmpty())
1067
- return range.start;
1068
- if (text == this.getTextRange(range))
1069
- return range.end;
1070
-
1071
- this.remove(range);
1072
- var end;
1073
- if (text) {
1074
- end = this.insert(range.start, text);
1075
- }
1076
- else {
1077
- end = range.start;
1078
- }
1079
-
1080
- return end;
1081
- };
1082
- this.applyDeltas = function(deltas) {
1083
- for (var i=0; i<deltas.length; i++) {
1084
- this.applyDelta(deltas[i]);
1085
- }
1086
- };
1087
- this.revertDeltas = function(deltas) {
1088
- for (var i=deltas.length-1; i>=0; i--) {
1089
- this.revertDelta(deltas[i]);
1090
- }
1091
- };
1092
- this.applyDelta = function(delta, doNotValidate) {
1093
- var isInsert = delta.action == "insert";
1094
- if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
1095
- : !Range.comparePoints(delta.start, delta.end)) {
1096
- return;
1097
- }
1098
-
1099
- if (isInsert && delta.lines.length > 20000) {
1100
- this.$splitAndapplyLargeDelta(delta, 20000);
1101
- }
1102
- else {
1103
- applyDelta(this.$lines, delta, doNotValidate);
1104
- this._signal("change", delta);
1105
- }
1106
- };
1107
-
1108
- this.$safeApplyDelta = function(delta) {
1109
- var docLength = this.$lines.length;
1110
- if (
1111
- delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
1112
- || delta.action == "insert" && delta.start.row <= docLength
1113
- ) {
1114
- this.applyDelta(delta);
1115
- }
1116
- };
1117
-
1118
- this.$splitAndapplyLargeDelta = function(delta, MAX) {
1119
- var lines = delta.lines;
1120
- var l = lines.length - MAX + 1;
1121
- var row = delta.start.row;
1122
- var column = delta.start.column;
1123
- for (var from = 0, to = 0; from < l; from = to) {
1124
- to += MAX - 1;
1125
- var chunk = lines.slice(from, to);
1126
- chunk.push("");
1127
- this.applyDelta({
1128
- start: this.pos(row + from, column),
1129
- end: this.pos(row + to, column = 0),
1130
- action: delta.action,
1131
- lines: chunk
1132
- }, true);
1133
- }
1134
- delta.lines = lines.slice(from);
1135
- delta.start.row = row + from;
1136
- delta.start.column = column;
1137
- this.applyDelta(delta, true);
1138
- };
1139
- this.revertDelta = function(delta) {
1140
- this.$safeApplyDelta({
1141
- start: this.clonePos(delta.start),
1142
- end: this.clonePos(delta.end),
1143
- action: (delta.action == "insert" ? "remove" : "insert"),
1144
- lines: delta.lines.slice()
1145
- });
1146
- };
1147
- this.indexToPosition = function(index, startRow) {
1148
- var lines = this.$lines || this.getAllLines();
1149
- var newlineLength = this.getNewLineCharacter().length;
1150
- for (var i = startRow || 0, l = lines.length; i < l; i++) {
1151
- index -= lines[i].length + newlineLength;
1152
- if (index < 0)
1153
- return {row: i, column: index + lines[i].length + newlineLength};
1154
- }
1155
- return {row: l-1, column: index + lines[l-1].length + newlineLength};
1156
- };
1157
- this.positionToIndex = function(pos, startRow) {
1158
- var lines = this.$lines || this.getAllLines();
1159
- var newlineLength = this.getNewLineCharacter().length;
1160
- var index = 0;
1161
- var row = Math.min(pos.row, lines.length);
1162
- for (var i = startRow || 0; i < row; ++i)
1163
- index += lines[i].length + newlineLength;
1164
-
1165
- return index + pos.column;
1166
- };
1167
-
1168
- }).call(Document.prototype);
1169
-
1170
- exports.Document = Document;
1171
- });
1172
-
1173
- ace.define("ace/lib/lang",[], function(require, exports, module) {
1174
- "use strict";
1175
-
1176
- exports.last = function(a) {
1177
- return a[a.length - 1];
1178
- };
1179
-
1180
- exports.stringReverse = function(string) {
1181
- return string.split("").reverse().join("");
1182
- };
1183
-
1184
- exports.stringRepeat = function (string, count) {
1185
- var result = '';
1186
- while (count > 0) {
1187
- if (count & 1)
1188
- result += string;
1189
-
1190
- if (count >>= 1)
1191
- string += string;
1192
- }
1193
- return result;
1194
- };
1195
-
1196
- var trimBeginRegexp = /^\s\s*/;
1197
- var trimEndRegexp = /\s\s*$/;
1198
-
1199
- exports.stringTrimLeft = function (string) {
1200
- return string.replace(trimBeginRegexp, '');
1201
- };
1202
-
1203
- exports.stringTrimRight = function (string) {
1204
- return string.replace(trimEndRegexp, '');
1205
- };
1206
-
1207
- exports.copyObject = function(obj) {
1208
- var copy = {};
1209
- for (var key in obj) {
1210
- copy[key] = obj[key];
1211
- }
1212
- return copy;
1213
- };
1214
-
1215
- exports.copyArray = function(array){
1216
- var copy = [];
1217
- for (var i=0, l=array.length; i<l; i++) {
1218
- if (array[i] && typeof array[i] == "object")
1219
- copy[i] = this.copyObject(array[i]);
1220
- else
1221
- copy[i] = array[i];
1222
- }
1223
- return copy;
1224
- };
1225
-
1226
- exports.deepCopy = function deepCopy(obj) {
1227
- if (typeof obj !== "object" || !obj)
1228
- return obj;
1229
- var copy;
1230
- if (Array.isArray(obj)) {
1231
- copy = [];
1232
- for (var key = 0; key < obj.length; key++) {
1233
- copy[key] = deepCopy(obj[key]);
1234
- }
1235
- return copy;
1236
- }
1237
- if (Object.prototype.toString.call(obj) !== "[object Object]")
1238
- return obj;
1239
-
1240
- copy = {};
1241
- for (var key in obj)
1242
- copy[key] = deepCopy(obj[key]);
1243
- return copy;
1244
- };
1245
-
1246
- exports.arrayToMap = function(arr) {
1247
- var map = {};
1248
- for (var i=0; i<arr.length; i++) {
1249
- map[arr[i]] = 1;
1250
- }
1251
- return map;
1252
-
1253
- };
1254
-
1255
- exports.createMap = function(props) {
1256
- var map = Object.create(null);
1257
- for (var i in props) {
1258
- map[i] = props[i];
1259
- }
1260
- return map;
1261
- };
1262
- exports.arrayRemove = function(array, value) {
1263
- for (var i = 0; i <= array.length; i++) {
1264
- if (value === array[i]) {
1265
- array.splice(i, 1);
1266
- }
1267
- }
1268
- };
1269
-
1270
- exports.escapeRegExp = function(str) {
1271
- return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1272
- };
1273
-
1274
- exports.escapeHTML = function(str) {
1275
- return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1276
- };
1277
-
1278
- exports.getMatchOffsets = function(string, regExp) {
1279
- var matches = [];
1280
-
1281
- string.replace(regExp, function(str) {
1282
- matches.push({
1283
- offset: arguments[arguments.length-2],
1284
- length: str.length
1285
- });
1286
- });
1287
-
1288
- return matches;
1289
- };
1290
- exports.deferredCall = function(fcn) {
1291
- var timer = null;
1292
- var callback = function() {
1293
- timer = null;
1294
- fcn();
1295
- };
1296
-
1297
- var deferred = function(timeout) {
1298
- deferred.cancel();
1299
- timer = setTimeout(callback, timeout || 0);
1300
- return deferred;
1301
- };
1302
-
1303
- deferred.schedule = deferred;
1304
-
1305
- deferred.call = function() {
1306
- this.cancel();
1307
- fcn();
1308
- return deferred;
1309
- };
1310
-
1311
- deferred.cancel = function() {
1312
- clearTimeout(timer);
1313
- timer = null;
1314
- return deferred;
1315
- };
1316
-
1317
- deferred.isPending = function() {
1318
- return timer;
1319
- };
1320
-
1321
- return deferred;
1322
- };
1323
-
1324
-
1325
- exports.delayedCall = function(fcn, defaultTimeout) {
1326
- var timer = null;
1327
- var callback = function() {
1328
- timer = null;
1329
- fcn();
1330
- };
1331
-
1332
- var _self = function(timeout) {
1333
- if (timer == null)
1334
- timer = setTimeout(callback, timeout || defaultTimeout);
1335
- };
1336
-
1337
- _self.delay = function(timeout) {
1338
- timer && clearTimeout(timer);
1339
- timer = setTimeout(callback, timeout || defaultTimeout);
1340
- };
1341
- _self.schedule = _self;
1342
-
1343
- _self.call = function() {
1344
- this.cancel();
1345
- fcn();
1346
- };
1347
-
1348
- _self.cancel = function() {
1349
- timer && clearTimeout(timer);
1350
- timer = null;
1351
- };
1352
-
1353
- _self.isPending = function() {
1354
- return timer;
1355
- };
1356
-
1357
- return _self;
1358
- };
1359
- });
1360
-
1361
- ace.define("ace/worker/mirror",[], function(require, exports, module) {
1362
- "use strict";
1363
-
1364
- var Range = require("../range").Range;
1365
- var Document = require("../document").Document;
1366
- var lang = require("../lib/lang");
1367
-
1368
- var Mirror = exports.Mirror = function(sender) {
1369
- this.sender = sender;
1370
- var doc = this.doc = new Document("");
1371
-
1372
- var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1373
-
1374
- var _self = this;
1375
- sender.on("change", function(e) {
1376
- var data = e.data;
1377
- if (data[0].start) {
1378
- doc.applyDeltas(data);
1379
- } else {
1380
- for (var i = 0; i < data.length; i += 2) {
1381
- if (Array.isArray(data[i+1])) {
1382
- var d = {action: "insert", start: data[i], lines: data[i+1]};
1383
- } else {
1384
- var d = {action: "remove", start: data[i], end: data[i+1]};
1385
- }
1386
- doc.applyDelta(d, true);
1387
- }
1388
- }
1389
- if (_self.$timeout)
1390
- return deferredUpdate.schedule(_self.$timeout);
1391
- _self.onUpdate();
1392
- });
1393
- };
1394
-
1395
- (function() {
1396
-
1397
- this.$timeout = 500;
1398
-
1399
- this.setTimeout = function(timeout) {
1400
- this.$timeout = timeout;
1401
- };
1402
-
1403
- this.setValue = function(value) {
1404
- this.doc.setValue(value);
1405
- this.deferredUpdate.schedule(this.$timeout);
1406
- };
1407
-
1408
- this.getValue = function(callbackId) {
1409
- this.sender.callback(this.doc.getValue(), callbackId);
1410
- };
1411
-
1412
- this.onUpdate = function() {
1413
- };
1414
-
1415
- this.isPending = function() {
1416
- return this.deferredUpdate.isPending();
1417
- };
1418
-
1419
- }).call(Mirror.prototype);
1420
-
1421
- });
1422
-
1423
- ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
1424
-
1425
- (function (root, name, factory) {
1426
- factory(exports)
1427
- }(this, 'luaparse', function (exports) {
1428
- 'use strict';
1429
-
1430
- exports.version = "0.3.1";
1431
-
1432
- var input, options, length, features, encodingMode;
1433
- var defaultOptions = exports.defaultOptions = {
1434
- wait: false
1435
- , comments: true
1436
- , scope: false
1437
- , locations: false
1438
- , ranges: false
1439
- , onCreateNode: null
1440
- , onCreateScope: null
1441
- , onDestroyScope: null
1442
- , onLocalDeclaration: null
1443
- , luaVersion: '5.1'
1444
- , encodingMode: 'none'
1445
- };
1446
-
1447
- function encodeUTF8(codepoint, highMask) {
1448
- highMask = highMask || 0;
1449
-
1450
- if (codepoint < 0x80) {
1451
- return String.fromCharCode(codepoint);
1452
- } else if (codepoint < 0x800) {
1453
- return String.fromCharCode(
1454
- highMask | 0xc0 | (codepoint >> 6) ,
1455
- highMask | 0x80 | ( codepoint & 0x3f)
1456
- );
1457
- } else if (codepoint < 0x10000) {
1458
- return String.fromCharCode(
1459
- highMask | 0xe0 | (codepoint >> 12) ,
1460
- highMask | 0x80 | ((codepoint >> 6) & 0x3f),
1461
- highMask | 0x80 | ( codepoint & 0x3f)
1462
- );
1463
- } else /* istanbul ignore else */ if (codepoint < 0x110000) {
1464
- return String.fromCharCode(
1465
- highMask | 0xf0 | (codepoint >> 18) ,
1466
- highMask | 0x80 | ((codepoint >> 12) & 0x3f),
1467
- highMask | 0x80 | ((codepoint >> 6) & 0x3f),
1468
- highMask | 0x80 | ( codepoint & 0x3f)
1469
- );
1470
- } else {
1471
- return null;
1472
- }
1473
- }
1474
-
1475
- function toHex(num, digits) {
1476
- var result = num.toString(16);
1477
- while (result.length < digits)
1478
- result = '0' + result;
1479
- return result;
1480
- }
1481
-
1482
- function checkChars(rx) {
1483
- return function (s) {
1484
- var m = rx.exec(s);
1485
- if (!m)
1486
- return s;
1487
- raise(null, errors.invalidCodeUnit, toHex(m[0].charCodeAt(0), 4).toUpperCase());
1488
- };
1489
- }
1490
-
1491
- var encodingModes = {
1492
- 'pseudo-latin1': {
1493
- fixup: checkChars(/[^\x00-\xff]/),
1494
- encodeByte: function (value) {
1495
- if (value === null)
1496
- return '';
1497
- return String.fromCharCode(value);
1498
- },
1499
- encodeUTF8: function (codepoint) {
1500
- return encodeUTF8(codepoint);
1501
- },
1502
- },
1503
- 'x-user-defined': {
1504
- fixup: checkChars(/[^\x00-\x7f\uf780-\uf7ff]/),
1505
- encodeByte: function (value) {
1506
- if (value === null)
1507
- return '';
1508
- if (value >= 0x80)
1509
- return String.fromCharCode(value | 0xf700);
1510
- return String.fromCharCode(value);
1511
- },
1512
- encodeUTF8: function (codepoint) {
1513
- return encodeUTF8(codepoint, 0xf700);
1514
- }
1515
- },
1516
- 'none': {
1517
- discardStrings: true,
1518
- fixup: function (s) {
1519
- return s;
1520
- },
1521
- encodeByte: function (value) {
1522
- return '';
1523
- },
1524
- encodeUTF8: function (codepoint) {
1525
- return '';
1526
- }
1527
- }
1528
- };
1529
-
1530
- var EOF = 1, StringLiteral = 2, Keyword = 4, Identifier = 8
1531
- , NumericLiteral = 16, Punctuator = 32, BooleanLiteral = 64
1532
- , NilLiteral = 128, VarargLiteral = 256;
1533
-
1534
- exports.tokenTypes = { EOF: EOF, StringLiteral: StringLiteral
1535
- , Keyword: Keyword, Identifier: Identifier, NumericLiteral: NumericLiteral
1536
- , Punctuator: Punctuator, BooleanLiteral: BooleanLiteral
1537
- , NilLiteral: NilLiteral, VarargLiteral: VarargLiteral
1538
- };
1539
-
1540
- var errors = exports.errors = {
1541
- unexpected: 'unexpected %1 \'%2\' near \'%3\''
1542
- , unexpectedEOF: 'unexpected symbol near \'<eof>\''
1543
- , expected: '\'%1\' expected near \'%2\''
1544
- , expectedToken: '%1 expected near \'%2\''
1545
- , unfinishedString: 'unfinished string near \'%1\''
1546
- , malformedNumber: 'malformed number near \'%1\''
1547
- , decimalEscapeTooLarge: 'decimal escape too large near \'%1\''
1548
- , invalidEscape: 'invalid escape sequence near \'%1\''
1549
- , hexadecimalDigitExpected: 'hexadecimal digit expected near \'%1\''
1550
- , braceExpected: 'missing \'%1\' near \'%2\''
1551
- , tooLargeCodepoint: 'UTF-8 value too large near \'%1\''
1552
- , unfinishedLongString: 'unfinished long string (starting at line %1) near \'%2\''
1553
- , unfinishedLongComment: 'unfinished long comment (starting at line %1) near \'%2\''
1554
- , ambiguousSyntax: 'ambiguous syntax (function call x new statement) near \'%1\''
1555
- , noLoopToBreak: 'no loop to break near \'%1\''
1556
- , labelAlreadyDefined: 'label \'%1\' already defined on line %2'
1557
- , labelNotVisible: 'no visible label \'%1\' for <goto>'
1558
- , gotoJumpInLocalScope: '<goto %1> jumps into the scope of local \'%2\''
1559
- , cannotUseVararg: 'cannot use \'...\' outside a vararg function near \'%1\''
1560
- , invalidCodeUnit: 'code unit U+%1 is not allowed in the current encoding mode'
1561
- };
1562
-
1563
- var ast = exports.ast = {
1564
- labelStatement: function(label) {
1565
- return {
1566
- type: 'LabelStatement'
1567
- , label: label
1568
- };
1569
- }
1570
-
1571
- , breakStatement: function() {
1572
- return {
1573
- type: 'BreakStatement'
1574
- };
1575
- }
1576
-
1577
- , gotoStatement: function(label) {
1578
- return {
1579
- type: 'GotoStatement'
1580
- , label: label
1581
- };
1582
- }
1583
-
1584
- , returnStatement: function(args) {
1585
- return {
1586
- type: 'ReturnStatement'
1587
- , 'arguments': args
1588
- };
1589
- }
1590
-
1591
- , ifStatement: function(clauses) {
1592
- return {
1593
- type: 'IfStatement'
1594
- , clauses: clauses
1595
- };
1596
- }
1597
- , ifClause: function(condition, body) {
1598
- return {
1599
- type: 'IfClause'
1600
- , condition: condition
1601
- , body: body
1602
- };
1603
- }
1604
- , elseifClause: function(condition, body) {
1605
- return {
1606
- type: 'ElseifClause'
1607
- , condition: condition
1608
- , body: body
1609
- };
1610
- }
1611
- , elseClause: function(body) {
1612
- return {
1613
- type: 'ElseClause'
1614
- , body: body
1615
- };
1616
- }
1617
-
1618
- , whileStatement: function(condition, body) {
1619
- return {
1620
- type: 'WhileStatement'
1621
- , condition: condition
1622
- , body: body
1623
- };
1624
- }
1625
-
1626
- , doStatement: function(body) {
1627
- return {
1628
- type: 'DoStatement'
1629
- , body: body
1630
- };
1631
- }
1632
-
1633
- , repeatStatement: function(condition, body) {
1634
- return {
1635
- type: 'RepeatStatement'
1636
- , condition: condition
1637
- , body: body
1638
- };
1639
- }
1640
-
1641
- , localStatement: function(variables, init) {
1642
- return {
1643
- type: 'LocalStatement'
1644
- , variables: variables
1645
- , init: init
1646
- };
1647
- }
1648
-
1649
- , assignmentStatement: function(variables, init) {
1650
- return {
1651
- type: 'AssignmentStatement'
1652
- , variables: variables
1653
- , init: init
1654
- };
1655
- }
1656
-
1657
- , callStatement: function(expression) {
1658
- return {
1659
- type: 'CallStatement'
1660
- , expression: expression
1661
- };
1662
- }
1663
-
1664
- , functionStatement: function(identifier, parameters, isLocal, body) {
1665
- return {
1666
- type: 'FunctionDeclaration'
1667
- , identifier: identifier
1668
- , isLocal: isLocal
1669
- , parameters: parameters
1670
- , body: body
1671
- };
1672
- }
1673
-
1674
- , forNumericStatement: function(variable, start, end, step, body) {
1675
- return {
1676
- type: 'ForNumericStatement'
1677
- , variable: variable
1678
- , start: start
1679
- , end: end
1680
- , step: step
1681
- , body: body
1682
- };
1683
- }
1684
-
1685
- , forGenericStatement: function(variables, iterators, body) {
1686
- return {
1687
- type: 'ForGenericStatement'
1688
- , variables: variables
1689
- , iterators: iterators
1690
- , body: body
1691
- };
1692
- }
1693
-
1694
- , chunk: function(body) {
1695
- return {
1696
- type: 'Chunk'
1697
- , body: body
1698
- };
1699
- }
1700
-
1701
- , identifier: function(name) {
1702
- return {
1703
- type: 'Identifier'
1704
- , name: name
1705
- };
1706
- }
1707
-
1708
- , literal: function(type, value, raw) {
1709
- type = (type === StringLiteral) ? 'StringLiteral'
1710
- : (type === NumericLiteral) ? 'NumericLiteral'
1711
- : (type === BooleanLiteral) ? 'BooleanLiteral'
1712
- : (type === NilLiteral) ? 'NilLiteral'
1713
- : 'VarargLiteral';
1714
-
1715
- return {
1716
- type: type
1717
- , value: value
1718
- , raw: raw
1719
- };
1720
- }
1721
-
1722
- , tableKey: function(key, value) {
1723
- return {
1724
- type: 'TableKey'
1725
- , key: key
1726
- , value: value
1727
- };
1728
- }
1729
- , tableKeyString: function(key, value) {
1730
- return {
1731
- type: 'TableKeyString'
1732
- , key: key
1733
- , value: value
1734
- };
1735
- }
1736
- , tableValue: function(value) {
1737
- return {
1738
- type: 'TableValue'
1739
- , value: value
1740
- };
1741
- }
1742
-
1743
-
1744
- , tableConstructorExpression: function(fields) {
1745
- return {
1746
- type: 'TableConstructorExpression'
1747
- , fields: fields
1748
- };
1749
- }
1750
- , binaryExpression: function(operator, left, right) {
1751
- var type = ('and' === operator || 'or' === operator) ?
1752
- 'LogicalExpression' :
1753
- 'BinaryExpression';
1754
-
1755
- return {
1756
- type: type
1757
- , operator: operator
1758
- , left: left
1759
- , right: right
1760
- };
1761
- }
1762
- , unaryExpression: function(operator, argument) {
1763
- return {
1764
- type: 'UnaryExpression'
1765
- , operator: operator
1766
- , argument: argument
1767
- };
1768
- }
1769
- , memberExpression: function(base, indexer, identifier) {
1770
- return {
1771
- type: 'MemberExpression'
1772
- , indexer: indexer
1773
- , identifier: identifier
1774
- , base: base
1775
- };
1776
- }
1777
-
1778
- , indexExpression: function(base, index) {
1779
- return {
1780
- type: 'IndexExpression'
1781
- , base: base
1782
- , index: index
1783
- };
1784
- }
1785
-
1786
- , callExpression: function(base, args) {
1787
- return {
1788
- type: 'CallExpression'
1789
- , base: base
1790
- , 'arguments': args
1791
- };
1792
- }
1793
-
1794
- , tableCallExpression: function(base, args) {
1795
- return {
1796
- type: 'TableCallExpression'
1797
- , base: base
1798
- , 'arguments': args
1799
- };
1800
- }
1801
-
1802
- , stringCallExpression: function(base, argument) {
1803
- return {
1804
- type: 'StringCallExpression'
1805
- , base: base
1806
- , argument: argument
1807
- };
1808
- }
1809
-
1810
- , comment: function(value, raw) {
1811
- return {
1812
- type: 'Comment'
1813
- , value: value
1814
- , raw: raw
1815
- };
1816
- }
1817
- };
1818
-
1819
- function finishNode(node) {
1820
- if (trackLocations) {
1821
- var location = locations.pop();
1822
- location.complete();
1823
- location.bless(node);
1824
- }
1825
- if (options.onCreateNode) options.onCreateNode(node);
1826
- return node;
1827
- }
1828
-
1829
- var slice = Array.prototype.slice
1830
- , toString = Object.prototype.toString
1831
- ;
1832
-
1833
- var indexOf = /* istanbul ignore next */ function (array, element) {
1834
- for (var i = 0, length = array.length; i < length; ++i) {
1835
- if (array[i] === element) return i;
1836
- }
1837
- return -1;
1838
- };
1839
- if (Array.prototype.indexOf)
1840
- indexOf = function (array, element) {
1841
- return array.indexOf(element);
1842
- };
1843
-
1844
- function indexOfObject(array, property, element) {
1845
- for (var i = 0, length = array.length; i < length; ++i) {
1846
- if (array[i][property] === element) return i;
1847
- }
1848
- return -1;
1849
- }
1850
-
1851
- function sprintf(format) {
1852
- var args = slice.call(arguments, 1);
1853
- format = format.replace(/%(\d)/g, function (match, index) {
1854
- return '' + args[index - 1] || /* istanbul ignore next */ '';
1855
- });
1856
- return format;
1857
- }
1858
-
1859
- var assign = /* istanbul ignore next */ function (dest) {
1860
- var args = slice.call(arguments, 1)
1861
- , src, prop;
1862
-
1863
- for (var i = 0, length = args.length; i < length; ++i) {
1864
- src = args[i];
1865
- for (prop in src)
1866
- if (Object.prototype.hasOwnProperty.call(src, prop)) {
1867
- dest[prop] = src[prop];
1868
- }
1869
- }
1870
-
1871
- return dest;
1872
- };
1873
- if (Object.assign)
1874
- assign = Object.assign;
1875
-
1876
- exports.SyntaxError = SyntaxError;
1877
-
1878
- function fixupError(e) {
1879
- if (!Object.create)
1880
- return e;
1881
- return Object.create(e, {
1882
- 'line': { 'writable': true, value: e.line },
1883
- 'index': { 'writable': true, value: e.index },
1884
- 'column': { 'writable': true, value: e.column }
1885
- });
1886
- }
1887
-
1888
- function raise(token) {
1889
- var message = sprintf.apply(null, slice.call(arguments, 1))
1890
- , error, col;
1891
-
1892
- if (token === null || typeof token.line === 'undefined') {
1893
- col = index - lineStart + 1;
1894
- error = fixupError(new SyntaxError(sprintf('[%1:%2] %3', line, col, message)));
1895
- error.index = index;
1896
- error.line = line;
1897
- error.column = col;
1898
- } else {
1899
- col = token.range[0] - token.lineStart;
1900
- error = fixupError(new SyntaxError(sprintf('[%1:%2] %3', token.line, col, message)));
1901
- error.line = token.line;
1902
- error.index = token.range[0];
1903
- error.column = col;
1904
- }
1905
- throw error;
1906
- }
1907
-
1908
- function tokenValue(token) {
1909
- var raw = input.slice(token.range[0], token.range[1]);
1910
- if (raw)
1911
- return raw;
1912
- return token.value;
1913
- }
1914
-
1915
- function raiseUnexpectedToken(type, token) {
1916
- raise(token, errors.expectedToken, type, tokenValue(token));
1917
- }
1918
-
1919
- function unexpected(found) {
1920
- var near = tokenValue(lookahead);
1921
- if ('undefined' !== typeof found.type) {
1922
- var type;
1923
- switch (found.type) {
1924
- case StringLiteral: type = 'string'; break;
1925
- case Keyword: type = 'keyword'; break;
1926
- case Identifier: type = 'identifier'; break;
1927
- case NumericLiteral: type = 'number'; break;
1928
- case Punctuator: type = 'symbol'; break;
1929
- case BooleanLiteral: type = 'boolean'; break;
1930
- case NilLiteral:
1931
- return raise(found, errors.unexpected, 'symbol', 'nil', near);
1932
- case EOF:
1933
- return raise(found, errors.unexpectedEOF);
1934
- }
1935
- return raise(found, errors.unexpected, type, tokenValue(found), near);
1936
- }
1937
- return raise(found, errors.unexpected, 'symbol', found, near);
1938
- }
1939
-
1940
- var index
1941
- , token
1942
- , previousToken
1943
- , lookahead
1944
- , comments
1945
- , tokenStart
1946
- , line
1947
- , lineStart;
1948
-
1949
- exports.lex = lex;
1950
-
1951
- function lex() {
1952
- skipWhiteSpace();
1953
- while (45 === input.charCodeAt(index) &&
1954
- 45 === input.charCodeAt(index + 1)) {
1955
- scanComment();
1956
- skipWhiteSpace();
1957
- }
1958
- if (index >= length) return {
1959
- type : EOF
1960
- , value: '<eof>'
1961
- , line: line
1962
- , lineStart: lineStart
1963
- , range: [index, index]
1964
- };
1965
-
1966
- var charCode = input.charCodeAt(index)
1967
- , next = input.charCodeAt(index + 1);
1968
- tokenStart = index;
1969
- if (isIdentifierStart(charCode)) return scanIdentifierOrKeyword();
1970
-
1971
- switch (charCode) {
1972
- case 39: case 34: // '"
1973
- return scanStringLiteral();
1974
-
1975
- case 48: case 49: case 50: case 51: case 52: case 53:
1976
- case 54: case 55: case 56: case 57: // 0-9
1977
- return scanNumericLiteral();
1978
-
1979
- case 46: // .
1980
- if (isDecDigit(next)) return scanNumericLiteral();
1981
- if (46 === next) {
1982
- if (46 === input.charCodeAt(index + 2)) return scanVarargLiteral();
1983
- return scanPunctuator('..');
1984
- }
1985
- return scanPunctuator('.');
1986
-
1987
- case 61: // =
1988
- if (61 === next) return scanPunctuator('==');
1989
- return scanPunctuator('=');
1990
-
1991
- case 62: // >
1992
- if (features.bitwiseOperators)
1993
- if (62 === next) return scanPunctuator('>>');
1994
- if (61 === next) return scanPunctuator('>=');
1995
- return scanPunctuator('>');
1996
-
1997
- case 60: // <
1998
- if (features.bitwiseOperators)
1999
- if (60 === next) return scanPunctuator('<<');
2000
- if (61 === next) return scanPunctuator('<=');
2001
- return scanPunctuator('<');
2002
-
2003
- case 126: // ~
2004
- if (61 === next) return scanPunctuator('~=');
2005
- if (!features.bitwiseOperators)
2006
- break;
2007
- return scanPunctuator('~');
2008
-
2009
- case 58: // :
2010
- if (features.labels)
2011
- if (58 === next) return scanPunctuator('::');
2012
- return scanPunctuator(':');
2013
-
2014
- case 91: // [
2015
- if (91 === next || 61 === next) return scanLongStringLiteral();
2016
- return scanPunctuator('[');
2017
-
2018
- case 47: // /
2019
- if (features.integerDivision)
2020
- if (47 === next) return scanPunctuator('//');
2021
- return scanPunctuator('/');
2022
-
2023
- case 38: case 124: // & |
2024
- if (!features.bitwiseOperators)
2025
- break;
2026
- case 42: case 94: case 37: case 44: case 123: case 125:
2027
- case 93: case 40: case 41: case 59: case 35: case 45:
2028
- case 43: // * ^ % , { } ] ( ) ; # - +
2029
- return scanPunctuator(input.charAt(index));
2030
- }
2031
-
2032
- return unexpected(input.charAt(index));
2033
- }
2034
-
2035
- function consumeEOL() {
2036
- var charCode = input.charCodeAt(index)
2037
- , peekCharCode = input.charCodeAt(index + 1);
2038
-
2039
- if (isLineTerminator(charCode)) {
2040
- if (10 === charCode && 13 === peekCharCode) ++index;
2041
- if (13 === charCode && 10 === peekCharCode) ++index;
2042
- ++line;
2043
- lineStart = ++index;
2044
-
2045
- return true;
2046
- }
2047
- return false;
2048
- }
2049
-
2050
- function skipWhiteSpace() {
2051
- while (index < length) {
2052
- var charCode = input.charCodeAt(index);
2053
- if (isWhiteSpace(charCode)) {
2054
- ++index;
2055
- } else if (!consumeEOL()) {
2056
- break;
2057
- }
2058
- }
2059
- }
2060
-
2061
- function scanIdentifierOrKeyword() {
2062
- var value, type;
2063
- while (isIdentifierPart(input.charCodeAt(++index)));
2064
- value = encodingMode.fixup(input.slice(tokenStart, index));
2065
- if (isKeyword(value)) {
2066
- type = Keyword;
2067
- } else if ('true' === value || 'false' === value) {
2068
- type = BooleanLiteral;
2069
- value = ('true' === value);
2070
- } else if ('nil' === value) {
2071
- type = NilLiteral;
2072
- value = null;
2073
- } else {
2074
- type = Identifier;
2075
- }
2076
-
2077
- return {
2078
- type: type
2079
- , value: value
2080
- , line: line
2081
- , lineStart: lineStart
2082
- , range: [tokenStart, index]
2083
- };
2084
- }
2085
-
2086
- function scanPunctuator(value) {
2087
- index += value.length;
2088
- return {
2089
- type: Punctuator
2090
- , value: value
2091
- , line: line
2092
- , lineStart: lineStart
2093
- , range: [tokenStart, index]
2094
- };
2095
- }
2096
-
2097
- function scanVarargLiteral() {
2098
- index += 3;
2099
- return {
2100
- type: VarargLiteral
2101
- , value: '...'
2102
- , line: line
2103
- , lineStart: lineStart
2104
- , range: [tokenStart, index]
2105
- };
2106
- }
2107
-
2108
- function scanStringLiteral() {
2109
- var delimiter = input.charCodeAt(index++)
2110
- , beginLine = line
2111
- , beginLineStart = lineStart
2112
- , stringStart = index
2113
- , string = encodingMode.discardStrings ? null : ''
2114
- , charCode;
2115
-
2116
- for (;;) {
2117
- charCode = input.charCodeAt(index++);
2118
- if (delimiter === charCode) break;
2119
- if (index > length || isLineTerminator(charCode)) {
2120
- string += input.slice(stringStart, index - 1);
2121
- raise(null, errors.unfinishedString, input.slice(tokenStart, index - 1));
2122
- }
2123
- if (92 === charCode) { // backslash
2124
- if (!encodingMode.discardStrings) {
2125
- var beforeEscape = input.slice(stringStart, index - 1);
2126
- string += encodingMode.fixup(beforeEscape);
2127
- }
2128
- var escapeValue = readEscapeSequence();
2129
- if (!encodingMode.discardStrings)
2130
- string += escapeValue;
2131
- stringStart = index;
2132
- }
2133
- }
2134
- if (!encodingMode.discardStrings) {
2135
- string += encodingMode.encodeByte(null);
2136
- string += encodingMode.fixup(input.slice(stringStart, index - 1));
2137
- }
2138
-
2139
- return {
2140
- type: StringLiteral
2141
- , value: string
2142
- , line: beginLine
2143
- , lineStart: beginLineStart
2144
- , lastLine: line
2145
- , lastLineStart: lineStart
2146
- , range: [tokenStart, index]
2147
- };
2148
- }
2149
-
2150
- function scanLongStringLiteral() {
2151
- var beginLine = line
2152
- , beginLineStart = lineStart
2153
- , string = readLongString(false);
2154
- if (false === string) raise(token, errors.expected, '[', tokenValue(token));
2155
-
2156
- return {
2157
- type: StringLiteral
2158
- , value: encodingMode.discardStrings ? null : encodingMode.fixup(string)
2159
- , line: beginLine
2160
- , lineStart: beginLineStart
2161
- , lastLine: line
2162
- , lastLineStart: lineStart
2163
- , range: [tokenStart, index]
2164
- };
2165
- }
2166
-
2167
- function scanNumericLiteral() {
2168
- var character = input.charAt(index)
2169
- , next = input.charAt(index + 1);
2170
-
2171
- var literal = ('0' === character && 'xX'.indexOf(next || null) >= 0) ?
2172
- readHexLiteral() : readDecLiteral();
2173
-
2174
- var foundImaginaryUnit = readImaginaryUnitSuffix()
2175
- , foundInt64Suffix = readInt64Suffix();
2176
-
2177
- if (foundInt64Suffix && (foundImaginaryUnit || literal.hasFractionPart)) {
2178
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2179
- }
2180
-
2181
- return {
2182
- type: NumericLiteral
2183
- , value: literal.value
2184
- , line: line
2185
- , lineStart: lineStart
2186
- , range: [tokenStart, index]
2187
- };
2188
- }
2189
-
2190
- function readImaginaryUnitSuffix() {
2191
- if (!features.imaginaryNumbers) return;
2192
- if ('iI'.indexOf(input.charAt(index) || null) >= 0) {
2193
- ++index;
2194
- return true;
2195
- } else {
2196
- return false;
2197
- }
2198
- }
2199
-
2200
- function readInt64Suffix() {
2201
- if (!features.integerSuffixes) return;
2202
-
2203
- if ('uU'.indexOf(input.charAt(index) || null) >= 0) {
2204
- ++index;
2205
- if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
2206
- ++index;
2207
- if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
2208
- ++index;
2209
- return 'ULL';
2210
- } else {
2211
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2212
- }
2213
- } else {
2214
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2215
- }
2216
- } else if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
2217
- ++index;
2218
- if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
2219
- ++index;
2220
- return 'LL';
2221
- } else {
2222
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2223
- }
2224
- }
2225
- }
2226
-
2227
- function readHexLiteral() {
2228
- var fraction = 0 // defaults to 0 as it gets summed
2229
- , binaryExponent = 1 // defaults to 1 as it gets multiplied
2230
- , binarySign = 1 // positive
2231
- , digit, fractionStart, exponentStart, digitStart;
2232
-
2233
- digitStart = index += 2; // Skip 0x part
2234
- if (!isHexDigit(input.charCodeAt(index)))
2235
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2236
-
2237
- while (isHexDigit(input.charCodeAt(index))) ++index;
2238
- digit = parseInt(input.slice(digitStart, index), 16);
2239
- var foundFraction = false;
2240
- if ('.' === input.charAt(index)) {
2241
- foundFraction = true;
2242
- fractionStart = ++index;
2243
-
2244
- while (isHexDigit(input.charCodeAt(index))) ++index;
2245
- fraction = input.slice(fractionStart, index);
2246
- fraction = (fractionStart === index) ? 0
2247
- : parseInt(fraction, 16) / Math.pow(16, index - fractionStart);
2248
- }
2249
- var foundBinaryExponent = false;
2250
- if ('pP'.indexOf(input.charAt(index) || null) >= 0) {
2251
- foundBinaryExponent = true;
2252
- ++index;
2253
- if ('+-'.indexOf(input.charAt(index) || null) >= 0)
2254
- binarySign = ('+' === input.charAt(index++)) ? 1 : -1;
2255
-
2256
- exponentStart = index;
2257
- if (!isDecDigit(input.charCodeAt(index)))
2258
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2259
-
2260
- while (isDecDigit(input.charCodeAt(index))) ++index;
2261
- binaryExponent = input.slice(exponentStart, index);
2262
- binaryExponent = Math.pow(2, binaryExponent * binarySign);
2263
- }
2264
-
2265
- return {
2266
- value: (digit + fraction) * binaryExponent,
2267
- hasFractionPart: foundFraction || foundBinaryExponent
2268
- };
2269
- }
2270
-
2271
- function readDecLiteral() {
2272
- while (isDecDigit(input.charCodeAt(index))) ++index;
2273
- var foundFraction = false;
2274
- if ('.' === input.charAt(index)) {
2275
- foundFraction = true;
2276
- ++index;
2277
- while (isDecDigit(input.charCodeAt(index))) ++index;
2278
- }
2279
- var foundExponent = false;
2280
- if ('eE'.indexOf(input.charAt(index) || null) >= 0) {
2281
- foundExponent = true;
2282
- ++index;
2283
- if ('+-'.indexOf(input.charAt(index) || null) >= 0) ++index;
2284
- if (!isDecDigit(input.charCodeAt(index)))
2285
- raise(null, errors.malformedNumber, input.slice(tokenStart, index));
2286
-
2287
- while (isDecDigit(input.charCodeAt(index))) ++index;
2288
- }
2289
-
2290
- return {
2291
- value: parseFloat(input.slice(tokenStart, index)),
2292
- hasFractionPart: foundFraction || foundExponent
2293
- };
2294
- }
2295
-
2296
- function readUnicodeEscapeSequence() {
2297
- var sequenceStart = index++;
2298
-
2299
- if (input.charAt(index++) !== '{')
2300
- raise(null, errors.braceExpected, '{', '\\' + input.slice(sequenceStart, index));
2301
- if (!isHexDigit(input.charCodeAt(index)))
2302
- raise(null, errors.hexadecimalDigitExpected, '\\' + input.slice(sequenceStart, index));
2303
-
2304
- while (input.charCodeAt(index) === 0x30) ++index;
2305
- var escStart = index;
2306
-
2307
- while (isHexDigit(input.charCodeAt(index))) {
2308
- ++index;
2309
- if (index - escStart > 6)
2310
- raise(null, errors.tooLargeCodepoint, '\\' + input.slice(sequenceStart, index));
2311
- }
2312
-
2313
- var b = input.charAt(index++);
2314
- if (b !== '}') {
2315
- if ((b === '"') || (b === "'"))
2316
- raise(null, errors.braceExpected, '}', '\\' + input.slice(sequenceStart, index--));
2317
- else
2318
- raise(null, errors.hexadecimalDigitExpected, '\\' + input.slice(sequenceStart, index));
2319
- }
2320
-
2321
- var codepoint = parseInt(input.slice(escStart, index - 1) || '0', 16);
2322
- var frag = '\\' + input.slice(sequenceStart, index);
2323
-
2324
- if (codepoint > 0x10ffff) {
2325
- raise(null, errors.tooLargeCodepoint, frag);
2326
- }
2327
-
2328
- return encodingMode.encodeUTF8(codepoint, frag);
2329
- }
2330
- function readEscapeSequence() {
2331
- var sequenceStart = index;
2332
- switch (input.charAt(index)) {
2333
- case 'a': ++index; return '\x07';
2334
- case 'n': ++index; return '\n';
2335
- case 'r': ++index; return '\r';
2336
- case 't': ++index; return '\t';
2337
- case 'v': ++index; return '\x0b';
2338
- case 'b': ++index; return '\b';
2339
- case 'f': ++index; return '\f';
2340
- case '\r':
2341
- case '\n':
2342
- consumeEOL();
2343
- return '\n';
2344
-
2345
- case '0': case '1': case '2': case '3': case '4':
2346
- case '5': case '6': case '7': case '8': case '9':
2347
- while (isDecDigit(input.charCodeAt(index)) && index - sequenceStart < 3) ++index;
2348
-
2349
- var frag = input.slice(sequenceStart, index);
2350
- var ddd = parseInt(frag, 10);
2351
- if (ddd > 255) {
2352
- raise(null, errors.decimalEscapeTooLarge, '\\' + ddd);
2353
- }
2354
- return encodingMode.encodeByte(ddd, '\\' + frag);
2355
-
2356
- case 'z':
2357
- if (features.skipWhitespaceEscape) {
2358
- ++index;
2359
- skipWhiteSpace();
2360
- return '';
2361
- }
2362
- break;
2363
-
2364
- case 'x':
2365
- if (features.hexEscapes) {
2366
- if (isHexDigit(input.charCodeAt(index + 1)) &&
2367
- isHexDigit(input.charCodeAt(index + 2))) {
2368
- index += 3;
2369
- return encodingMode.encodeByte(parseInt(input.slice(sequenceStart + 1, index), 16), '\\' + input.slice(sequenceStart, index));
2370
- }
2371
- raise(null, errors.hexadecimalDigitExpected, '\\' + input.slice(sequenceStart, index + 2));
2372
- }
2373
- break;
2374
-
2375
- case 'u':
2376
- if (features.unicodeEscapes)
2377
- return readUnicodeEscapeSequence();
2378
- break;
2379
-
2380
- case '\\': case '"': case "'":
2381
- return input.charAt(index++);
2382
- }
2383
-
2384
- if (features.strictEscapes)
2385
- raise(null, errors.invalidEscape, '\\' + input.slice(sequenceStart, index + 1));
2386
- return input.charAt(index++);
2387
- }
2388
-
2389
- function scanComment() {
2390
- tokenStart = index;
2391
- index += 2; // --
2392
-
2393
- var character = input.charAt(index)
2394
- , content = ''
2395
- , isLong = false
2396
- , commentStart = index
2397
- , lineStartComment = lineStart
2398
- , lineComment = line;
2399
-
2400
- if ('[' === character) {
2401
- content = readLongString(true);
2402
- if (false === content) content = character;
2403
- else isLong = true;
2404
- }
2405
- if (!isLong) {
2406
- while (index < length) {
2407
- if (isLineTerminator(input.charCodeAt(index))) break;
2408
- ++index;
2409
- }
2410
- if (options.comments) content = input.slice(commentStart, index);
2411
- }
2412
-
2413
- if (options.comments) {
2414
- var node = ast.comment(content, input.slice(tokenStart, index));
2415
- if (options.locations) {
2416
- node.loc = {
2417
- start: { line: lineComment, column: tokenStart - lineStartComment }
2418
- , end: { line: line, column: index - lineStart }
2419
- };
2420
- }
2421
- if (options.ranges) {
2422
- node.range = [tokenStart, index];
2423
- }
2424
- if (options.onCreateNode) options.onCreateNode(node);
2425
- comments.push(node);
2426
- }
2427
- }
2428
-
2429
- function readLongString(isComment) {
2430
- var level = 0
2431
- , content = ''
2432
- , terminator = false
2433
- , character, stringStart, firstLine = line;
2434
-
2435
- ++index; // [
2436
- while ('=' === input.charAt(index + level)) ++level;
2437
- if ('[' !== input.charAt(index + level)) return false;
2438
-
2439
- index += level + 1;
2440
- if (isLineTerminator(input.charCodeAt(index))) consumeEOL();
2441
-
2442
- stringStart = index;
2443
- while (index < length) {
2444
- while (isLineTerminator(input.charCodeAt(index))) consumeEOL();
2445
-
2446
- character = input.charAt(index++);
2447
- if (']' === character) {
2448
- terminator = true;
2449
- for (var i = 0; i < level; ++i) {
2450
- if ('=' !== input.charAt(index + i)) terminator = false;
2451
- }
2452
- if (']' !== input.charAt(index + level)) terminator = false;
2453
- }
2454
- if (terminator) {
2455
- content += input.slice(stringStart, index - 1);
2456
- index += level + 1;
2457
- return content;
2458
- }
2459
- }
2460
-
2461
- raise(null, isComment ?
2462
- errors.unfinishedLongComment :
2463
- errors.unfinishedLongString,
2464
- firstLine, '<eof>');
2465
- }
2466
-
2467
- function next() {
2468
- previousToken = token;
2469
- token = lookahead;
2470
- lookahead = lex();
2471
- }
2472
-
2473
- function consume(value) {
2474
- if (value === token.value) {
2475
- next();
2476
- return true;
2477
- }
2478
- return false;
2479
- }
2480
-
2481
- function expect(value) {
2482
- if (value === token.value) next();
2483
- else raise(token, errors.expected, value, tokenValue(token));
2484
- }
2485
-
2486
- function isWhiteSpace(charCode) {
2487
- return 9 === charCode || 32 === charCode || 0xB === charCode || 0xC === charCode;
2488
- }
2489
-
2490
- function isLineTerminator(charCode) {
2491
- return 10 === charCode || 13 === charCode;
2492
- }
2493
-
2494
- function isDecDigit(charCode) {
2495
- return charCode >= 48 && charCode <= 57;
2496
- }
2497
-
2498
- function isHexDigit(charCode) {
2499
- return (charCode >= 48 && charCode <= 57) || (charCode >= 97 && charCode <= 102) || (charCode >= 65 && charCode <= 70);
2500
- }
2501
-
2502
- function isIdentifierStart(charCode) {
2503
- if ((charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode)
2504
- return true;
2505
- if (features.extendedIdentifiers && charCode >= 128)
2506
- return true;
2507
- return false;
2508
- }
2509
-
2510
- function isIdentifierPart(charCode) {
2511
- if ((charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode || (charCode >= 48 && charCode <= 57))
2512
- return true;
2513
- if (features.extendedIdentifiers && charCode >= 128)
2514
- return true;
2515
- return false;
2516
- }
2517
-
2518
- function isKeyword(id) {
2519
- switch (id.length) {
2520
- case 2:
2521
- return 'do' === id || 'if' === id || 'in' === id || 'or' === id;
2522
- case 3:
2523
- return 'and' === id || 'end' === id || 'for' === id || 'not' === id;
2524
- case 4:
2525
- if ('else' === id || 'then' === id)
2526
- return true;
2527
- if (features.labels && !features.contextualGoto)
2528
- return ('goto' === id);
2529
- return false;
2530
- case 5:
2531
- return 'break' === id || 'local' === id || 'until' === id || 'while' === id;
2532
- case 6:
2533
- return 'elseif' === id || 'repeat' === id || 'return' === id;
2534
- case 8:
2535
- return 'function' === id;
2536
- }
2537
- return false;
2538
- }
2539
-
2540
- function isUnary(token) {
2541
- if (Punctuator === token.type) return '#-~'.indexOf(token.value) >= 0;
2542
- if (Keyword === token.type) return 'not' === token.value;
2543
- return false;
2544
- }
2545
-
2546
- function isBlockFollow(token) {
2547
- if (EOF === token.type) return true;
2548
- if (Keyword !== token.type) return false;
2549
- switch (token.value) {
2550
- case 'else': case 'elseif':
2551
- case 'end': case 'until':
2552
- return true;
2553
- default:
2554
- return false;
2555
- }
2556
- }
2557
- var scopes
2558
- , scopeDepth
2559
- , globals;
2560
- function createScope() {
2561
- var scope = scopes[scopeDepth++].slice();
2562
- scopes.push(scope);
2563
- if (options.onCreateScope) options.onCreateScope();
2564
- }
2565
- function destroyScope() {
2566
- var scope = scopes.pop();
2567
- --scopeDepth;
2568
- if (options.onDestroyScope) options.onDestroyScope();
2569
- }
2570
- function scopeIdentifierName(name) {
2571
- if (options.onLocalDeclaration) options.onLocalDeclaration(name);
2572
- if (-1 !== indexOf(scopes[scopeDepth], name)) return;
2573
- scopes[scopeDepth].push(name);
2574
- }
2575
- function scopeIdentifier(node) {
2576
- scopeIdentifierName(node.name);
2577
- attachScope(node, true);
2578
- }
2579
- function attachScope(node, isLocal) {
2580
- if (!isLocal && -1 === indexOfObject(globals, 'name', node.name))
2581
- globals.push(node);
2582
-
2583
- node.isLocal = isLocal;
2584
- }
2585
- function scopeHasName(name) {
2586
- return (-1 !== indexOf(scopes[scopeDepth], name));
2587
- }
2588
-
2589
- var locations = []
2590
- , trackLocations;
2591
-
2592
- function createLocationMarker() {
2593
- return new Marker(token);
2594
- }
2595
-
2596
- function Marker(token) {
2597
- if (options.locations) {
2598
- this.loc = {
2599
- start: {
2600
- line: token.line
2601
- , column: token.range[0] - token.lineStart
2602
- }
2603
- , end: {
2604
- line: 0
2605
- , column: 0
2606
- }
2607
- };
2608
- }
2609
- if (options.ranges) this.range = [token.range[0], 0];
2610
- }
2611
- Marker.prototype.complete = function() {
2612
- if (options.locations) {
2613
- this.loc.end.line = previousToken.lastLine || previousToken.line;
2614
- this.loc.end.column = previousToken.range[1] - (previousToken.lastLineStart || previousToken.lineStart);
2615
- }
2616
- if (options.ranges) {
2617
- this.range[1] = previousToken.range[1];
2618
- }
2619
- };
2620
-
2621
- Marker.prototype.bless = function (node) {
2622
- if (this.loc) {
2623
- var loc = this.loc;
2624
- node.loc = {
2625
- start: {
2626
- line: loc.start.line,
2627
- column: loc.start.column
2628
- },
2629
- end: {
2630
- line: loc.end.line,
2631
- column: loc.end.column
2632
- }
2633
- };
2634
- }
2635
- if (this.range) {
2636
- node.range = [
2637
- this.range[0],
2638
- this.range[1]
2639
- ];
2640
- }
2641
- };
2642
- function markLocation() {
2643
- if (trackLocations) locations.push(createLocationMarker());
2644
- }
2645
- function pushLocation(marker) {
2646
- if (trackLocations) locations.push(marker);
2647
- }
2648
-
2649
- function FullFlowContext() {
2650
- this.scopes = [];
2651
- this.pendingGotos = [];
2652
- }
2653
-
2654
- FullFlowContext.prototype.isInLoop = function () {
2655
- var i = this.scopes.length;
2656
- while (i --> 0) {
2657
- if (this.scopes[i].isLoop)
2658
- return true;
2659
- }
2660
- return false;
2661
- };
2662
-
2663
- FullFlowContext.prototype.pushScope = function (isLoop) {
2664
- var scope = {
2665
- labels: {},
2666
- locals: [],
2667
- deferredGotos: [],
2668
- isLoop: !!isLoop
2669
- };
2670
- this.scopes.push(scope);
2671
- };
2672
-
2673
- FullFlowContext.prototype.popScope = function () {
2674
- for (var i = 0; i < this.pendingGotos.length; ++i) {
2675
- var theGoto = this.pendingGotos[i];
2676
- if (theGoto.maxDepth >= this.scopes.length)
2677
- if (--theGoto.maxDepth <= 0)
2678
- raise(theGoto.token, errors.labelNotVisible, theGoto.target);
2679
- }
2680
-
2681
- this.scopes.pop();
2682
- };
2683
-
2684
- FullFlowContext.prototype.addGoto = function (target, token) {
2685
- var localCounts = [];
2686
-
2687
- for (var i = 0; i < this.scopes.length; ++i) {
2688
- var scope = this.scopes[i];
2689
- localCounts.push(scope.locals.length);
2690
- if (Object.prototype.hasOwnProperty.call(scope.labels, target))
2691
- return;
2692
- }
2693
-
2694
- this.pendingGotos.push({
2695
- maxDepth: this.scopes.length,
2696
- target: target,
2697
- token: token,
2698
- localCounts: localCounts
2699
- });
2700
- };
2701
-
2702
- FullFlowContext.prototype.addLabel = function (name, token) {
2703
- var scope = this.currentScope();
2704
-
2705
- if (Object.prototype.hasOwnProperty.call(scope.labels, name)) {
2706
- raise(token, errors.labelAlreadyDefined, name, scope.labels[name].line);
2707
- } else {
2708
- var newGotos = [];
2709
-
2710
- for (var i = 0; i < this.pendingGotos.length; ++i) {
2711
- var theGoto = this.pendingGotos[i];
2712
-
2713
- if (theGoto.maxDepth >= this.scopes.length && theGoto.target === name) {
2714
- if (theGoto.localCounts[this.scopes.length - 1] < scope.locals.length) {
2715
- scope.deferredGotos.push(theGoto);
2716
- }
2717
- continue;
2718
- }
2719
-
2720
- newGotos.push(theGoto);
2721
- }
2722
-
2723
- this.pendingGotos = newGotos;
2724
- }
2725
-
2726
- scope.labels[name] = {
2727
- localCount: scope.locals.length,
2728
- line: token.line
2729
- };
2730
- };
2731
-
2732
- FullFlowContext.prototype.addLocal = function (name, token) {
2733
- this.currentScope().locals.push({
2734
- name: name,
2735
- token: token
2736
- });
2737
- };
2738
-
2739
- FullFlowContext.prototype.currentScope = function () {
2740
- return this.scopes[this.scopes.length - 1];
2741
- };
2742
-
2743
- FullFlowContext.prototype.raiseDeferredErrors = function () {
2744
- var scope = this.currentScope();
2745
- var bads = scope.deferredGotos;
2746
- for (var i = 0; i < bads.length; ++i) {
2747
- var theGoto = bads[i];
2748
- raise(theGoto.token, errors.gotoJumpInLocalScope, theGoto.target, scope.locals[theGoto.localCounts[this.scopes.length - 1]].name);
2749
- }
2750
- };
2751
-
2752
- function LoopFlowContext() {
2753
- this.level = 0;
2754
- this.loopLevels = [];
2755
- }
2756
-
2757
- LoopFlowContext.prototype.isInLoop = function () {
2758
- return !!this.loopLevels.length;
2759
- };
2760
-
2761
- LoopFlowContext.prototype.pushScope = function (isLoop) {
2762
- ++this.level;
2763
- if (isLoop)
2764
- this.loopLevels.push(this.level);
2765
- };
2766
-
2767
- LoopFlowContext.prototype.popScope = function () {
2768
- var levels = this.loopLevels;
2769
- var levlen = levels.length;
2770
- if (levlen) {
2771
- if (levels[levlen - 1] === this.level)
2772
- levels.pop();
2773
- }
2774
- --this.level;
2775
- };
2776
-
2777
- LoopFlowContext.prototype.addGoto =
2778
- LoopFlowContext.prototype.addLabel =
2779
- function () { throw new Error('This should never happen'); };
2780
-
2781
- LoopFlowContext.prototype.addLocal =
2782
- LoopFlowContext.prototype.raiseDeferredErrors =
2783
- function () {};
2784
-
2785
- function makeFlowContext() {
2786
- return features.labels ? new FullFlowContext() : new LoopFlowContext();
2787
- }
2788
-
2789
- function parseChunk() {
2790
- next();
2791
- markLocation();
2792
- if (options.scope) createScope();
2793
- var flowContext = makeFlowContext();
2794
- flowContext.allowVararg = true;
2795
- flowContext.pushScope();
2796
- var body = parseBlock(flowContext);
2797
- flowContext.popScope();
2798
- if (options.scope) destroyScope();
2799
- if (EOF !== token.type) unexpected(token);
2800
- if (trackLocations && !body.length) previousToken = token;
2801
- return finishNode(ast.chunk(body));
2802
- }
2803
-
2804
- function parseBlock(flowContext) {
2805
- var block = []
2806
- , statement;
2807
-
2808
- while (!isBlockFollow(token)) {
2809
- if ('return' === token.value || (!features.relaxedBreak && 'break' === token.value)) {
2810
- block.push(parseStatement(flowContext));
2811
- break;
2812
- }
2813
- statement = parseStatement(flowContext);
2814
- consume(';');
2815
- if (statement) block.push(statement);
2816
- }
2817
- return block;
2818
- }
2819
-
2820
- function parseStatement(flowContext) {
2821
- markLocation();
2822
-
2823
- if (Punctuator === token.type) {
2824
- if (consume('::')) return parseLabelStatement(flowContext);
2825
- }
2826
- if (features.emptyStatement) {
2827
- if (consume(';')) {
2828
- if (trackLocations) locations.pop();
2829
- return;
2830
- }
2831
- }
2832
-
2833
- flowContext.raiseDeferredErrors();
2834
-
2835
- if (Keyword === token.type) {
2836
- switch (token.value) {
2837
- case 'local': next(); return parseLocalStatement(flowContext);
2838
- case 'if': next(); return parseIfStatement(flowContext);
2839
- case 'return': next(); return parseReturnStatement(flowContext);
2840
- case 'function': next();
2841
- var name = parseFunctionName();
2842
- return parseFunctionDeclaration(name);
2843
- case 'while': next(); return parseWhileStatement(flowContext);
2844
- case 'for': next(); return parseForStatement(flowContext);
2845
- case 'repeat': next(); return parseRepeatStatement(flowContext);
2846
- case 'break': next();
2847
- if (!flowContext.isInLoop())
2848
- raise(token, errors.noLoopToBreak, token.value);
2849
- return parseBreakStatement();
2850
- case 'do': next(); return parseDoStatement(flowContext);
2851
- case 'goto': next(); return parseGotoStatement(flowContext);
2852
- }
2853
- }
2854
-
2855
- if (features.contextualGoto &&
2856
- token.type === Identifier && token.value === 'goto' &&
2857
- lookahead.type === Identifier && lookahead.value !== 'goto') {
2858
- next(); return parseGotoStatement(flowContext);
2859
- }
2860
- if (trackLocations) locations.pop();
2861
-
2862
- return parseAssignmentOrCallStatement(flowContext);
2863
- }
2864
-
2865
- function parseLabelStatement(flowContext) {
2866
- var nameToken = token
2867
- , label = parseIdentifier();
2868
-
2869
- if (options.scope) {
2870
- scopeIdentifierName('::' + nameToken.value + '::');
2871
- attachScope(label, true);
2872
- }
2873
-
2874
- expect('::');
2875
-
2876
- flowContext.addLabel(nameToken.value, nameToken);
2877
- return finishNode(ast.labelStatement(label));
2878
- }
2879
-
2880
- function parseBreakStatement() {
2881
- return finishNode(ast.breakStatement());
2882
- }
2883
-
2884
- function parseGotoStatement(flowContext) {
2885
- var name = token.value
2886
- , gotoToken = previousToken
2887
- , label = parseIdentifier();
2888
-
2889
- flowContext.addGoto(name, gotoToken);
2890
- return finishNode(ast.gotoStatement(label));
2891
- }
2892
-
2893
- function parseDoStatement(flowContext) {
2894
- if (options.scope) createScope();
2895
- flowContext.pushScope();
2896
- var body = parseBlock(flowContext);
2897
- flowContext.popScope();
2898
- if (options.scope) destroyScope();
2899
- expect('end');
2900
- return finishNode(ast.doStatement(body));
2901
- }
2902
-
2903
- function parseWhileStatement(flowContext) {
2904
- var condition = parseExpectedExpression(flowContext);
2905
- expect('do');
2906
- if (options.scope) createScope();
2907
- flowContext.pushScope(true);
2908
- var body = parseBlock(flowContext);
2909
- flowContext.popScope();
2910
- if (options.scope) destroyScope();
2911
- expect('end');
2912
- return finishNode(ast.whileStatement(condition, body));
2913
- }
2914
-
2915
- function parseRepeatStatement(flowContext) {
2916
- if (options.scope) createScope();
2917
- flowContext.pushScope(true);
2918
- var body = parseBlock(flowContext);
2919
- expect('until');
2920
- flowContext.raiseDeferredErrors();
2921
- var condition = parseExpectedExpression(flowContext);
2922
- flowContext.popScope();
2923
- if (options.scope) destroyScope();
2924
- return finishNode(ast.repeatStatement(condition, body));
2925
- }
2926
-
2927
- function parseReturnStatement(flowContext) {
2928
- var expressions = [];
2929
-
2930
- if ('end' !== token.value) {
2931
- var expression = parseExpression(flowContext);
2932
- if (null != expression) expressions.push(expression);
2933
- while (consume(',')) {
2934
- expression = parseExpectedExpression(flowContext);
2935
- expressions.push(expression);
2936
- }
2937
- consume(';'); // grammar tells us ; is optional here.
2938
- }
2939
- return finishNode(ast.returnStatement(expressions));
2940
- }
2941
-
2942
- function parseIfStatement(flowContext) {
2943
- var clauses = []
2944
- , condition
2945
- , body
2946
- , marker;
2947
- if (trackLocations) {
2948
- marker = locations[locations.length - 1];
2949
- locations.push(marker);
2950
- }
2951
- condition = parseExpectedExpression(flowContext);
2952
- expect('then');
2953
- if (options.scope) createScope();
2954
- flowContext.pushScope();
2955
- body = parseBlock(flowContext);
2956
- flowContext.popScope();
2957
- if (options.scope) destroyScope();
2958
- clauses.push(finishNode(ast.ifClause(condition, body)));
2959
-
2960
- if (trackLocations) marker = createLocationMarker();
2961
- while (consume('elseif')) {
2962
- pushLocation(marker);
2963
- condition = parseExpectedExpression(flowContext);
2964
- expect('then');
2965
- if (options.scope) createScope();
2966
- flowContext.pushScope();
2967
- body = parseBlock(flowContext);
2968
- flowContext.popScope();
2969
- if (options.scope) destroyScope();
2970
- clauses.push(finishNode(ast.elseifClause(condition, body)));
2971
- if (trackLocations) marker = createLocationMarker();
2972
- }
2973
-
2974
- if (consume('else')) {
2975
- if (trackLocations) {
2976
- marker = new Marker(previousToken);
2977
- locations.push(marker);
2978
- }
2979
- if (options.scope) createScope();
2980
- flowContext.pushScope();
2981
- body = parseBlock(flowContext);
2982
- flowContext.popScope();
2983
- if (options.scope) destroyScope();
2984
- clauses.push(finishNode(ast.elseClause(body)));
2985
- }
2986
-
2987
- expect('end');
2988
- return finishNode(ast.ifStatement(clauses));
2989
- }
2990
-
2991
- function parseForStatement(flowContext) {
2992
- var variable = parseIdentifier()
2993
- , body;
2994
-
2995
- if (options.scope) {
2996
- createScope();
2997
- scopeIdentifier(variable);
2998
- }
2999
- if (consume('=')) {
3000
- var start = parseExpectedExpression(flowContext);
3001
- expect(',');
3002
- var end = parseExpectedExpression(flowContext);
3003
- var step = consume(',') ? parseExpectedExpression(flowContext) : null;
3004
-
3005
- expect('do');
3006
- flowContext.pushScope(true);
3007
- body = parseBlock(flowContext);
3008
- flowContext.popScope();
3009
- expect('end');
3010
- if (options.scope) destroyScope();
3011
-
3012
- return finishNode(ast.forNumericStatement(variable, start, end, step, body));
3013
- }
3014
- else {
3015
- var variables = [variable];
3016
- while (consume(',')) {
3017
- variable = parseIdentifier();
3018
- if (options.scope) scopeIdentifier(variable);
3019
- variables.push(variable);
3020
- }
3021
- expect('in');
3022
- var iterators = [];
3023
- do {
3024
- var expression = parseExpectedExpression(flowContext);
3025
- iterators.push(expression);
3026
- } while (consume(','));
3027
-
3028
- expect('do');
3029
- flowContext.pushScope(true);
3030
- body = parseBlock(flowContext);
3031
- flowContext.popScope();
3032
- expect('end');
3033
- if (options.scope) destroyScope();
3034
-
3035
- return finishNode(ast.forGenericStatement(variables, iterators, body));
3036
- }
3037
- }
3038
-
3039
- function parseLocalStatement(flowContext) {
3040
- var name
3041
- , declToken = previousToken;
3042
-
3043
- if (Identifier === token.type) {
3044
- var variables = []
3045
- , init = [];
3046
-
3047
- do {
3048
- name = parseIdentifier();
3049
-
3050
- variables.push(name);
3051
- flowContext.addLocal(name.name, declToken);
3052
- } while (consume(','));
3053
-
3054
- if (consume('=')) {
3055
- do {
3056
- var expression = parseExpectedExpression(flowContext);
3057
- init.push(expression);
3058
- } while (consume(','));
3059
- }
3060
- if (options.scope) {
3061
- for (var i = 0, l = variables.length; i < l; ++i) {
3062
- scopeIdentifier(variables[i]);
3063
- }
3064
- }
3065
-
3066
- return finishNode(ast.localStatement(variables, init));
3067
- }
3068
- if (consume('function')) {
3069
- name = parseIdentifier();
3070
- flowContext.addLocal(name.name, declToken);
3071
-
3072
- if (options.scope) {
3073
- scopeIdentifier(name);
3074
- createScope();
3075
- }
3076
- return parseFunctionDeclaration(name, true);
3077
- } else {
3078
- raiseUnexpectedToken('<name>', token);
3079
- }
3080
- }
3081
-
3082
- function parseAssignmentOrCallStatement(flowContext) {
3083
- var previous = token
3084
- , marker, startMarker;
3085
- var lvalue, base, name;
3086
-
3087
- var targets = [];
3088
-
3089
- if (trackLocations) startMarker = createLocationMarker();
3090
-
3091
- do {
3092
- if (trackLocations) marker = createLocationMarker();
3093
-
3094
- if (Identifier === token.type) {
3095
- name = token.value;
3096
- base = parseIdentifier();
3097
- if (options.scope) attachScope(base, scopeHasName(name));
3098
- lvalue = true;
3099
- } else if ('(' === token.value) {
3100
- next();
3101
- base = parseExpectedExpression(flowContext);
3102
- expect(')');
3103
- lvalue = false;
3104
- } else {
3105
- return unexpected(token);
3106
- }
3107
-
3108
- both: for (;;) {
3109
- var newBase;
3110
-
3111
- switch (StringLiteral === token.type ? '"' : token.value) {
3112
- case '.':
3113
- case '[':
3114
- lvalue = true;
3115
- break;
3116
- case ':':
3117
- case '(':
3118
- case '{':
3119
- case '"':
3120
- lvalue = null;
3121
- break;
3122
- default:
3123
- break both;
3124
- }
3125
-
3126
- base = parsePrefixExpressionPart(base, marker, flowContext);
3127
- }
3128
-
3129
- targets.push(base);
3130
-
3131
- if (',' !== token.value)
3132
- break;
3133
-
3134
- if (!lvalue) {
3135
- return unexpected(token);
3136
- }
3137
-
3138
- next();
3139
- } while (true);
3140
-
3141
- if (targets.length === 1 && lvalue === null) {
3142
- pushLocation(marker);
3143
- return finishNode(ast.callStatement(targets[0]));
3144
- } else if (!lvalue) {
3145
- return unexpected(token);
3146
- }
3147
-
3148
- expect('=');
3149
-
3150
- var values = [];
3151
-
3152
- do {
3153
- values.push(parseExpectedExpression(flowContext));
3154
- } while (consume(','));
3155
-
3156
- pushLocation(startMarker);
3157
- return finishNode(ast.assignmentStatement(targets, values));
3158
- }
3159
-
3160
- function parseIdentifier() {
3161
- markLocation();
3162
- var identifier = token.value;
3163
- if (Identifier !== token.type) raiseUnexpectedToken('<name>', token);
3164
- next();
3165
- return finishNode(ast.identifier(identifier));
3166
- }
3167
-
3168
- function parseFunctionDeclaration(name, isLocal) {
3169
- var flowContext = makeFlowContext();
3170
- flowContext.pushScope();
3171
-
3172
- var parameters = [];
3173
- expect('(');
3174
- if (!consume(')')) {
3175
- while (true) {
3176
- if (Identifier === token.type) {
3177
- var parameter = parseIdentifier();
3178
- if (options.scope) scopeIdentifier(parameter);
3179
-
3180
- parameters.push(parameter);
3181
-
3182
- if (consume(',')) continue;
3183
- }
3184
- else if (VarargLiteral === token.type) {
3185
- flowContext.allowVararg = true;
3186
- parameters.push(parsePrimaryExpression(flowContext));
3187
- } else {
3188
- raiseUnexpectedToken('<name> or \'...\'', token);
3189
- }
3190
- expect(')');
3191
- break;
3192
- }
3193
- }
3194
-
3195
- var body = parseBlock(flowContext);
3196
- flowContext.popScope();
3197
- expect('end');
3198
- if (options.scope) destroyScope();
3199
-
3200
- isLocal = isLocal || false;
3201
- return finishNode(ast.functionStatement(name, parameters, isLocal, body));
3202
- }
3203
-
3204
- function parseFunctionName() {
3205
- var base, name, marker;
3206
-
3207
- if (trackLocations) marker = createLocationMarker();
3208
- base = parseIdentifier();
3209
-
3210
- if (options.scope) {
3211
- attachScope(base, scopeHasName(base.name));
3212
- createScope();
3213
- }
3214
-
3215
- while (consume('.')) {
3216
- pushLocation(marker);
3217
- name = parseIdentifier();
3218
- base = finishNode(ast.memberExpression(base, '.', name));
3219
- }
3220
-
3221
- if (consume(':')) {
3222
- pushLocation(marker);
3223
- name = parseIdentifier();
3224
- base = finishNode(ast.memberExpression(base, ':', name));
3225
- if (options.scope) scopeIdentifierName('self');
3226
- }
3227
-
3228
- return base;
3229
- }
3230
-
3231
- function parseTableConstructor(flowContext) {
3232
- var fields = []
3233
- , key, value;
3234
-
3235
- while (true) {
3236
- markLocation();
3237
- if (Punctuator === token.type && consume('[')) {
3238
- key = parseExpectedExpression(flowContext);
3239
- expect(']');
3240
- expect('=');
3241
- value = parseExpectedExpression(flowContext);
3242
- fields.push(finishNode(ast.tableKey(key, value)));
3243
- } else if (Identifier === token.type) {
3244
- if ('=' === lookahead.value) {
3245
- key = parseIdentifier();
3246
- next();
3247
- value = parseExpectedExpression(flowContext);
3248
- fields.push(finishNode(ast.tableKeyString(key, value)));
3249
- } else {
3250
- value = parseExpectedExpression(flowContext);
3251
- fields.push(finishNode(ast.tableValue(value)));
3252
- }
3253
- } else {
3254
- if (null == (value = parseExpression(flowContext))) {
3255
- locations.pop();
3256
- break;
3257
- }
3258
- fields.push(finishNode(ast.tableValue(value)));
3259
- }
3260
- if (',;'.indexOf(token.value) >= 0) {
3261
- next();
3262
- continue;
3263
- }
3264
- break;
3265
- }
3266
- expect('}');
3267
- return finishNode(ast.tableConstructorExpression(fields));
3268
- }
3269
-
3270
- function parseExpression(flowContext) {
3271
- var expression = parseSubExpression(0, flowContext);
3272
- return expression;
3273
- }
3274
-
3275
- function parseExpectedExpression(flowContext) {
3276
- var expression = parseExpression(flowContext);
3277
- if (null == expression) raiseUnexpectedToken('<expression>', token);
3278
- else return expression;
3279
- }
3280
-
3281
- function binaryPrecedence(operator) {
3282
- var charCode = operator.charCodeAt(0)
3283
- , length = operator.length;
3284
-
3285
- if (1 === length) {
3286
- switch (charCode) {
3287
- case 94: return 12; // ^
3288
- case 42: case 47: case 37: return 10; // * / %
3289
- case 43: case 45: return 9; // + -
3290
- case 38: return 6; // &
3291
- case 126: return 5; // ~
3292
- case 124: return 4; // |
3293
- case 60: case 62: return 3; // < >
3294
- }
3295
- } else if (2 === length) {
3296
- switch (charCode) {
3297
- case 47: return 10; // //
3298
- case 46: return 8; // ..
3299
- case 60: case 62:
3300
- if('<<' === operator || '>>' === operator) return 7; // << >>
3301
- return 3; // <= >=
3302
- case 61: case 126: return 3; // == ~=
3303
- case 111: return 1; // or
3304
- }
3305
- } else if (97 === charCode && 'and' === operator) return 2;
3306
- return 0;
3307
- }
3308
-
3309
- function parseSubExpression(minPrecedence, flowContext) {
3310
- var operator = token.value
3311
- , expression, marker;
3312
-
3313
- if (trackLocations) marker = createLocationMarker();
3314
- if (isUnary(token)) {
3315
- markLocation();
3316
- next();
3317
- var argument = parseSubExpression(10, flowContext);
3318
- if (argument == null) raiseUnexpectedToken('<expression>', token);
3319
- expression = finishNode(ast.unaryExpression(operator, argument));
3320
- }
3321
- if (null == expression) {
3322
- expression = parsePrimaryExpression(flowContext);
3323
- if (null == expression) {
3324
- expression = parsePrefixExpression(flowContext);
3325
- }
3326
- }
3327
- if (null == expression) return null;
3328
-
3329
- var precedence;
3330
- while (true) {
3331
- operator = token.value;
3332
-
3333
- precedence = (Punctuator === token.type || Keyword === token.type) ?
3334
- binaryPrecedence(operator) : 0;
3335
-
3336
- if (precedence === 0 || precedence <= minPrecedence) break;
3337
- if ('^' === operator || '..' === operator) --precedence;
3338
- next();
3339
- var right = parseSubExpression(precedence, flowContext);
3340
- if (null == right) raiseUnexpectedToken('<expression>', token);
3341
- if (trackLocations) locations.push(marker);
3342
- expression = finishNode(ast.binaryExpression(operator, expression, right));
3343
-
3344
- }
3345
- return expression;
3346
- }
3347
-
3348
- function parsePrefixExpressionPart(base, marker, flowContext) {
3349
- var expression, identifier;
3350
-
3351
- if (Punctuator === token.type) {
3352
- switch (token.value) {
3353
- case '[':
3354
- pushLocation(marker);
3355
- next();
3356
- expression = parseExpectedExpression(flowContext);
3357
- expect(']');
3358
- return finishNode(ast.indexExpression(base, expression));
3359
- case '.':
3360
- pushLocation(marker);
3361
- next();
3362
- identifier = parseIdentifier();
3363
- return finishNode(ast.memberExpression(base, '.', identifier));
3364
- case ':':
3365
- pushLocation(marker);
3366
- next();
3367
- identifier = parseIdentifier();
3368
- base = finishNode(ast.memberExpression(base, ':', identifier));
3369
- pushLocation(marker);
3370
- return parseCallExpression(base, flowContext);
3371
- case '(': case '{': // args
3372
- pushLocation(marker);
3373
- return parseCallExpression(base, flowContext);
3374
- }
3375
- } else if (StringLiteral === token.type) {
3376
- pushLocation(marker);
3377
- return parseCallExpression(base, flowContext);
3378
- }
3379
-
3380
- return null;
3381
- }
3382
-
3383
- function parsePrefixExpression(flowContext) {
3384
- var base, name, marker;
3385
-
3386
- if (trackLocations) marker = createLocationMarker();
3387
- if (Identifier === token.type) {
3388
- name = token.value;
3389
- base = parseIdentifier();
3390
- if (options.scope) attachScope(base, scopeHasName(name));
3391
- } else if (consume('(')) {
3392
- base = parseExpectedExpression(flowContext);
3393
- expect(')');
3394
- } else {
3395
- return null;
3396
- }
3397
- for (;;) {
3398
- var newBase = parsePrefixExpressionPart(base, marker, flowContext);
3399
- if (newBase === null)
3400
- break;
3401
- base = newBase;
3402
- }
3403
-
3404
- return base;
3405
- }
3406
-
3407
- function parseCallExpression(base, flowContext) {
3408
- if (Punctuator === token.type) {
3409
- switch (token.value) {
3410
- case '(':
3411
- if (!features.emptyStatement) {
3412
- if (token.line !== previousToken.line)
3413
- raise(null, errors.ambiguousSyntax, token.value);
3414
- }
3415
- next();
3416
- var expressions = [];
3417
- var expression = parseExpression(flowContext);
3418
- if (null != expression) expressions.push(expression);
3419
- while (consume(',')) {
3420
- expression = parseExpectedExpression(flowContext);
3421
- expressions.push(expression);
3422
- }
3423
-
3424
- expect(')');
3425
- return finishNode(ast.callExpression(base, expressions));
3426
-
3427
- case '{':
3428
- markLocation();
3429
- next();
3430
- var table = parseTableConstructor(flowContext);
3431
- return finishNode(ast.tableCallExpression(base, table));
3432
- }
3433
- } else if (StringLiteral === token.type) {
3434
- return finishNode(ast.stringCallExpression(base, parsePrimaryExpression(flowContext)));
3435
- }
3436
-
3437
- raiseUnexpectedToken('function arguments', token);
3438
- }
3439
-
3440
- function parsePrimaryExpression(flowContext) {
3441
- var literals = StringLiteral | NumericLiteral | BooleanLiteral | NilLiteral | VarargLiteral
3442
- , value = token.value
3443
- , type = token.type
3444
- , marker;
3445
-
3446
- if (trackLocations) marker = createLocationMarker();
3447
-
3448
- if (type === VarargLiteral && !flowContext.allowVararg) {
3449
- raise(token, errors.cannotUseVararg, token.value);
3450
- }
3451
-
3452
- if (type & literals) {
3453
- pushLocation(marker);
3454
- var raw = input.slice(token.range[0], token.range[1]);
3455
- next();
3456
- return finishNode(ast.literal(type, value, raw));
3457
- } else if (Keyword === type && 'function' === value) {
3458
- pushLocation(marker);
3459
- next();
3460
- if (options.scope) createScope();
3461
- return parseFunctionDeclaration(null);
3462
- } else if (consume('{')) {
3463
- pushLocation(marker);
3464
- return parseTableConstructor(flowContext);
3465
- }
3466
- }
3467
-
3468
- exports.parse = parse;
3469
-
3470
- var versionFeatures = {
3471
- '5.1': {
3472
- },
3473
- '5.2': {
3474
- labels: true,
3475
- emptyStatement: true,
3476
- hexEscapes: true,
3477
- skipWhitespaceEscape: true,
3478
- strictEscapes: true,
3479
- relaxedBreak: true
3480
- },
3481
- '5.3': {
3482
- labels: true,
3483
- emptyStatement: true,
3484
- hexEscapes: true,
3485
- skipWhitespaceEscape: true,
3486
- strictEscapes: true,
3487
- unicodeEscapes: true,
3488
- bitwiseOperators: true,
3489
- integerDivision: true,
3490
- relaxedBreak: true
3491
- },
3492
- 'LuaJIT': {
3493
- labels: true,
3494
- contextualGoto: true,
3495
- hexEscapes: true,
3496
- skipWhitespaceEscape: true,
3497
- strictEscapes: true,
3498
- unicodeEscapes: true,
3499
- imaginaryNumbers: true,
3500
- integerSuffixes: true
3501
- }
3502
- };
3503
-
3504
- function parse(_input, _options) {
3505
- if ('undefined' === typeof _options && 'object' === typeof _input) {
3506
- _options = _input;
3507
- _input = undefined;
3508
- }
3509
- if (!_options) _options = {};
3510
-
3511
- input = _input || '';
3512
- options = assign({}, defaultOptions, _options);
3513
- index = 0;
3514
- line = 1;
3515
- lineStart = 0;
3516
- length = input.length;
3517
- scopes = [[]];
3518
- scopeDepth = 0;
3519
- globals = [];
3520
- locations = [];
3521
-
3522
- if (!Object.prototype.hasOwnProperty.call(versionFeatures, options.luaVersion)) {
3523
- throw new Error(sprintf("Lua version '%1' not supported", options.luaVersion));
3524
- }
3525
-
3526
- features = assign({}, versionFeatures[options.luaVersion]);
3527
- if (options.extendedIdentifiers !== void 0)
3528
- features.extendedIdentifiers = !!options.extendedIdentifiers;
3529
-
3530
- if (!Object.prototype.hasOwnProperty.call(encodingModes, options.encodingMode)) {
3531
- throw new Error(sprintf("Encoding mode '%1' not supported", options.encodingMode));
3532
- }
3533
-
3534
- encodingMode = encodingModes[options.encodingMode];
3535
-
3536
- if (options.comments) comments = [];
3537
- if (!options.wait) return end();
3538
- return exports;
3539
- }
3540
- exports.write = write;
3541
-
3542
- function write(_input) {
3543
- input += String(_input);
3544
- length = input.length;
3545
- return exports;
3546
- }
3547
- exports.end = end;
3548
-
3549
- function end(_input) {
3550
- if ('undefined' !== typeof _input) write(_input);
3551
- if (input && input.substr(0, 2) === '#!') input = input.replace(/^.*/, function (line) {
3552
- return line.replace(/./g, ' ');
3553
- });
3554
-
3555
- length = input.length;
3556
- trackLocations = options.locations || options.ranges;
3557
- lookahead = lex();
3558
-
3559
- var chunk = parseChunk();
3560
- if (options.comments) chunk.comments = comments;
3561
- if (options.scope) chunk.globals = globals;
3562
- if (locations.length > 0)
3563
- throw new Error('Location tracking failed. This is most likely a bug in luaparse');
3564
-
3565
- return chunk;
3566
- }
3567
-
3568
- }));
3569
-
3570
- });
3571
-
3572
- ace.define("ace/mode/lua_worker",[], function(require, exports, module) {
3573
- "use strict";
3574
-
3575
- var oop = require("../lib/oop");
3576
- var Mirror = require("../worker/mirror").Mirror;
3577
- var luaparse = require("../mode/lua/luaparse");
3578
-
3579
- var Worker = exports.Worker = function(sender) {
3580
- Mirror.call(this, sender);
3581
- this.setTimeout(500);
3582
- };
3583
-
3584
- oop.inherits(Worker, Mirror);
3585
-
3586
- (function() {
3587
-
3588
- this.onUpdate = function() {
3589
- var value = this.doc.getValue();
3590
- var errors = [];
3591
- try {
3592
- luaparse.parse(value);
3593
- } catch(e) {
3594
- if (e instanceof luaparse.SyntaxError) {
3595
- errors.push({
3596
- row: e.line - 1,
3597
- column: e.column,
3598
- text: e.message,
3599
- type: "error"
3600
- });
3601
- }
3602
- }
3603
- this.sender.emit("annotate", errors);
3604
- };
3605
-
3606
- }).call(Worker.prototype);
3607
-
3608
- });
1
+ !function(e){if(!(void 0!==e.window&&e.document||e.require&&e.define)){e.console||(e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console),e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){postMessage({type:"error",data:{message:e,data:i.data,file:t,line:n,col:r,stack:i.stack}})},e.normalizeModule=function(t,n){if(-1!==n.indexOf("!")){var r=n.split("!");return e.normalizeModule(t,r[0])+"!"+e.normalizeModule(t,r[1])}if("."==n.charAt(0)){var i=t.split("/").slice(0,-1).join("/");for(n=(i?i+"/":"")+n;-1!==n.indexOf(".")&&o!=n;){var o=n;n=n.replace(/^\.\//,"").replace(/\/\.\//,"/").replace(/[^\/]+\/\.\.\//,"")}}return n},e.require=function(t,n){if(n||(n=t,t=null),!n.charAt)throw new Error("worker.js require() accepts only (parentId, id) as arguments");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;if(!e.require.tlns)return console.log("unable to load "+n);var i=function(e,t){var n=e,r="";for(;n;){var i=t[n];if("string"==typeof i)return i+r;if(i)return i.location.replace(/\/*$/,"/")+(r||i.main||i.name);if(!1===i)return"";var o=n.lastIndexOf("/");if(-1===o)break;r=n.substr(o)+r,n=n.slice(0,o)}return e}(n,e.require.tlns);return".js"!=i.slice(-3)&&(i+=".js"),e.require.id=n,e.require.modules[n]={},importScripts(i),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){if(2==arguments.length?(r=n,"string"!=typeof t&&(n=t,t=e.require.id)):1==arguments.length&&(r=t,n=[],t=e.require.id),"function"==typeof r){n.length||(n=["require","exports","module"]);var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.slice(0,r.length).map((function(t){switch(t){case"require":return i;case"exports":return e.exports;case"module":return e;default:return i(t)}})));return t&&(e.exports=t),e}}}else e.require.modules[t]={exports:r,initialized:!0}},e.define.amd={},require.tlns={},e.initBaseUrls=function(e){for(var t in e)require.tlns[t]=e[t]},e.initSender=function(){var t=e.require("ace/lib/event_emitter").EventEmitter,n=e.require("ace/lib/oop"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:"call",id:t,data:e})},this.emit=function(e,t){postMessage({type:"event",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.event&&n)n._signal(i.event,i.data);else if(i.command)if(t[i.command])t[i.command].apply(t,i.args);else{if(!e[i.command])throw new Error("Unknown command:"+i.command);e[i.command].apply(e,i.args)}else if(i.init){e.initBaseUrls(i.tlns),n=e.sender=e.initSender();var o=require(i.module)[i.classname];t=e.main=new o(n)}}}}(this),ace.define("ace/lib/oop",[],(function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}})),ace.define("ace/range",[],(function(e,t,n){"use strict";var r=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return 0==this.compare(e,t)},this.compareRange=function(e){var t,n=e.end,r=e.start;return 1==(t=this.compare(n.row,n.column))?1==(t=this.compare(r.row,r.column))?2:0==t?1:0:-1==t?-2:-1==(t=this.compare(r.row,r.column))?-1:1==t?42:0},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return 0==this.comparePoint(e.start)&&0==this.comparePoint(e.end)},this.intersects=function(e){var t=this.compareRange(e);return-1==t||0==t||1==t},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){"object"==typeof e?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){"object"==typeof e?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return 0==this.compare(e,t)&&(!this.isEnd(e,t)&&!this.isStart(e,t))},this.insideStart=function(e,t){return 0==this.compare(e,t)&&!this.isEnd(e,t)},this.insideEnd=function(e,t){return 0==this.compare(e,t)&&!this.isStart(e,t)},this.compare=function(e,t){return this.isMultiLine()||e!==this.start.row?e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0:t<this.start.column?-1:t>this.end.column?1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)n={row:e,column:0};if(this.start.row>t)var i={row:t+1,column:0};else if(this.start.row<e)i={row:e,column:0};return r.fromPoints(i||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(0==n)return this;if(-1==n)var i={row:e,column:t};else var o={row:e,column:t};return r.fromPoints(i||this.start,o||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return r.fromPoints(this.start,this.end)},this.collapseRows=function(){return 0==this.end.column?new r(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new r(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new r(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(r.prototype),r.fromPoints=function(e,t){return new r(e.row,e.column,t.row,t.column)},r.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},r.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=r})),ace.define("ace/apply_delta",[],(function(e,t,n){"use strict";t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,o=e[r]||"";switch(t.action){case"insert":if(1===t.lines.length)e[r]=o.substring(0,i)+t.lines[0]+o.substring(i);else{var s=[r,1].concat(t.lines);e.splice.apply(e,s),e[r]=o.substring(0,i)+e[r],e[r+t.lines.length-1]+=o.substring(i)}break;case"remove":var a=t.end.column,c=t.end.row;r===c?e[r]=o.substring(0,i)+o.substring(a):e.splice(r,c-r+1,o.substring(0,i)+e[c].substring(a))}}})),ace.define("ace/lib/event_emitter",[],(function(e,t,n){"use strict";var r={},i=function(){this.propagationStopped=!0},o=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(n.length||r){"object"==typeof t&&t||(t={}),t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=o),n=n.slice();for(var s=0;s<n.length&&(n[s](t,this),!t.propagationStopped);s++);return r&&!t.defaultPrevented?r(t,this):void 0}},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(n){n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)}},r.once=function(e,t){var n=this;if(this.on(e,(function r(){n.off(e,r),t.apply(null,arguments)})),!t)return new Promise((function(e){t=e}))},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;if(n||(n=this._defaultHandlers={_disabled_:{}}),n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var o=i.indexOf(t);-1!=o&&i.splice(o,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(n){var r=n._disabled_[e];if(n[e]==t)r&&this.setDefaultHandler(e,r.pop());else if(r){var i=r.indexOf(t);-1!=i&&r.splice(i,1)}}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),-1==r.indexOf(t)&&r[n?"unshift":"push"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(n){var r=n.indexOf(t);-1!==r&&n.splice(r,1)}},r.removeAllListeners=function(e){e||(this._eventRegistry=this._defaultHandlers=void 0),this._eventRegistry&&(this._eventRegistry[e]=void 0),this._defaultHandlers&&(this._defaultHandlers[e]=void 0)},t.EventEmitter=r})),ace.define("ace/anchor",[],(function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,o=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),void 0===n?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.column<t.column;return e.row<t.row||e.row==t.row&&r}r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(t){if(!(t.start.row==t.end.row&&t.start.row!=this.row||t.start.row>this.row)){var n=function(t,n,r){var i="insert"==t.action,o=(i?1:-1)*(t.end.row-t.start.row),s=(i?1:-1)*(t.end.column-t.start.column),a=t.start,c=i?a:t.end;if(e(n,a,r))return{row:n.row,column:n.column};if(e(c,n,!r))return{row:n.row+o,column:n.column+(n.row==c.row?s:0)};return{row:a.row,column:a.column}}(t,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)}},this.setPosition=function(e,t,n){var r;if(r=n?{row:e,column:t}:this.$clipPositionToDocument(e,t),this.row!=r.row||this.column!=r.column){var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})}},this.detach=function(){this.document.off("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(o.prototype)})),ace.define("ace/document",[],(function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,o=e("./lib/event_emitter").EventEmitter,s=e("./range").Range,a=e("./anchor").Anchor,c=function(e){this.$lines=[""],0===e.length?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,o),this.setValue=function(e){var t=this.getLength()-1;this.remove(new s(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new a(this,e,t)},0==="aaa".split(/a/).length?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){this.$newLineMode!==e&&(this.$newLineMode=e,this._signal("changeNewLineMode"))},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return"\r\n"==e||"\r"==e||"\n"==e},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{(t=this.getLines(e.start.row,e.end.row))[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();void 0===e?e=n:e<0?e=0:e>=n&&(e=n-1,t=void 0);var r=this.getLine(e);return null==t&&(t=r.length),{row:e,column:t=Math.min(Math.max(t,0),r.length)}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){var n=0;(e=Math.min(Math.max(e,0),this.getLength()))<this.getLength()?(t=t.concat([""]),n=0):(t=[""].concat(t),e--,n=this.$lines[e].length),this.insertMergedLines({row:e,column:n},t)},this.insertMergedLines=function(e,t){var n=this.clippedPos(e.row,e.column),r={row:n.row+t.length-1,column:(1==t.length?n.column:0)+t[t.length-1].length};return this.applyDelta({start:n,end:r,action:"insert",lines:t}),this.clonePos(r)},this.remove=function(e){var t=this.clippedPos(e.start.row,e.start.column),n=this.clippedPos(e.end.row,e.end.column);return this.applyDelta({start:t,end:n,action:"remove",lines:this.getLinesForRange({start:t,end:n})}),this.clonePos(t)},this.removeInLine=function(e,t,n){var r=this.clippedPos(e,t),i=this.clippedPos(e,n);return this.applyDelta({start:r,end:i,action:"remove",lines:this.getLinesForRange({start:r,end:i})},!0),this.clonePos(r)},this.removeFullLines=function(e,t){e=Math.min(Math.max(0,e),this.getLength()-1);var n=(t=Math.min(Math.max(0,t),this.getLength()-1))==this.getLength()-1&&e>0,r=t<this.getLength()-1,i=n?e-1:e,o=n?this.getLine(i).length:0,a=r?t+1:t,c=r?0:this.getLine(a).length,u=new s(i,o,a,c),l=this.$lines.slice(e,t+1);return this.applyDelta({start:u.start,end:u.end,action:"remove",lines:this.getLinesForRange(u)}),l},this.removeNewLine=function(e){e<this.getLength()-1&&e>=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){return e instanceof s||(e=s.fromPoints(e.start,e.end)),0===t.length&&e.isEmpty()?e.start:t==this.getTextRange(e)?e.end:(this.remove(e),t?this.insert(e.start,t):e.start)},this.applyDeltas=function(e){for(var t=0;t<e.length;t++)this.applyDelta(e[t])},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n="insert"==e.action;(n?e.lines.length<=1&&!e.lines[0]:!s.comparePoints(e.start,e.end))||(n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e)))},this.$safeApplyDelta=function(e){var t=this.$lines.length;("remove"==e.action&&e.start.row<t&&e.end.row<t||"insert"==e.action&&e.start.row<=t)&&this.applyDelta(e)},this.$splitAndapplyLargeDelta=function(e,t){for(var n=e.lines,r=n.length-t+1,i=e.start.row,o=e.start.column,s=0,a=0;s<r;s=a){a+=t-1;var c=n.slice(s,a);c.push(""),this.applyDelta({start:this.pos(i+s,o),end:this.pos(i+a,o=0),action:e.action,lines:c},!0)}e.lines=n.slice(s),e.start.row=i+s,e.start.column=o,this.applyDelta(e,!0)},this.revertDelta=function(e){this.$safeApplyDelta({start:this.clonePos(e.start),end:this.clonePos(e.end),action:"insert"==e.action?"remove":"insert",lines:e.lines.slice()})},this.indexToPosition=function(e,t){for(var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=t||0,o=n.length;i<o;i++)if((e-=n[i].length+r)<0)return{row:i,column:e+n[i].length+r};return{row:o-1,column:e+n[o-1].length+r}},this.positionToIndex=function(e,t){for(var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,o=Math.min(e.row,n.length),s=t||0;s<o;++s)i+=n[s].length+r;return i+e.column}}).call(c.prototype),t.Document=c})),ace.define("ace/lib/lang",[],(function(e,t,n){"use strict";t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split("").reverse().join("")},t.stringRepeat=function(e,t){for(var n="";t>0;)1&t&&(n+=e),(t>>=1)&&(e+=e);return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){for(var t=[],n=0,r=e.length;n<r;n++)e[n]&&"object"==typeof e[n]?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function e(t){if("object"!=typeof t||!t)return t;var n;if(Array.isArray(t)){n=[];for(var r=0;r<t.length;r++)n[r]=e(t[r]);return n}if("[object Object]"!==Object.prototype.toString.call(t))return t;for(var r in n={},t)n[r]=e(t[r]);return n},t.arrayToMap=function(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},t.escapeHTML=function(e){return(""+e).replace(/&/g,"&#38;").replace(/"/g,"&#34;").replace(/'/g,"&#39;").replace(/</g,"&#60;")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,(function(e){n.push({offset:arguments[arguments.length-2],length:e.length})})),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){null==n&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}})),ace.define("ace/worker/mirror",[],(function(e,t,n){"use strict";e("../range").Range;var r=e("../document").Document,i=e("../lib/lang"),o=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(""),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),o=this;e.on("change",(function(e){var r=e.data;if(r[0].start)t.applyDeltas(r);else for(var i=0;i<r.length;i+=2){if(Array.isArray(r[i+1]))var s={action:"insert",start:r[i],lines:r[i+1]};else s={action:"remove",start:r[i],end:r[i+1]};t.applyDelta(s,!0)}if(o.$timeout)return n.schedule(o.$timeout);o.onUpdate()}))};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(o.prototype)})),ace.define("ace/mode/lua/luaparse",[],(function(e,t,n){!function(e){"use strict";var t,n,r,i,o;e.version="0.3.1";var s=e.defaultOptions={wait:!1,comments:!0,scope:!1,locations:!1,ranges:!1,onCreateNode:null,onCreateScope:null,onDestroyScope:null,onLocalDeclaration:null,luaVersion:"5.1",encodingMode:"none"};function a(e,t){return t=t||0,e<128?String.fromCharCode(e):e<2048?String.fromCharCode(192|t|e>>6,128|t|63&e):e<65536?String.fromCharCode(224|t|e>>12,128|t|e>>6&63,128|t|63&e):e<1114112?String.fromCharCode(240|t|e>>18,128|t|e>>12&63,128|t|e>>6&63,128|t|63&e):null}function c(e){return function(t){var n=e.exec(t);if(!n)return t;P(null,l.invalidCodeUnit,function(e,t){for(var n=e.toString(16);n.length<t;)n="0"+n;return n}(n[0].charCodeAt(0),4).toUpperCase())}}var u={"pseudo-latin1":{fixup:c(/[^\x00-\xff]/),encodeByte:function(e){return null===e?"":String.fromCharCode(e)},encodeUTF8:function(e){return a(e)}},"x-user-defined":{fixup:c(/[^\x00-\x7f\uf780-\uf7ff]/),encodeByte:function(e){return null===e?"":e>=128?String.fromCharCode(63232|e):String.fromCharCode(e)},encodeUTF8:function(e){return a(e,63232)}},none:{discardStrings:!0,fixup:function(e){return e},encodeByte:function(e){return""},encodeUTF8:function(e){return""}}};e.tokenTypes={EOF:1,StringLiteral:2,Keyword:4,Identifier:8,NumericLiteral:16,Punctuator:32,BooleanLiteral:64,NilLiteral:128,VarargLiteral:256};var l=e.errors={unexpected:"unexpected %1 '%2' near '%3'",unexpectedEOF:"unexpected symbol near '<eof>'",expected:"'%1' expected near '%2'",expectedToken:"%1 expected near '%2'",unfinishedString:"unfinished string near '%1'",malformedNumber:"malformed number near '%1'",decimalEscapeTooLarge:"decimal escape too large near '%1'",invalidEscape:"invalid escape sequence near '%1'",hexadecimalDigitExpected:"hexadecimal digit expected near '%1'",braceExpected:"missing '%1' near '%2'",tooLargeCodepoint:"UTF-8 value too large near '%1'",unfinishedLongString:"unfinished long string (starting at line %1) near '%2'",unfinishedLongComment:"unfinished long comment (starting at line %1) near '%2'",ambiguousSyntax:"ambiguous syntax (function call x new statement) near '%1'",noLoopToBreak:"no loop to break near '%1'",labelAlreadyDefined:"label '%1' already defined on line %2",labelNotVisible:"no visible label '%1' for <goto>",gotoJumpInLocalScope:"<goto %1> jumps into the scope of local '%2'",cannotUseVararg:"cannot use '...' outside a vararg function near '%1'",invalidCodeUnit:"code unit U+%1 is not allowed in the current encoding mode"},h=e.ast={labelStatement:function(e){return{type:"LabelStatement",label:e}},breakStatement:function(){return{type:"BreakStatement"}},gotoStatement:function(e){return{type:"GotoStatement",label:e}},returnStatement:function(e){return{type:"ReturnStatement",arguments:e}},ifStatement:function(e){return{type:"IfStatement",clauses:e}},ifClause:function(e,t){return{type:"IfClause",condition:e,body:t}},elseifClause:function(e,t){return{type:"ElseifClause",condition:e,body:t}},elseClause:function(e){return{type:"ElseClause",body:e}},whileStatement:function(e,t){return{type:"WhileStatement",condition:e,body:t}},doStatement:function(e){return{type:"DoStatement",body:e}},repeatStatement:function(e,t){return{type:"RepeatStatement",condition:e,body:t}},localStatement:function(e,t){return{type:"LocalStatement",variables:e,init:t}},assignmentStatement:function(e,t){return{type:"AssignmentStatement",variables:e,init:t}},callStatement:function(e){return{type:"CallStatement",expression:e}},functionStatement:function(e,t,n,r){return{type:"FunctionDeclaration",identifier:e,isLocal:n,parameters:t,body:r}},forNumericStatement:function(e,t,n,r,i){return{type:"ForNumericStatement",variable:e,start:t,end:n,step:r,body:i}},forGenericStatement:function(e,t,n){return{type:"ForGenericStatement",variables:e,iterators:t,body:n}},chunk:function(e){return{type:"Chunk",body:e}},identifier:function(e){return{type:"Identifier",name:e}},literal:function(e,t,n){return{type:e=2===e?"StringLiteral":16===e?"NumericLiteral":64===e?"BooleanLiteral":128===e?"NilLiteral":"VarargLiteral",value:t,raw:n}},tableKey:function(e,t){return{type:"TableKey",key:e,value:t}},tableKeyString:function(e,t){return{type:"TableKeyString",key:e,value:t}},tableValue:function(e){return{type:"TableValue",value:e}},tableConstructorExpression:function(e){return{type:"TableConstructorExpression",fields:e}},binaryExpression:function(e,t,n){return{type:"and"===e||"or"===e?"LogicalExpression":"BinaryExpression",operator:e,left:t,right:n}},unaryExpression:function(e,t){return{type:"UnaryExpression",operator:e,argument:t}},memberExpression:function(e,t,n){return{type:"MemberExpression",indexer:t,identifier:n,base:e}},indexExpression:function(e,t){return{type:"IndexExpression",base:e,index:t}},callExpression:function(e,t){return{type:"CallExpression",base:e,arguments:t}},tableCallExpression:function(e,t){return{type:"TableCallExpression",base:e,arguments:t}},stringCallExpression:function(e,t){return{type:"StringCallExpression",base:e,argument:t}},comment:function(e,t){return{type:"Comment",value:e,raw:t}}};function p(e){if(ne){var t=re.pop();t.complete(),t.bless(e)}return n.onCreateNode&&n.onCreateNode(e),e}var f=Array.prototype.slice,d=(Object.prototype.toString,function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1});function m(e){var t=f.call(arguments,1);return e=e.replace(/%(\d)/g,(function(e,n){return""+t[n-1]||""}))}Array.prototype.indexOf&&(d=function(e,t){return e.indexOf(t)});var g,v,w,y,b,x,L,S,C,E,A,k=function(e){for(var t,n,r=f.call(arguments,1),i=0,o=r.length;i<o;++i)for(n in t=r[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e};function D(e){return Object.create?Object.create(e,{line:{writable:!0,value:e.line},index:{writable:!0,value:e.index},column:{writable:!0,value:e.column}}):e}function P(e){var t,n,r=m.apply(null,f.call(arguments,1));throw null===e||void 0===e.line?(n=g-S+1,(t=D(new SyntaxError(m("[%1:%2] %3",L,n,r)))).index=g,t.line=L,t.column=n):(n=e.range[0]-e.lineStart,(t=D(new SyntaxError(m("[%1:%2] %3",e.line,n,r)))).line=e.line,t.index=e.range[0],t.column=n),t}function M(e){var n=t.slice(e.range[0],e.range[1]);return n||e.value}function O(e,t){P(t,l.expectedToken,e,M(t))}function _(e){var t=M(y);if(void 0!==e.type){var n;switch(e.type){case 2:n="string";break;case 4:n="keyword";break;case 8:n="identifier";break;case 16:n="number";break;case 32:n="symbol";break;case 64:n="boolean";break;case 128:return P(e,l.unexpected,"symbol","nil",t);case 1:return P(e,l.unexpectedEOF)}return P(e,l.unexpected,n,M(e),t)}return P(e,l.unexpected,"symbol",e,t)}function $(){for(T();45===t.charCodeAt(g)&&45===t.charCodeAt(g+1);)I(),T();if(g>=r)return{type:1,value:"<eof>",line:L,lineStart:S,range:[g,g]};var e,n,s,a=t.charCodeAt(g),c=t.charCodeAt(g+1);if(x=g,function(e){return e>=65&&e<=90||e>=97&&e<=122||95===e||!!(i.extendedIdentifiers&&e>=128)}(a))return function(){for(var e,n;W(t.charCodeAt(++g)););return!function(e){switch(e.length){case 2:return"do"===e||"if"===e||"in"===e||"or"===e;case 3:return"and"===e||"end"===e||"for"===e||"not"===e;case 4:return"else"===e||"then"===e||!(!i.labels||i.contextualGoto)&&"goto"===e;case 5:return"break"===e||"local"===e||"until"===e||"while"===e;case 6:return"elseif"===e||"repeat"===e||"return"===e;case 8:return"function"===e}return!1}(e=o.fixup(t.slice(x,g)))?"true"===e||"false"===e?(n=64,e="true"===e):"nil"===e?(n=128,e=null):n=8:n=4,{type:n,value:e,line:L,lineStart:S,range:[x,g]}}();switch(a){case 39:case 34:return function(){for(var e,n=t.charCodeAt(g++),i=L,s=S,a=g,c=o.discardStrings?null:"";e=t.charCodeAt(g++),n!==e;)if((g>r||H(e))&&(c+=t.slice(a,g-1),P(null,l.unfinishedString,t.slice(x,g-1))),92===e){if(!o.discardStrings){var u=t.slice(a,g-1);c+=o.fixup(u)}var h=U();o.discardStrings||(c+=h),a=g}return o.discardStrings||(c+=o.encodeByte(null),c+=o.fixup(t.slice(a,g-1))),{type:2,value:c,line:i,lineStart:s,lastLine:L,lastLineStart:S,range:[x,g]}}();case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return j();case 46:return z(c)?j():46===c?46===t.charCodeAt(g+2)?{type:256,value:"...",line:L,lineStart:S,range:[x,g+=3]}:R(".."):R(".");case 61:return R(61===c?"==":"=");case 62:return i.bitwiseOperators&&62===c?R(">>"):R(61===c?">=":">");case 60:return i.bitwiseOperators&&60===c?R("<<"):R(61===c?"<=":"<");case 126:if(61===c)return R("~=");if(!i.bitwiseOperators)break;return R("~");case 58:return i.labels&&58===c?R("::"):R(":");case 91:return 91===c||61===c?(e=L,n=S,!1===(s=F(!1))&&P(v,l.expected,"[",M(v)),{type:2,value:o.discardStrings?null:o.fixup(s),line:e,lineStart:n,lastLine:L,lastLineStart:S,range:[x,g]}):R("[");case 47:return i.integerDivision&&47===c?R("//"):R("/");case 38:case 124:if(!i.bitwiseOperators)break;case 42:case 94:case 37:case 44:case 123:case 125:case 93:case 40:case 41:case 59:case 35:case 45:case 43:return R(t.charAt(g))}return _(t.charAt(g))}function N(){var e=t.charCodeAt(g),n=t.charCodeAt(g+1);return!!H(e)&&(10===e&&13===n&&++g,13===e&&10===n&&++g,++L,S=++g,!0)}function T(){for(;g<r;)if(B(t.charCodeAt(g)))++g;else if(!N())break}function R(e){return g+=e.length,{type:32,value:e,line:L,lineStart:S,range:[x,g]}}function j(){var e=t.charAt(g),n=t.charAt(g+1),r="0"===e&&"xX".indexOf(n||null)>=0?function(){var e,n,r,i,o=0,s=1,a=1;for(i=g+=2,K(t.charCodeAt(g))||P(null,l.malformedNumber,t.slice(x,g));K(t.charCodeAt(g));)++g;e=parseInt(t.slice(i,g),16);var c=!1;if("."===t.charAt(g)){for(c=!0,n=++g;K(t.charCodeAt(g));)++g;o=t.slice(n,g),o=n===g?0:parseInt(o,16)/Math.pow(16,g-n)}var u=!1;if("pP".indexOf(t.charAt(g)||null)>=0){for(u=!0,++g,"+-".indexOf(t.charAt(g)||null)>=0&&(a="+"===t.charAt(g++)?1:-1),r=g,z(t.charCodeAt(g))||P(null,l.malformedNumber,t.slice(x,g));z(t.charCodeAt(g));)++g;s=t.slice(r,g),s=Math.pow(2,s*a)}return{value:(e+o)*s,hasFractionPart:c||u}}():function(){for(;z(t.charCodeAt(g));)++g;var e=!1;if("."===t.charAt(g))for(e=!0,++g;z(t.charCodeAt(g));)++g;var n=!1;if("eE".indexOf(t.charAt(g)||null)>=0)for(n=!0,++g,"+-".indexOf(t.charAt(g)||null)>=0&&++g,z(t.charCodeAt(g))||P(null,l.malformedNumber,t.slice(x,g));z(t.charCodeAt(g));)++g;return{value:parseFloat(t.slice(x,g)),hasFractionPart:e||n}}(),o=function(){if(i.imaginaryNumbers)return"iI".indexOf(t.charAt(g)||null)>=0&&(++g,!0)}();return function(){if(i.integerSuffixes)if("uU".indexOf(t.charAt(g)||null)>=0)if(++g,"lL".indexOf(t.charAt(g)||null)>=0){if(++g,"lL".indexOf(t.charAt(g)||null)>=0)return++g,"ULL";P(null,l.malformedNumber,t.slice(x,g))}else P(null,l.malformedNumber,t.slice(x,g));else if("lL".indexOf(t.charAt(g)||null)>=0){if(++g,"lL".indexOf(t.charAt(g)||null)>=0)return++g,"LL";P(null,l.malformedNumber,t.slice(x,g))}}()&&(o||r.hasFractionPart)&&P(null,l.malformedNumber,t.slice(x,g)),{type:16,value:r.value,line:L,lineStart:S,range:[x,g]}}function U(){var e=g;switch(t.charAt(g)){case"a":return++g,"";case"n":return++g,"\n";case"r":return++g,"\r";case"t":return++g,"\t";case"v":return++g,"\v";case"b":return++g,"\b";case"f":return++g,"\f";case"\r":case"\n":return N(),"\n";case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":for(;z(t.charCodeAt(g))&&g-e<3;)++g;var n=t.slice(e,g),r=parseInt(n,10);return r>255&&P(null,l.decimalEscapeTooLarge,"\\"+r),o.encodeByte(r,"\\"+n);case"z":if(i.skipWhitespaceEscape)return++g,T(),"";break;case"x":if(i.hexEscapes){if(K(t.charCodeAt(g+1))&&K(t.charCodeAt(g+2)))return g+=3,o.encodeByte(parseInt(t.slice(e+1,g),16),"\\"+t.slice(e,g));P(null,l.hexadecimalDigitExpected,"\\"+t.slice(e,g+2))}break;case"u":if(i.unicodeEscapes)return function(){var e=g++;for("{"!==t.charAt(g++)&&P(null,l.braceExpected,"{","\\"+t.slice(e,g)),K(t.charCodeAt(g))||P(null,l.hexadecimalDigitExpected,"\\"+t.slice(e,g));48===t.charCodeAt(g);)++g;for(var n=g;K(t.charCodeAt(g));)++g-n>6&&P(null,l.tooLargeCodepoint,"\\"+t.slice(e,g));var r=t.charAt(g++);"}"!==r&&('"'===r||"'"===r?P(null,l.braceExpected,"}","\\"+t.slice(e,g--)):P(null,l.hexadecimalDigitExpected,"\\"+t.slice(e,g)));var i=parseInt(t.slice(n,g-1)||"0",16),s="\\"+t.slice(e,g);return i>1114111&&P(null,l.tooLargeCodepoint,s),o.encodeUTF8(i,s)}();break;case"\\":case'"':case"'":return t.charAt(g++)}return i.strictEscapes&&P(null,l.invalidEscape,"\\"+t.slice(e,g+1)),t.charAt(g++)}function I(){x=g,g+=2;var e=t.charAt(g),i="",o=!1,s=g,a=S,c=L;if("["===e&&(!1===(i=F(!0))?i=e:o=!0),!o){for(;g<r&&!H(t.charCodeAt(g));)++g;n.comments&&(i=t.slice(s,g))}if(n.comments){var u=h.comment(i,t.slice(x,g));n.locations&&(u.loc={start:{line:c,column:x-a},end:{line:L,column:g-S}}),n.ranges&&(u.range=[x,g]),n.onCreateNode&&n.onCreateNode(u),b.push(u)}}function F(e){var n,i=0,o="",s=!1,a=L;for(++g;"="===t.charAt(g+i);)++i;if("["!==t.charAt(g+i))return!1;for(g+=i+1,H(t.charCodeAt(g))&&N(),n=g;g<r;){for(;H(t.charCodeAt(g));)N();if("]"===t.charAt(g++)){s=!0;for(var c=0;c<i;++c)"="!==t.charAt(g+c)&&(s=!1);"]"!==t.charAt(g+i)&&(s=!1)}if(s)return o+=t.slice(n,g-1),g+=i+1,o}P(null,e?l.unfinishedLongComment:l.unfinishedLongString,a,"<eof>")}function q(){w=v,v=y,y=$()}function V(e){return e===v.value&&(q(),!0)}function G(e){e===v.value?q():P(v,l.expected,e,M(v))}function B(e){return 9===e||32===e||11===e||12===e}function H(e){return 10===e||13===e}function z(e){return e>=48&&e<=57}function K(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function W(e){return e>=65&&e<=90||e>=97&&e<=122||95===e||e>=48&&e<=57||!!(i.extendedIdentifiers&&e>=128)}function J(e){if(1===e.type)return!0;if(4!==e.type)return!1;switch(e.value){case"else":case"elseif":case"end":case"until":return!0;default:return!1}}function X(){var e=C[E++].slice();C.push(e),n.onCreateScope&&n.onCreateScope()}function Q(){C.pop(),--E,n.onDestroyScope&&n.onDestroyScope()}function Y(e){n.onLocalDeclaration&&n.onLocalDeclaration(e),-1===d(C[E],e)&&C[E].push(e)}function Z(e){Y(e.name),ee(e,!0)}function ee(e,t){t||-1!==function(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r][t]===n)return r;return-1}(A,"name",e.name)||A.push(e),e.isLocal=t}function te(e){return-1!==d(C[E],e)}Object.assign&&(k=Object.assign),e.SyntaxError=SyntaxError,e.lex=$;var ne,re=[];function ie(){return new oe(v)}function oe(e){n.locations&&(this.loc={start:{line:e.line,column:e.range[0]-e.lineStart},end:{line:0,column:0}}),n.ranges&&(this.range=[e.range[0],0])}function se(){ne&&re.push(ie())}function ae(e){ne&&re.push(e)}function ce(){this.scopes=[],this.pendingGotos=[]}function ue(){this.level=0,this.loopLevels=[]}function le(){return i.labels?new ce:new ue}function he(e){for(var t,n=[];!J(v);){if("return"===v.value||!i.relaxedBreak&&"break"===v.value){n.push(pe(e));break}t=pe(e),V(";"),t&&n.push(t)}return n}function pe(e){if(se(),32===v.type&&V("::"))return function(e){var t=v,r=de();return n.scope&&(Y("::"+t.value+"::"),ee(r,!0)),G("::"),e.addLabel(t.value,t),p(h.labelStatement(r))}(e);if(!i.emptyStatement||!V(";")){if(e.raiseDeferredErrors(),4===v.type)switch(v.value){case"local":return q(),function(e){var t,r=w;if(8===v.type){var i=[],o=[];do{t=de(),i.push(t),e.addLocal(t.name,r)}while(V(","));if(V("="))do{var s=we(e);o.push(s)}while(V(","));if(n.scope)for(var a=0,c=i.length;a<c;++a)Z(i[a]);return p(h.localStatement(i,o))}if(V("function"))return t=de(),e.addLocal(t.name,r),n.scope&&(Z(t),X()),me(t,!0);O("<name>",v)}(e);case"if":return q(),function(e){var t,r,i,o=[];for(ne&&(i=re[re.length-1],re.push(i)),t=we(e),G("then"),n.scope&&X(),e.pushScope(),r=he(e),e.popScope(),n.scope&&Q(),o.push(p(h.ifClause(t,r))),ne&&(i=ie());V("elseif");)ae(i),t=we(e),G("then"),n.scope&&X(),e.pushScope(),r=he(e),e.popScope(),n.scope&&Q(),o.push(p(h.elseifClause(t,r))),ne&&(i=ie());return V("else")&&(ne&&(i=new oe(w),re.push(i)),n.scope&&X(),e.pushScope(),r=he(e),e.popScope(),n.scope&&Q(),o.push(p(h.elseClause(r)))),G("end"),p(h.ifStatement(o))}(e);case"return":return q(),function(e){var t=[];if("end"!==v.value){var n=ve(e);for(null!=n&&t.push(n);V(",");)n=we(e),t.push(n);V(";")}return p(h.returnStatement(t))}(e);case"function":return q(),me(function(){var e,t,r;for(ne&&(r=ie()),e=de(),n.scope&&(ee(e,te(e.name)),X());V(".");)ae(r),t=de(),e=p(h.memberExpression(e,".",t));return V(":")&&(ae(r),t=de(),e=p(h.memberExpression(e,":",t)),n.scope&&Y("self")),e}());case"while":return q(),function(e){var t=we(e);G("do"),n.scope&&X(),e.pushScope(!0);var r=he(e);return e.popScope(),n.scope&&Q(),G("end"),p(h.whileStatement(t,r))}(e);case"for":return q(),function(e){var t,r=de();if(n.scope&&(X(),Z(r)),V("=")){var i=we(e);G(",");var o=we(e),s=V(",")?we(e):null;return G("do"),e.pushScope(!0),t=he(e),e.popScope(),G("end"),n.scope&&Q(),p(h.forNumericStatement(r,i,o,s,t))}for(var a=[r];V(",");)r=de(),n.scope&&Z(r),a.push(r);G("in");var c=[];do{var u=we(e);c.push(u)}while(V(","));return G("do"),e.pushScope(!0),t=he(e),e.popScope(),G("end"),n.scope&&Q(),p(h.forGenericStatement(a,c,t))}(e);case"repeat":return q(),function(e){n.scope&&X(),e.pushScope(!0);var t=he(e);G("until"),e.raiseDeferredErrors();var r=we(e);return e.popScope(),n.scope&&Q(),p(h.repeatStatement(r,t))}(e);case"break":return q(),e.isInLoop()||P(v,l.noLoopToBreak,v.value),p(h.breakStatement());case"do":return q(),function(e){n.scope&&X(),e.pushScope();var t=he(e);return e.popScope(),n.scope&&Q(),G("end"),p(h.doStatement(t))}(e);case"goto":return q(),fe(e)}return i.contextualGoto&&8===v.type&&"goto"===v.value&&8===y.type&&"goto"!==y.value?(q(),fe(e)):(ne&&re.pop(),function(e){var t,r,i,o,s,a=[];for(ne&&(r=ie());;){if(ne&&(t=ie()),8===v.type)s=v.value,o=de(),n.scope&&ee(o,te(s)),i=!0;else{if("("!==v.value)return _(v);q(),o=we(e),G(")"),i=!1}e:for(;;){switch(2===v.type?'"':v.value){case".":case"[":i=!0;break;case":":case"(":case"{":case'"':i=null;break;default:break e}o=be(o,t,e)}if(a.push(o),","!==v.value)break;if(!i)return _(v);q()}if(1===a.length&&null===i)return ae(t),p(h.callStatement(a[0]));if(!i)return _(v);G("=");var c=[];do{c.push(we(e))}while(V(","));return ae(r),p(h.assignmentStatement(a,c))}(e))}ne&&re.pop()}function fe(e){var t=v.value,n=w,r=de();return e.addGoto(t,n),p(h.gotoStatement(r))}function de(){se();var e=v.value;return 8!==v.type&&O("<name>",v),q(),p(h.identifier(e))}function me(e,t){var r=le();r.pushScope();var i=[];if(G("("),!V(")"))for(;;){if(8===v.type){var o=de();if(n.scope&&Z(o),i.push(o),V(","))continue}else 256===v.type?(r.allowVararg=!0,i.push(Le(r))):O("<name> or '...'",v);G(")");break}var s=he(r);return r.popScope(),G("end"),n.scope&&Q(),t=t||!1,p(h.functionStatement(e,i,t,s))}function ge(e){for(var t,n,r=[];;){if(se(),32===v.type&&V("["))t=we(e),G("]"),G("="),n=we(e),r.push(p(h.tableKey(t,n)));else if(8===v.type)"="===y.value?(t=de(),q(),n=we(e),r.push(p(h.tableKeyString(t,n)))):(n=we(e),r.push(p(h.tableValue(n))));else{if(null==(n=ve(e))){re.pop();break}r.push(p(h.tableValue(n)))}if(!(",;".indexOf(v.value)>=0))break;q()}return G("}"),p(h.tableConstructorExpression(r))}function ve(e){return function e(t,r){var i,o,s,a=v.value;if(ne&&(o=ie()),function(e){return 32===e.type?"#-~".indexOf(e.value)>=0:4===e.type&&"not"===e.value}(v)){se(),q();var c=e(10,r);null==c&&O("<expression>",v),i=p(h.unaryExpression(a,c))}if(null==i&&null==(i=Le(r))&&(i=function(e){var t,r,i;if(ne&&(i=ie()),8===v.type)r=v.value,t=de(),n.scope&&ee(t,te(r));else{if(!V("("))return null;t=we(e),G(")")}for(;;){var o=be(t,i,e);if(null===o)break;t=o}return t}(r)),null==i)return null;for(;a=v.value,!(0===(s=32===v.type||4===v.type?ye(a):0)||s<=t);){"^"!==a&&".."!==a||--s,q();var u=e(s,r);null==u&&O("<expression>",v),ne&&re.push(o),i=p(h.binaryExpression(a,i,u))}return i}(0,e)}function we(e){var t=ve(e);if(null!=t)return t;O("<expression>",v)}function ye(e){var t=e.charCodeAt(0),n=e.length;if(1===n)switch(t){case 94:return 12;case 42:case 47:case 37:return 10;case 43:case 45:return 9;case 38:return 6;case 126:return 5;case 124:return 4;case 60:case 62:return 3}else if(2===n)switch(t){case 47:return 10;case 46:return 8;case 60:case 62:return"<<"===e||">>"===e?7:3;case 61:case 126:return 3;case 111:return 1}else if(97===t&&"and"===e)return 2;return 0}function be(e,t,n){var r,i;if(32===v.type)switch(v.value){case"[":return ae(t),q(),r=we(n),G("]"),p(h.indexExpression(e,r));case".":return ae(t),q(),i=de(),p(h.memberExpression(e,".",i));case":":return ae(t),q(),i=de(),e=p(h.memberExpression(e,":",i)),ae(t),xe(e,n);case"(":case"{":return ae(t),xe(e,n)}else if(2===v.type)return ae(t),xe(e,n);return null}function xe(e,t){if(32===v.type)switch(v.value){case"(":i.emptyStatement||v.line!==w.line&&P(null,l.ambiguousSyntax,v.value),q();var n=[],r=ve(t);for(null!=r&&n.push(r);V(",");)r=we(t),n.push(r);return G(")"),p(h.callExpression(e,n));case"{":se(),q();var o=ge(t);return p(h.tableCallExpression(e,o))}else if(2===v.type)return p(h.stringCallExpression(e,Le(t)));O("function arguments",v)}function Le(e){var r,i=v.value,o=v.type;if(ne&&(r=ie()),256!==o||e.allowVararg||P(v,l.cannotUseVararg,v.value),466&o){ae(r);var s=t.slice(v.range[0],v.range[1]);return q(),p(h.literal(o,i,s))}return 4===o&&"function"===i?(ae(r),q(),n.scope&&X(),me(null)):V("{")?(ae(r),ge(e)):void 0}oe.prototype.complete=function(){n.locations&&(this.loc.end.line=w.lastLine||w.line,this.loc.end.column=w.range[1]-(w.lastLineStart||w.lineStart)),n.ranges&&(this.range[1]=w.range[1])},oe.prototype.bless=function(e){if(this.loc){var t=this.loc;e.loc={start:{line:t.start.line,column:t.start.column},end:{line:t.end.line,column:t.end.column}}}this.range&&(e.range=[this.range[0],this.range[1]])},ce.prototype.isInLoop=function(){for(var e=this.scopes.length;e-- >0;)if(this.scopes[e].isLoop)return!0;return!1},ce.prototype.pushScope=function(e){var t={labels:{},locals:[],deferredGotos:[],isLoop:!!e};this.scopes.push(t)},ce.prototype.popScope=function(){for(var e=0;e<this.pendingGotos.length;++e){var t=this.pendingGotos[e];t.maxDepth>=this.scopes.length&&--t.maxDepth<=0&&P(t.token,l.labelNotVisible,t.target)}this.scopes.pop()},ce.prototype.addGoto=function(e,t){for(var n=[],r=0;r<this.scopes.length;++r){var i=this.scopes[r];if(n.push(i.locals.length),Object.prototype.hasOwnProperty.call(i.labels,e))return}this.pendingGotos.push({maxDepth:this.scopes.length,target:e,token:t,localCounts:n})},ce.prototype.addLabel=function(e,t){var n=this.currentScope();if(Object.prototype.hasOwnProperty.call(n.labels,e))P(t,l.labelAlreadyDefined,e,n.labels[e].line);else{for(var r=[],i=0;i<this.pendingGotos.length;++i){var o=this.pendingGotos[i];o.maxDepth>=this.scopes.length&&o.target===e?o.localCounts[this.scopes.length-1]<n.locals.length&&n.deferredGotos.push(o):r.push(o)}this.pendingGotos=r}n.labels[e]={localCount:n.locals.length,line:t.line}},ce.prototype.addLocal=function(e,t){this.currentScope().locals.push({name:e,token:t})},ce.prototype.currentScope=function(){return this.scopes[this.scopes.length-1]},ce.prototype.raiseDeferredErrors=function(){for(var e=this.currentScope(),t=e.deferredGotos,n=0;n<t.length;++n){var r=t[n];P(r.token,l.gotoJumpInLocalScope,r.target,e.locals[r.localCounts[this.scopes.length-1]].name)}},ue.prototype.isInLoop=function(){return!!this.loopLevels.length},ue.prototype.pushScope=function(e){++this.level,e&&this.loopLevels.push(this.level)},ue.prototype.popScope=function(){var e=this.loopLevels,t=e.length;t&&e[t-1]===this.level&&e.pop(),--this.level},ue.prototype.addGoto=ue.prototype.addLabel=function(){throw new Error("This should never happen")},ue.prototype.addLocal=ue.prototype.raiseDeferredErrors=function(){},e.parse=function(a,c){if(void 0===c&&"object"==typeof a&&(c=a,a=void 0),c||(c={}),t=a||"",n=k({},s,c),g=0,L=1,S=0,r=t.length,C=[[]],E=0,A=[],re=[],!Object.prototype.hasOwnProperty.call(Se,n.luaVersion))throw new Error(m("Lua version '%1' not supported",n.luaVersion));if(i=k({},Se[n.luaVersion]),void 0!==n.extendedIdentifiers&&(i.extendedIdentifiers=!!n.extendedIdentifiers),!Object.prototype.hasOwnProperty.call(u,n.encodingMode))throw new Error(m("Encoding mode '%1' not supported",n.encodingMode));return o=u[n.encodingMode],n.comments&&(b=[]),n.wait?e:Ee()};var Se={5.1:{},5.2:{labels:!0,emptyStatement:!0,hexEscapes:!0,skipWhitespaceEscape:!0,strictEscapes:!0,relaxedBreak:!0},5.3:{labels:!0,emptyStatement:!0,hexEscapes:!0,skipWhitespaceEscape:!0,strictEscapes:!0,unicodeEscapes:!0,bitwiseOperators:!0,integerDivision:!0,relaxedBreak:!0},LuaJIT:{labels:!0,contextualGoto:!0,hexEscapes:!0,skipWhitespaceEscape:!0,strictEscapes:!0,unicodeEscapes:!0,imaginaryNumbers:!0,integerSuffixes:!0}};function Ce(n){return t+=String(n),r=t.length,e}function Ee(e){void 0!==e&&Ce(e),t&&"#!"===t.substr(0,2)&&(t=t.replace(/^.*/,(function(e){return e.replace(/./g," ")}))),r=t.length,ne=n.locations||n.ranges,y=$();var i=function(){q(),se(),n.scope&&X();var e=le();e.allowVararg=!0,e.pushScope();var t=he(e);return e.popScope(),n.scope&&Q(),1!==v.type&&_(v),ne&&!t.length&&(w=v),p(h.chunk(t))}();if(n.comments&&(i.comments=b),n.scope&&(i.globals=A),re.length>0)throw new Error("Location tracking failed. This is most likely a bug in luaparse");return i}e.write=Ce,e.end=Ee}(t)})),ace.define("ace/mode/lua_worker",[],(function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../worker/mirror").Mirror,o=e("../mode/lua/luaparse"),s=t.Worker=function(e){i.call(this,e),this.setTimeout(500)};r.inherits(s,i),function(){this.onUpdate=function(){var e=this.doc.getValue(),t=[];try{o.parse(e)}catch(e){e instanceof o.SyntaxError&&t.push({row:e.line-1,column:e.column,text:e.message,type:"error"})}this.sender.emit("annotate",t)}}.call(s.prototype)}));