bedrock_sass 0.1.9 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (534) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -5
  3. data/assets/_vendor/ace/ace.js +21635 -0
  4. data/assets/_vendor/ace/ext-beautify.js +318 -0
  5. data/assets/_vendor/ace/ext-elastic_tabstops_lite.js +277 -0
  6. data/assets/_vendor/ace/ext-emmet.js +1226 -0
  7. data/assets/_vendor/ace/ext-error_marker.js +10 -0
  8. data/assets/_vendor/ace/ext-keybinding_menu.js +189 -0
  9. data/assets/_vendor/ace/ext-language_tools.js +1997 -0
  10. data/assets/_vendor/ace/ext-linking.js +65 -0
  11. data/assets/_vendor/ace/ext-modelist.js +228 -0
  12. data/assets/_vendor/ace/ext-options.js +750 -0
  13. data/assets/_vendor/ace/ext-rtl.js +110 -0
  14. data/assets/_vendor/ace/ext-searchbox.js +512 -0
  15. data/assets/_vendor/ace/ext-settings_menu.js +771 -0
  16. data/assets/_vendor/ace/ext-spellcheck.js +75 -0
  17. data/assets/_vendor/ace/ext-split.js +208 -0
  18. data/assets/_vendor/ace/ext-static_highlight.js +226 -0
  19. data/assets/_vendor/ace/ext-statusbar.js +57 -0
  20. data/assets/_vendor/ace/ext-textarea.js +567 -0
  21. data/assets/_vendor/ace/ext-themelist.js +67 -0
  22. data/assets/_vendor/ace/ext-whitespace.js +210 -0
  23. data/assets/_vendor/ace/keybinding-emacs.js +1165 -0
  24. data/assets/_vendor/ace/keybinding-vim.js +5673 -0
  25. data/assets/_vendor/ace/mode-abap.js +222 -0
  26. data/assets/_vendor/ace/mode-abc.js +267 -0
  27. data/assets/_vendor/ace/mode-actionscript.js +274 -0
  28. data/assets/_vendor/ace/mode-ada.js +138 -0
  29. data/assets/_vendor/ace/mode-apache_conf.js +363 -0
  30. data/assets/_vendor/ace/mode-applescript.js +279 -0
  31. data/assets/_vendor/ace/mode-asciidoc.js +349 -0
  32. data/assets/_vendor/ace/mode-asl.js +422 -0
  33. data/assets/_vendor/ace/mode-assembly_x86.js +193 -0
  34. data/assets/_vendor/ace/mode-autohotkey.js +243 -0
  35. data/assets/_vendor/ace/mode-batchfile.js +230 -0
  36. data/assets/_vendor/ace/mode-bro.js +334 -0
  37. data/assets/_vendor/ace/mode-c9search.js +294 -0
  38. data/assets/_vendor/ace/mode-c_cpp.js +502 -0
  39. data/assets/_vendor/ace/mode-cirru.js +211 -0
  40. data/assets/_vendor/ace/mode-clojure.js +314 -0
  41. data/assets/_vendor/ace/mode-cobol.js +102 -0
  42. data/assets/_vendor/ace/mode-coffee.js +400 -0
  43. data/assets/_vendor/ace/mode-coldfusion.js +2596 -0
  44. data/assets/_vendor/ace/mode-csharp.js +502 -0
  45. data/assets/_vendor/ace/mode-csound_document.js +3749 -0
  46. data/assets/_vendor/ace/mode-csound_orchestra.js +2687 -0
  47. data/assets/_vendor/ace/mode-csound_score.js +454 -0
  48. data/assets/_vendor/ace/mode-csp.js +60 -0
  49. data/assets/_vendor/ace/mode-css.js +723 -0
  50. data/assets/_vendor/ace/mode-curly.js +2564 -0
  51. data/assets/_vendor/ace/mode-d.js +520 -0
  52. data/assets/_vendor/ace/mode-dart.js +703 -0
  53. data/assets/_vendor/ace/mode-diff.js +146 -0
  54. data/assets/_vendor/ace/mode-django.js +2594 -0
  55. data/assets/_vendor/ace/mode-dockerfile.js +498 -0
  56. data/assets/_vendor/ace/mode-dot.js +418 -0
  57. data/assets/_vendor/ace/mode-drools.js +496 -0
  58. data/assets/_vendor/ace/mode-edifact.js +165 -0
  59. data/assets/_vendor/ace/mode-eiffel.js +136 -0
  60. data/assets/_vendor/ace/mode-ejs.js +3026 -0
  61. data/assets/_vendor/ace/mode-elixir.js +501 -0
  62. data/assets/_vendor/ace/mode-elm.js +307 -0
  63. data/assets/_vendor/ace/mode-erlang.js +1009 -0
  64. data/assets/_vendor/ace/mode-forth.js +297 -0
  65. data/assets/_vendor/ace/mode-fortran.js +431 -0
  66. data/assets/_vendor/ace/mode-fsharp.js +314 -0
  67. data/assets/_vendor/ace/mode-ftl.js +1192 -0
  68. data/assets/_vendor/ace/mode-gcode.js +94 -0
  69. data/assets/_vendor/ace/mode-gherkin.js +172 -0
  70. data/assets/_vendor/ace/mode-gitignore.js +60 -0
  71. data/assets/_vendor/ace/mode-glsl.js +579 -0
  72. data/assets/_vendor/ace/mode-gobstones.js +929 -0
  73. data/assets/_vendor/ace/mode-golang.js +414 -0
  74. data/assets/_vendor/ace/mode-graphqlschema.js +214 -0
  75. data/assets/_vendor/ace/mode-groovy.js +986 -0
  76. data/assets/_vendor/ace/mode-haml.js +1555 -0
  77. data/assets/_vendor/ace/mode-handlebars.js +2622 -0
  78. data/assets/_vendor/ace/mode-haskell.js +379 -0
  79. data/assets/_vendor/ace/mode-haskell_cabal.js +142 -0
  80. data/assets/_vendor/ace/mode-haxe.js +386 -0
  81. data/assets/_vendor/ace/mode-hjson.js +353 -0
  82. data/assets/_vendor/ace/mode-html.js +2509 -0
  83. data/assets/_vendor/ace/mode-html_elixir.js +3087 -0
  84. data/assets/_vendor/ace/mode-html_ruby.js +3043 -0
  85. data/assets/_vendor/ace/mode-ini.js +163 -0
  86. data/assets/_vendor/ace/mode-io.js +253 -0
  87. data/assets/_vendor/ace/mode-jack.js +347 -0
  88. data/assets/_vendor/ace/mode-jade.js +2126 -0
  89. data/assets/_vendor/ace/mode-java.js +975 -0
  90. data/assets/_vendor/ace/mode-javascript.js +797 -0
  91. data/assets/_vendor/ace/mode-json.js +327 -0
  92. data/assets/_vendor/ace/mode-jsoniq.js +4940 -0
  93. data/assets/_vendor/ace/mode-jsp.js +1430 -0
  94. data/assets/_vendor/ace/mode-jssm.js +325 -0
  95. data/assets/_vendor/ace/mode-jsx.js +412 -0
  96. data/assets/_vendor/ace/mode-julia.js +303 -0
  97. data/assets/_vendor/ace/mode-kotlin.js +795 -0
  98. data/assets/_vendor/ace/mode-latex.js +297 -0
  99. data/assets/_vendor/ace/mode-less.js +841 -0
  100. data/assets/_vendor/ace/mode-liquid.js +1193 -0
  101. data/assets/_vendor/ace/mode-lisp.js +112 -0
  102. data/assets/_vendor/ace/mode-livescript.js +280 -0
  103. data/assets/_vendor/ace/mode-logiql.js +317 -0
  104. data/assets/_vendor/ace/mode-lsl.js +343 -0
  105. data/assets/_vendor/ace/mode-lua.js +432 -0
  106. data/assets/_vendor/ace/mode-luapage.js +3007 -0
  107. data/assets/_vendor/ace/mode-lucene.js +87 -0
  108. data/assets/_vendor/ace/mode-makefile.js +410 -0
  109. data/assets/_vendor/ace/mode-markdown.js +3189 -0
  110. data/assets/_vendor/ace/mode-mask.js +1802 -0
  111. data/assets/_vendor/ace/mode-matlab.js +264 -0
  112. data/assets/_vendor/ace/mode-maze.js +291 -0
  113. data/assets/_vendor/ace/mode-mel.js +263 -0
  114. data/assets/_vendor/ace/mode-mixal.js +123 -0
  115. data/assets/_vendor/ace/mode-mushcode.js +681 -0
  116. data/assets/_vendor/ace/mode-mysql.js +168 -0
  117. data/assets/_vendor/ace/mode-nix.js +646 -0
  118. data/assets/_vendor/ace/mode-nsis.js +312 -0
  119. data/assets/_vendor/ace/mode-objectivec.js +739 -0
  120. data/assets/_vendor/ace/mode-ocaml.js +422 -0
  121. data/assets/_vendor/ace/mode-pascal.js +205 -0
  122. data/assets/_vendor/ace/mode-perl.js +380 -0
  123. data/assets/_vendor/ace/mode-pgsql.js +1508 -0
  124. data/assets/_vendor/ace/mode-php.js +13088 -0
  125. data/assets/_vendor/ace/mode-php_laravel_blade.js +13289 -0
  126. data/assets/_vendor/ace/mode-pig.js +310 -0
  127. data/assets/_vendor/ace/mode-plain_text.js +33 -0
  128. data/assets/_vendor/ace/mode-powershell.js +418 -0
  129. data/assets/_vendor/ace/mode-praat.js +478 -0
  130. data/assets/_vendor/ace/mode-prolog.js +371 -0
  131. data/assets/_vendor/ace/mode-properties.js +81 -0
  132. data/assets/_vendor/ace/mode-protobuf.js +592 -0
  133. data/assets/_vendor/ace/mode-puppet.js +370 -0
  134. data/assets/_vendor/ace/mode-python.js +273 -0
  135. data/assets/_vendor/ace/mode-r.js +310 -0
  136. data/assets/_vendor/ace/mode-razor.js +2869 -0
  137. data/assets/_vendor/ace/mode-rdoc.js +243 -0
  138. data/assets/_vendor/ace/mode-red.js +450 -0
  139. data/assets/_vendor/ace/mode-redshift.js +361 -0
  140. data/assets/_vendor/ace/mode-rhtml.js +2806 -0
  141. data/assets/_vendor/ace/mode-rst.js +257 -0
  142. data/assets/_vendor/ace/mode-ruby.js +497 -0
  143. data/assets/_vendor/ace/mode-rust.js +279 -0
  144. data/assets/_vendor/ace/mode-sass.js +441 -0
  145. data/assets/_vendor/ace/mode-scad.js +414 -0
  146. data/assets/_vendor/ace/mode-scala.js +982 -0
  147. data/assets/_vendor/ace/mode-scheme.js +232 -0
  148. data/assets/_vendor/ace/mode-scss.js +606 -0
  149. data/assets/_vendor/ace/mode-sh.js +447 -0
  150. data/assets/_vendor/ace/mode-sjs.js +1014 -0
  151. data/assets/_vendor/ace/mode-slim.js +4736 -0
  152. data/assets/_vendor/ace/mode-smarty.js +2635 -0
  153. data/assets/_vendor/ace/mode-snippets.js +207 -0
  154. data/assets/_vendor/ace/mode-soy_template.js +2847 -0
  155. data/assets/_vendor/ace/mode-space.js +168 -0
  156. data/assets/_vendor/ace/mode-sparql.js +320 -0
  157. data/assets/_vendor/ace/mode-sql.js +111 -0
  158. data/assets/_vendor/ace/mode-sqlserver.js +444 -0
  159. data/assets/_vendor/ace/mode-stylus.js +471 -0
  160. data/assets/_vendor/ace/mode-svg.js +1581 -0
  161. data/assets/_vendor/ace/mode-swift.js +390 -0
  162. data/assets/_vendor/ace/mode-tcl.js +383 -0
  163. data/assets/_vendor/ace/mode-terraform.js +398 -0
  164. data/assets/_vendor/ace/mode-tex.js +159 -0
  165. data/assets/_vendor/ace/mode-text.js +10 -0
  166. data/assets/_vendor/ace/mode-textile.js +150 -0
  167. data/assets/_vendor/ace/mode-toml.js +154 -0
  168. data/assets/_vendor/ace/mode-tsx.js +887 -0
  169. data/assets/_vendor/ace/mode-turtle.js +296 -0
  170. data/assets/_vendor/ace/mode-twig.js +2693 -0
  171. data/assets/_vendor/ace/mode-typescript.js +868 -0
  172. data/assets/_vendor/ace/mode-vala.js +676 -0
  173. data/assets/_vendor/ace/mode-vbscript.js +207 -0
  174. data/assets/_vendor/ace/mode-velocity.js +2790 -0
  175. data/assets/_vendor/ace/mode-verilog.js +119 -0
  176. data/assets/_vendor/ace/mode-vhdl.js +118 -0
  177. data/assets/_vendor/ace/mode-wollok.js +911 -0
  178. data/assets/_vendor/ace/mode-xml.js +677 -0
  179. data/assets/_vendor/ace/mode-xquery.js +4922 -0
  180. data/assets/_vendor/ace/mode-yaml.js +300 -0
  181. data/assets/_vendor/ace/snippets/abap.js +15 -0
  182. data/assets/_vendor/ace/snippets/abc.js +46 -0
  183. data/assets/_vendor/ace/snippets/actionscript.js +172 -0
  184. data/assets/_vendor/ace/snippets/ada.js +15 -0
  185. data/assets/_vendor/ace/snippets/apache_conf.js +15 -0
  186. data/assets/_vendor/ace/snippets/applescript.js +15 -0
  187. data/assets/_vendor/ace/snippets/asciidoc.js +15 -0
  188. data/assets/_vendor/ace/snippets/asl.js +14 -0
  189. data/assets/_vendor/ace/snippets/assembly_x86.js +15 -0
  190. data/assets/_vendor/ace/snippets/autohotkey.js +15 -0
  191. data/assets/_vendor/ace/snippets/batchfile.js +15 -0
  192. data/assets/_vendor/ace/snippets/bro.js +15 -0
  193. data/assets/_vendor/ace/snippets/c9search.js +15 -0
  194. data/assets/_vendor/ace/snippets/c_cpp.js +146 -0
  195. data/assets/_vendor/ace/snippets/cirru.js +15 -0
  196. data/assets/_vendor/ace/snippets/clojure.js +105 -0
  197. data/assets/_vendor/ace/snippets/cobol.js +15 -0
  198. data/assets/_vendor/ace/snippets/coffee.js +110 -0
  199. data/assets/_vendor/ace/snippets/coldfusion.js +15 -0
  200. data/assets/_vendor/ace/snippets/csharp.js +15 -0
  201. data/assets/_vendor/ace/snippets/csound_document.js +25 -0
  202. data/assets/_vendor/ace/snippets/csound_orchestra.js +62 -0
  203. data/assets/_vendor/ace/snippets/csound_score.js +15 -0
  204. data/assets/_vendor/ace/snippets/csp.js +15 -0
  205. data/assets/_vendor/ace/snippets/css.js +982 -0
  206. data/assets/_vendor/ace/snippets/curly.js +15 -0
  207. data/assets/_vendor/ace/snippets/d.js +15 -0
  208. data/assets/_vendor/ace/snippets/dart.js +98 -0
  209. data/assets/_vendor/ace/snippets/diff.js +26 -0
  210. data/assets/_vendor/ace/snippets/django.js +123 -0
  211. data/assets/_vendor/ace/snippets/dockerfile.js +15 -0
  212. data/assets/_vendor/ace/snippets/dot.js +15 -0
  213. data/assets/_vendor/ace/snippets/drools.js +34 -0
  214. data/assets/_vendor/ace/snippets/edifact.js +255 -0
  215. data/assets/_vendor/ace/snippets/eiffel.js +15 -0
  216. data/assets/_vendor/ace/snippets/ejs.js +15 -0
  217. data/assets/_vendor/ace/snippets/elixir.js +15 -0
  218. data/assets/_vendor/ace/snippets/elm.js +15 -0
  219. data/assets/_vendor/ace/snippets/erlang.js +175 -0
  220. data/assets/_vendor/ace/snippets/forth.js +15 -0
  221. data/assets/_vendor/ace/snippets/fortran.js +15 -0
  222. data/assets/_vendor/ace/snippets/fsharp.js +15 -0
  223. data/assets/_vendor/ace/snippets/ftl.js +15 -0
  224. data/assets/_vendor/ace/snippets/gcode.js +15 -0
  225. data/assets/_vendor/ace/snippets/gherkin.js +15 -0
  226. data/assets/_vendor/ace/snippets/gitignore.js +15 -0
  227. data/assets/_vendor/ace/snippets/glsl.js +15 -0
  228. data/assets/_vendor/ace/snippets/gobstones.js +49 -0
  229. data/assets/_vendor/ace/snippets/golang.js +15 -0
  230. data/assets/_vendor/ace/snippets/graphqlschema.js +47 -0
  231. data/assets/_vendor/ace/snippets/groovy.js +15 -0
  232. data/assets/_vendor/ace/snippets/haml.js +35 -0
  233. data/assets/_vendor/ace/snippets/handlebars.js +15 -0
  234. data/assets/_vendor/ace/snippets/haskell.js +97 -0
  235. data/assets/_vendor/ace/snippets/haskell_cabal.js +15 -0
  236. data/assets/_vendor/ace/snippets/haxe.js +15 -0
  237. data/assets/_vendor/ace/snippets/hjson.js +15 -0
  238. data/assets/_vendor/ace/snippets/html.js +870 -0
  239. data/assets/_vendor/ace/snippets/html_elixir.js +15 -0
  240. data/assets/_vendor/ace/snippets/html_ruby.js +15 -0
  241. data/assets/_vendor/ace/snippets/ini.js +15 -0
  242. data/assets/_vendor/ace/snippets/io.js +77 -0
  243. data/assets/_vendor/ace/snippets/jack.js +15 -0
  244. data/assets/_vendor/ace/snippets/jade.js +15 -0
  245. data/assets/_vendor/ace/snippets/java.js +255 -0
  246. data/assets/_vendor/ace/snippets/javascript.js +210 -0
  247. data/assets/_vendor/ace/snippets/json.js +15 -0
  248. data/assets/_vendor/ace/snippets/jsoniq.js +76 -0
  249. data/assets/_vendor/ace/snippets/jsp.js +114 -0
  250. data/assets/_vendor/ace/snippets/jssm.js +15 -0
  251. data/assets/_vendor/ace/snippets/jsx.js +15 -0
  252. data/assets/_vendor/ace/snippets/julia.js +15 -0
  253. data/assets/_vendor/ace/snippets/kotlin.js +15 -0
  254. data/assets/_vendor/ace/snippets/latex.js +15 -0
  255. data/assets/_vendor/ace/snippets/less.js +15 -0
  256. data/assets/_vendor/ace/snippets/liquid.js +15 -0
  257. data/assets/_vendor/ace/snippets/lisp.js +15 -0
  258. data/assets/_vendor/ace/snippets/livescript.js +15 -0
  259. data/assets/_vendor/ace/snippets/logiql.js +15 -0
  260. data/assets/_vendor/ace/snippets/lsl.js +1247 -0
  261. data/assets/_vendor/ace/snippets/lua.js +36 -0
  262. data/assets/_vendor/ace/snippets/luapage.js +15 -0
  263. data/assets/_vendor/ace/snippets/lucene.js +15 -0
  264. data/assets/_vendor/ace/snippets/makefile.js +19 -0
  265. data/assets/_vendor/ace/snippets/markdown.js +103 -0
  266. data/assets/_vendor/ace/snippets/mask.js +15 -0
  267. data/assets/_vendor/ace/snippets/matlab.js +15 -0
  268. data/assets/_vendor/ace/snippets/maze.js +24 -0
  269. data/assets/_vendor/ace/snippets/mel.js +15 -0
  270. data/assets/_vendor/ace/snippets/mixal.js +15 -0
  271. data/assets/_vendor/ace/snippets/mushcode.js +15 -0
  272. data/assets/_vendor/ace/snippets/mysql.js +15 -0
  273. data/assets/_vendor/ace/snippets/nix.js +15 -0
  274. data/assets/_vendor/ace/snippets/nsis.js +15 -0
  275. data/assets/_vendor/ace/snippets/objectivec.js +15 -0
  276. data/assets/_vendor/ace/snippets/ocaml.js +15 -0
  277. data/assets/_vendor/ace/snippets/pascal.js +15 -0
  278. data/assets/_vendor/ace/snippets/perl.js +362 -0
  279. data/assets/_vendor/ace/snippets/pgsql.js +15 -0
  280. data/assets/_vendor/ace/snippets/php.js +398 -0
  281. data/assets/_vendor/ace/snippets/php_laravel_blade.js +15 -0
  282. data/assets/_vendor/ace/snippets/pig.js +15 -0
  283. data/assets/_vendor/ace/snippets/plain_text.js +15 -0
  284. data/assets/_vendor/ace/snippets/powershell.js +15 -0
  285. data/assets/_vendor/ace/snippets/praat.js +15 -0
  286. data/assets/_vendor/ace/snippets/prolog.js +15 -0
  287. data/assets/_vendor/ace/snippets/properties.js +15 -0
  288. data/assets/_vendor/ace/snippets/protobuf.js +15 -0
  289. data/assets/_vendor/ace/snippets/puppet.js +15 -0
  290. data/assets/_vendor/ace/snippets/python.js +173 -0
  291. data/assets/_vendor/ace/snippets/r.js +136 -0
  292. data/assets/_vendor/ace/snippets/razor.js +18 -0
  293. data/assets/_vendor/ace/snippets/rdoc.js +15 -0
  294. data/assets/_vendor/ace/snippets/red.js +15 -0
  295. data/assets/_vendor/ace/snippets/redshift.js +15 -0
  296. data/assets/_vendor/ace/snippets/rhtml.js +15 -0
  297. data/assets/_vendor/ace/snippets/rst.js +37 -0
  298. data/assets/_vendor/ace/snippets/ruby.js +943 -0
  299. data/assets/_vendor/ace/snippets/rust.js +15 -0
  300. data/assets/_vendor/ace/snippets/sass.js +15 -0
  301. data/assets/_vendor/ace/snippets/scad.js +15 -0
  302. data/assets/_vendor/ace/snippets/scala.js +15 -0
  303. data/assets/_vendor/ace/snippets/scheme.js +15 -0
  304. data/assets/_vendor/ace/snippets/scss.js +15 -0
  305. data/assets/_vendor/ace/snippets/sh.js +98 -0
  306. data/assets/_vendor/ace/snippets/sjs.js +15 -0
  307. data/assets/_vendor/ace/snippets/slim.js +15 -0
  308. data/assets/_vendor/ace/snippets/smarty.js +15 -0
  309. data/assets/_vendor/ace/snippets/snippets.js +24 -0
  310. data/assets/_vendor/ace/snippets/soy_template.js +15 -0
  311. data/assets/_vendor/ace/snippets/space.js +15 -0
  312. data/assets/_vendor/ace/snippets/sparql.js +15 -0
  313. data/assets/_vendor/ace/snippets/sql.js +41 -0
  314. data/assets/_vendor/ace/snippets/sqlserver.js +84 -0
  315. data/assets/_vendor/ace/snippets/stylus.js +15 -0
  316. data/assets/_vendor/ace/snippets/svg.js +15 -0
  317. data/assets/_vendor/ace/snippets/swift.js +15 -0
  318. data/assets/_vendor/ace/snippets/tcl.js +107 -0
  319. data/assets/_vendor/ace/snippets/terraform.js +15 -0
  320. data/assets/_vendor/ace/snippets/tex.js +205 -0
  321. data/assets/_vendor/ace/snippets/text.js +15 -0
  322. data/assets/_vendor/ace/snippets/textile.js +45 -0
  323. data/assets/_vendor/ace/snippets/toml.js +15 -0
  324. data/assets/_vendor/ace/snippets/tsx.js +15 -0
  325. data/assets/_vendor/ace/snippets/turtle.js +15 -0
  326. data/assets/_vendor/ace/snippets/twig.js +15 -0
  327. data/assets/_vendor/ace/snippets/typescript.js +15 -0
  328. data/assets/_vendor/ace/snippets/vala.js +201 -0
  329. data/assets/_vendor/ace/snippets/vbscript.js +15 -0
  330. data/assets/_vendor/ace/snippets/velocity.js +44 -0
  331. data/assets/_vendor/ace/snippets/verilog.js +15 -0
  332. data/assets/_vendor/ace/snippets/vhdl.js +15 -0
  333. data/assets/_vendor/ace/snippets/wollok.js +99 -0
  334. data/assets/_vendor/ace/snippets/xml.js +15 -0
  335. data/assets/_vendor/ace/snippets/xquery.js +76 -0
  336. data/assets/_vendor/ace/snippets/yaml.js +15 -0
  337. data/assets/_vendor/ace/theme-ambiance.js +185 -0
  338. data/assets/_vendor/ace/theme-chaos.js +164 -0
  339. data/assets/_vendor/ace/theme-chrome.js +136 -0
  340. data/assets/_vendor/ace/theme-clouds.js +103 -0
  341. data/assets/_vendor/ace/theme-clouds_midnight.js +104 -0
  342. data/assets/_vendor/ace/theme-cobalt.js +121 -0
  343. data/assets/_vendor/ace/theme-crimson_editor.js +126 -0
  344. data/assets/_vendor/ace/theme-dawn.js +116 -0
  345. data/assets/_vendor/ace/theme-dracula.js +136 -0
  346. data/assets/_vendor/ace/theme-dreamweaver.js +149 -0
  347. data/assets/_vendor/ace/theme-eclipse.js +106 -0
  348. data/assets/_vendor/ace/theme-github.js +110 -0
  349. data/assets/_vendor/ace/theme-gob.js +120 -0
  350. data/assets/_vendor/ace/theme-gruvbox.js +90 -0
  351. data/assets/_vendor/ace/theme-idle_fingers.js +104 -0
  352. data/assets/_vendor/ace/theme-iplastic.js +129 -0
  353. data/assets/_vendor/ace/theme-katzenmilch.js +129 -0
  354. data/assets/_vendor/ace/theme-kr_theme.js +112 -0
  355. data/assets/_vendor/ace/theme-kuroir.js +69 -0
  356. data/assets/_vendor/ace/theme-merbivore.js +103 -0
  357. data/assets/_vendor/ace/theme-merbivore_soft.js +104 -0
  358. data/assets/_vendor/ace/theme-mono_industrial.js +115 -0
  359. data/assets/_vendor/ace/theme-monokai.js +113 -0
  360. data/assets/_vendor/ace/theme-pastel_on_dark.js +116 -0
  361. data/assets/_vendor/ace/theme-solarized_dark.js +96 -0
  362. data/assets/_vendor/ace/theme-solarized_light.js +99 -0
  363. data/assets/_vendor/ace/theme-sqlserver.js +146 -0
  364. data/assets/_vendor/ace/theme-terminal.js +122 -0
  365. data/assets/_vendor/ace/theme-textmate.js +138 -0
  366. data/assets/_vendor/ace/theme-tomorrow.js +116 -0
  367. data/assets/_vendor/ace/theme-tomorrow_night.js +116 -0
  368. data/assets/_vendor/ace/theme-tomorrow_night_blue.js +114 -0
  369. data/assets/_vendor/ace/theme-tomorrow_night_bright.js +129 -0
  370. data/assets/_vendor/ace/theme-tomorrow_night_eighties.js +116 -0
  371. data/assets/_vendor/ace/theme-twilight.js +117 -0
  372. data/assets/_vendor/ace/theme-vibrant_ink.js +102 -0
  373. data/assets/_vendor/ace/theme-xcode.js +96 -0
  374. data/assets/_vendor/ace/worker-coffee.js +2165 -0
  375. data/assets/_vendor/ace/worker-css.js +8764 -0
  376. data/assets/_vendor/ace/worker-html.js +11614 -0
  377. data/assets/_vendor/ace/worker-javascript.js +12491 -0
  378. data/assets/_vendor/ace/worker-json.js +2396 -0
  379. data/assets/_vendor/ace/worker-lua.js +3637 -0
  380. data/assets/_vendor/ace/worker-php.js +4313 -0
  381. data/assets/_vendor/ace/worker-xml.js +3899 -0
  382. data/assets/_vendor/ace/worker-xquery.js +70688 -0
  383. data/assets/_vendor/motion-ui/_settings.scss +1 -0
  384. data/assets/_vendor/motion-ui/effects/_fade.scss +1 -4
  385. data/assets/_vendor/motion-ui/effects/_hinge.scss +4 -3
  386. data/assets/_vendor/motion-ui/effects/_shake.scss +1 -1
  387. data/assets/_vendor/motion-ui/effects/_slide.scss +4 -3
  388. data/assets/_vendor/motion-ui/effects/_spin.scss +4 -3
  389. data/assets/_vendor/motion-ui/effects/_wiggle.scss +1 -1
  390. data/assets/_vendor/motion-ui/effects/_zoom.scss +2 -2
  391. data/assets/_vendor/motion-ui/motion-ui.scss +2 -0
  392. data/assets/_vendor/motion-ui/transitions/_fade.scss +6 -4
  393. data/assets/_vendor/motion-ui/transitions/_hinge.scss +3 -2
  394. data/assets/_vendor/motion-ui/transitions/_slide.scss +3 -2
  395. data/assets/_vendor/motion-ui/transitions/_spin.scss +2 -1
  396. data/assets/_vendor/motion-ui/transitions/_zoom.scss +6 -4
  397. data/assets/_vendor/motion-ui/util/_animation.scss +1 -1
  398. data/assets/_vendor/motion-ui/util/_args.scss +2 -2
  399. data/assets/_vendor/motion-ui/util/_function.scss +94 -0
  400. data/assets/_vendor/motion-ui/util/_keyframe.scss +5 -5
  401. data/assets/_vendor/motion-ui/util/_series.scss +20 -17
  402. data/assets/_vendor/motion-ui/util/_string.scss +36 -0
  403. data/assets/_vendor/tinymce/plugins/advlist/plugin.js +136 -404
  404. data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -1
  405. data/assets/_vendor/tinymce/plugins/anchor/plugin.js +103 -323
  406. data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -1
  407. data/assets/_vendor/tinymce/plugins/autolink/plugin.js +153 -377
  408. data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -1
  409. data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +145 -427
  410. data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -1
  411. data/assets/_vendor/tinymce/plugins/autosave/plugin.js +197 -579
  412. data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -1
  413. data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +88 -251
  414. data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -1
  415. data/assets/_vendor/tinymce/plugins/charmap/plugin.js +1243 -818
  416. data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -1
  417. data/assets/_vendor/tinymce/plugins/code/plugin.js +82 -326
  418. data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -1
  419. data/assets/_vendor/tinymce/plugins/codesample/plugin.js +829 -1444
  420. data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -1
  421. data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +111 -257
  422. data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -1
  423. data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +141 -469
  424. data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -1
  425. data/assets/_vendor/tinymce/plugins/directionality/plugin.js +57 -261
  426. data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -1
  427. data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +78 -247
  428. data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -1
  429. data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +463 -906
  430. data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -1
  431. data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +149 -427
  432. data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -1
  433. data/assets/_vendor/tinymce/plugins/help/plugin.js +634 -1434
  434. data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -1
  435. data/assets/_vendor/tinymce/plugins/hr/plugin.js +29 -185
  436. data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -1
  437. data/assets/_vendor/tinymce/plugins/image/plugin.js +1147 -1508
  438. data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -1
  439. data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +3319 -4079
  440. data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +1 -2
  441. data/assets/_vendor/tinymce/plugins/importcss/plugin.js +230 -543
  442. data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -1
  443. data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +151 -460
  444. data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -1
  445. data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +204 -379
  446. data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -1
  447. data/assets/_vendor/tinymce/plugins/link/plugin.js +644 -1162
  448. data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -1
  449. data/assets/_vendor/tinymce/plugins/lists/plugin.js +1005 -1875
  450. data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -1
  451. data/assets/_vendor/tinymce/plugins/media/plugin.js +1066 -1926
  452. data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -1
  453. data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +70 -298
  454. data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -1
  455. data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +96 -294
  456. data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -1
  457. data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +92 -337
  458. data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -1
  459. data/assets/_vendor/tinymce/plugins/paste/plugin.js +1363 -2801
  460. data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -1
  461. data/assets/_vendor/tinymce/plugins/preview/plugin.js +106 -393
  462. data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -1
  463. data/assets/_vendor/tinymce/plugins/print/plugin.js +29 -185
  464. data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -1
  465. data/assets/_vendor/tinymce/plugins/save/plugin.js +100 -350
  466. data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -1
  467. data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +491 -865
  468. data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -1
  469. data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +630 -1292
  470. data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -1
  471. data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +96 -391
  472. data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -1
  473. data/assets/_vendor/tinymce/plugins/table/plugin.js +9537 -14920
  474. data/assets/_vendor/tinymce/plugins/table/plugin.min.js +1 -5
  475. data/assets/_vendor/tinymce/plugins/template/plugin.js +309 -771
  476. data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -1
  477. data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +319 -592
  478. data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -1
  479. data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +326 -674
  480. data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -1
  481. data/assets/_vendor/tinymce/plugins/toc/plugin.js +199 -530
  482. data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -1
  483. data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +112 -436
  484. data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -1
  485. data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +428 -1248
  486. data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -1
  487. data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +307 -699
  488. data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -1
  489. data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -1
  490. data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -1
  491. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
  492. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +1 -1
  493. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
  494. data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
  495. data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -1
  496. data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +1 -1
  497. data/assets/_vendor/tinymce/themes/inlite/theme.js +9693 -18245
  498. data/assets/_vendor/tinymce/themes/inlite/theme.min.js +1 -5
  499. data/assets/_vendor/tinymce/themes/mobile/theme.js +12629 -22467
  500. data/assets/_vendor/tinymce/themes/mobile/theme.min.js +1 -8
  501. data/assets/_vendor/tinymce/themes/modern/theme.js +9510 -17780
  502. data/assets/_vendor/tinymce/themes/modern/theme.min.js +1 -5
  503. data/assets/_vendor/tinymce/tinymce.js +25087 -42606
  504. data/assets/_vendor/yoastseo/css/_icons.scss +7 -7
  505. data/assets/_vendor/yoastseo/css/_snippet-editor.scss +1 -1
  506. data/assets/bedrock/js/bedrock.js +1 -71697
  507. data/assets/bedrock/scss/_bedrock-components.scss +20 -0
  508. data/assets/bedrock/scss/_bedrock-settings.scss +12 -4
  509. data/assets/bedrock/scss/_foundation-settings.scss +4 -2
  510. data/assets/bedrock/scss/components/ace-editor.scss +21 -0
  511. data/assets/bedrock/scss/components/attachments-grid.scss +18 -15
  512. data/assets/bedrock/scss/components/date-picker.scss +146 -0
  513. data/assets/bedrock/scss/components/dropzone-upload.scss +7 -0
  514. data/assets/bedrock/scss/components/file-input.scss +7 -0
  515. data/assets/bedrock/scss/components/file-preview.scss +36 -0
  516. data/assets/bedrock/scss/components/frame-embed.scss +23 -0
  517. data/assets/bedrock/scss/components/global.scss +27 -0
  518. data/assets/bedrock/scss/components/helper-classes.scss +1 -0
  519. data/assets/bedrock/scss/components/icon-box.scss +38 -0
  520. data/assets/bedrock/scss/components/item-list.scss +66 -0
  521. data/assets/bedrock/scss/components/lists.scss +58 -0
  522. data/assets/bedrock/scss/components/off-canvas-menu.scss +27 -15
  523. data/assets/bedrock/scss/components/place-autocomplete.scss +90 -0
  524. data/assets/bedrock/scss/components/rrule-generator.scss +102 -0
  525. data/assets/bedrock/scss/components/rrule-reveal.scss +14 -0
  526. data/assets/bedrock/scss/components/select-box.scss +1 -0
  527. data/assets/bedrock/scss/components/seo-analysis.scss +5 -0
  528. data/assets/bedrock/scss/components/textarea.scss +14 -2
  529. data/assets/bedrock/scss/components/tiny-mce-editor.scss +5 -16
  530. data/lib/bedrock_sass.rb +5 -0
  531. data/lib/bedrock_sass/version.rb +1 -1
  532. data/lib/tasks/before_assets_precompile.rake +1 -0
  533. metadata +395 -4
  534. data/CODE_OF_CONDUCT.md +0 -74
@@ -0,0 +1,3637 @@
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
+ require("ace/lib/es5-shim");
213
+ sender = window.sender = window.initSender();
214
+ var clazz = require(msg.module)[msg.classname];
215
+ main = window.main = new clazz(sender);
216
+ }
217
+ };
218
+ })(this);
219
+
220
+ define("ace/lib/oop",[], function(require, exports, module) {
221
+ "use strict";
222
+
223
+ exports.inherits = function(ctor, superCtor) {
224
+ ctor.super_ = superCtor;
225
+ ctor.prototype = Object.create(superCtor.prototype, {
226
+ constructor: {
227
+ value: ctor,
228
+ enumerable: false,
229
+ writable: true,
230
+ configurable: true
231
+ }
232
+ });
233
+ };
234
+
235
+ exports.mixin = function(obj, mixin) {
236
+ for (var key in mixin) {
237
+ obj[key] = mixin[key];
238
+ }
239
+ return obj;
240
+ };
241
+
242
+ exports.implement = function(proto, mixin) {
243
+ exports.mixin(proto, mixin);
244
+ };
245
+
246
+ });
247
+
248
+ define("ace/range",[], function(require, exports, module) {
249
+ "use strict";
250
+ var comparePoints = function(p1, p2) {
251
+ return p1.row - p2.row || p1.column - p2.column;
252
+ };
253
+ var Range = function(startRow, startColumn, endRow, endColumn) {
254
+ this.start = {
255
+ row: startRow,
256
+ column: startColumn
257
+ };
258
+
259
+ this.end = {
260
+ row: endRow,
261
+ column: endColumn
262
+ };
263
+ };
264
+
265
+ (function() {
266
+ this.isEqual = function(range) {
267
+ return this.start.row === range.start.row &&
268
+ this.end.row === range.end.row &&
269
+ this.start.column === range.start.column &&
270
+ this.end.column === range.end.column;
271
+ };
272
+ this.toString = function() {
273
+ return ("Range: [" + this.start.row + "/" + this.start.column +
274
+ "] -> [" + this.end.row + "/" + this.end.column + "]");
275
+ };
276
+
277
+ this.contains = function(row, column) {
278
+ return this.compare(row, column) == 0;
279
+ };
280
+ this.compareRange = function(range) {
281
+ var cmp,
282
+ end = range.end,
283
+ start = range.start;
284
+
285
+ cmp = this.compare(end.row, end.column);
286
+ if (cmp == 1) {
287
+ cmp = this.compare(start.row, start.column);
288
+ if (cmp == 1) {
289
+ return 2;
290
+ } else if (cmp == 0) {
291
+ return 1;
292
+ } else {
293
+ return 0;
294
+ }
295
+ } else if (cmp == -1) {
296
+ return -2;
297
+ } else {
298
+ cmp = this.compare(start.row, start.column);
299
+ if (cmp == -1) {
300
+ return -1;
301
+ } else if (cmp == 1) {
302
+ return 42;
303
+ } else {
304
+ return 0;
305
+ }
306
+ }
307
+ };
308
+ this.comparePoint = function(p) {
309
+ return this.compare(p.row, p.column);
310
+ };
311
+ this.containsRange = function(range) {
312
+ return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
313
+ };
314
+ this.intersects = function(range) {
315
+ var cmp = this.compareRange(range);
316
+ return (cmp == -1 || cmp == 0 || cmp == 1);
317
+ };
318
+ this.isEnd = function(row, column) {
319
+ return this.end.row == row && this.end.column == column;
320
+ };
321
+ this.isStart = function(row, column) {
322
+ return this.start.row == row && this.start.column == column;
323
+ };
324
+ this.setStart = function(row, column) {
325
+ if (typeof row == "object") {
326
+ this.start.column = row.column;
327
+ this.start.row = row.row;
328
+ } else {
329
+ this.start.row = row;
330
+ this.start.column = column;
331
+ }
332
+ };
333
+ this.setEnd = function(row, column) {
334
+ if (typeof row == "object") {
335
+ this.end.column = row.column;
336
+ this.end.row = row.row;
337
+ } else {
338
+ this.end.row = row;
339
+ this.end.column = column;
340
+ }
341
+ };
342
+ this.inside = function(row, column) {
343
+ if (this.compare(row, column) == 0) {
344
+ if (this.isEnd(row, column) || this.isStart(row, column)) {
345
+ return false;
346
+ } else {
347
+ return true;
348
+ }
349
+ }
350
+ return false;
351
+ };
352
+ this.insideStart = function(row, column) {
353
+ if (this.compare(row, column) == 0) {
354
+ if (this.isEnd(row, column)) {
355
+ return false;
356
+ } else {
357
+ return true;
358
+ }
359
+ }
360
+ return false;
361
+ };
362
+ this.insideEnd = function(row, column) {
363
+ if (this.compare(row, column) == 0) {
364
+ if (this.isStart(row, column)) {
365
+ return false;
366
+ } else {
367
+ return true;
368
+ }
369
+ }
370
+ return false;
371
+ };
372
+ this.compare = function(row, column) {
373
+ if (!this.isMultiLine()) {
374
+ if (row === this.start.row) {
375
+ return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
376
+ }
377
+ }
378
+
379
+ if (row < this.start.row)
380
+ return -1;
381
+
382
+ if (row > this.end.row)
383
+ return 1;
384
+
385
+ if (this.start.row === row)
386
+ return column >= this.start.column ? 0 : -1;
387
+
388
+ if (this.end.row === row)
389
+ return column <= this.end.column ? 0 : 1;
390
+
391
+ return 0;
392
+ };
393
+ this.compareStart = function(row, column) {
394
+ if (this.start.row == row && this.start.column == column) {
395
+ return -1;
396
+ } else {
397
+ return this.compare(row, column);
398
+ }
399
+ };
400
+ this.compareEnd = function(row, column) {
401
+ if (this.end.row == row && this.end.column == column) {
402
+ return 1;
403
+ } else {
404
+ return this.compare(row, column);
405
+ }
406
+ };
407
+ this.compareInside = function(row, column) {
408
+ if (this.end.row == row && this.end.column == column) {
409
+ return 1;
410
+ } else if (this.start.row == row && this.start.column == column) {
411
+ return -1;
412
+ } else {
413
+ return this.compare(row, column);
414
+ }
415
+ };
416
+ this.clipRows = function(firstRow, lastRow) {
417
+ if (this.end.row > lastRow)
418
+ var end = {row: lastRow + 1, column: 0};
419
+ else if (this.end.row < firstRow)
420
+ var end = {row: firstRow, column: 0};
421
+
422
+ if (this.start.row > lastRow)
423
+ var start = {row: lastRow + 1, column: 0};
424
+ else if (this.start.row < firstRow)
425
+ var start = {row: firstRow, column: 0};
426
+
427
+ return Range.fromPoints(start || this.start, end || this.end);
428
+ };
429
+ this.extend = function(row, column) {
430
+ var cmp = this.compare(row, column);
431
+
432
+ if (cmp == 0)
433
+ return this;
434
+ else if (cmp == -1)
435
+ var start = {row: row, column: column};
436
+ else
437
+ var end = {row: row, column: column};
438
+
439
+ return Range.fromPoints(start || this.start, end || this.end);
440
+ };
441
+
442
+ this.isEmpty = function() {
443
+ return (this.start.row === this.end.row && this.start.column === this.end.column);
444
+ };
445
+ this.isMultiLine = function() {
446
+ return (this.start.row !== this.end.row);
447
+ };
448
+ this.clone = function() {
449
+ return Range.fromPoints(this.start, this.end);
450
+ };
451
+ this.collapseRows = function() {
452
+ if (this.end.column == 0)
453
+ return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0);
454
+ else
455
+ return new Range(this.start.row, 0, this.end.row, 0);
456
+ };
457
+ this.toScreenRange = function(session) {
458
+ var screenPosStart = session.documentToScreenPosition(this.start);
459
+ var screenPosEnd = session.documentToScreenPosition(this.end);
460
+
461
+ return new Range(
462
+ screenPosStart.row, screenPosStart.column,
463
+ screenPosEnd.row, screenPosEnd.column
464
+ );
465
+ };
466
+ this.moveBy = function(row, column) {
467
+ this.start.row += row;
468
+ this.start.column += column;
469
+ this.end.row += row;
470
+ this.end.column += column;
471
+ };
472
+
473
+ }).call(Range.prototype);
474
+ Range.fromPoints = function(start, end) {
475
+ return new Range(start.row, start.column, end.row, end.column);
476
+ };
477
+ Range.comparePoints = comparePoints;
478
+
479
+ Range.comparePoints = function(p1, p2) {
480
+ return p1.row - p2.row || p1.column - p2.column;
481
+ };
482
+
483
+
484
+ exports.Range = Range;
485
+ });
486
+
487
+ define("ace/apply_delta",[], function(require, exports, module) {
488
+ "use strict";
489
+
490
+ function throwDeltaError(delta, errorText){
491
+ console.log("Invalid Delta:", delta);
492
+ throw "Invalid Delta: " + errorText;
493
+ }
494
+
495
+ function positionInDocument(docLines, position) {
496
+ return position.row >= 0 && position.row < docLines.length &&
497
+ position.column >= 0 && position.column <= docLines[position.row].length;
498
+ }
499
+
500
+ function validateDelta(docLines, delta) {
501
+ if (delta.action != "insert" && delta.action != "remove")
502
+ throwDeltaError(delta, "delta.action must be 'insert' or 'remove'");
503
+ if (!(delta.lines instanceof Array))
504
+ throwDeltaError(delta, "delta.lines must be an Array");
505
+ if (!delta.start || !delta.end)
506
+ throwDeltaError(delta, "delta.start/end must be an present");
507
+ var start = delta.start;
508
+ if (!positionInDocument(docLines, delta.start))
509
+ throwDeltaError(delta, "delta.start must be contained in document");
510
+ var end = delta.end;
511
+ if (delta.action == "remove" && !positionInDocument(docLines, end))
512
+ throwDeltaError(delta, "delta.end must contained in document for 'remove' actions");
513
+ var numRangeRows = end.row - start.row;
514
+ var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0));
515
+ if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars)
516
+ throwDeltaError(delta, "delta.range must match delta lines");
517
+ }
518
+
519
+ exports.applyDelta = function(docLines, delta, doNotValidate) {
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
+ 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
+ callback && this.addEventListener(eventName, function newCallback() {
602
+ _self.removeEventListener(eventName, newCallback);
603
+ callback.apply(null, arguments);
604
+ });
605
+ };
606
+
607
+
608
+ EventEmitter.setDefaultHandler = function(eventName, callback) {
609
+ var handlers = this._defaultHandlers;
610
+ if (!handlers)
611
+ handlers = this._defaultHandlers = {_disabled_: {}};
612
+
613
+ if (handlers[eventName]) {
614
+ var old = handlers[eventName];
615
+ var disabled = handlers._disabled_[eventName];
616
+ if (!disabled)
617
+ handlers._disabled_[eventName] = disabled = [];
618
+ disabled.push(old);
619
+ var i = disabled.indexOf(callback);
620
+ if (i != -1)
621
+ disabled.splice(i, 1);
622
+ }
623
+ handlers[eventName] = callback;
624
+ };
625
+ EventEmitter.removeDefaultHandler = function(eventName, callback) {
626
+ var handlers = this._defaultHandlers;
627
+ if (!handlers)
628
+ return;
629
+ var disabled = handlers._disabled_[eventName];
630
+
631
+ if (handlers[eventName] == callback) {
632
+ if (disabled)
633
+ this.setDefaultHandler(eventName, disabled.pop());
634
+ } else if (disabled) {
635
+ var i = disabled.indexOf(callback);
636
+ if (i != -1)
637
+ disabled.splice(i, 1);
638
+ }
639
+ };
640
+
641
+ EventEmitter.on =
642
+ EventEmitter.addEventListener = function(eventName, callback, capturing) {
643
+ this._eventRegistry = this._eventRegistry || {};
644
+
645
+ var listeners = this._eventRegistry[eventName];
646
+ if (!listeners)
647
+ listeners = this._eventRegistry[eventName] = [];
648
+
649
+ if (listeners.indexOf(callback) == -1)
650
+ listeners[capturing ? "unshift" : "push"](callback);
651
+ return callback;
652
+ };
653
+
654
+ EventEmitter.off =
655
+ EventEmitter.removeListener =
656
+ EventEmitter.removeEventListener = function(eventName, callback) {
657
+ this._eventRegistry = this._eventRegistry || {};
658
+
659
+ var listeners = this._eventRegistry[eventName];
660
+ if (!listeners)
661
+ return;
662
+
663
+ var index = listeners.indexOf(callback);
664
+ if (index !== -1)
665
+ listeners.splice(index, 1);
666
+ };
667
+
668
+ EventEmitter.removeAllListeners = function(eventName) {
669
+ if (this._eventRegistry) this._eventRegistry[eventName] = [];
670
+ };
671
+
672
+ exports.EventEmitter = EventEmitter;
673
+
674
+ });
675
+
676
+ define("ace/anchor",[], function(require, exports, module) {
677
+ "use strict";
678
+
679
+ var oop = require("./lib/oop");
680
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
681
+
682
+ var Anchor = exports.Anchor = function(doc, row, column) {
683
+ this.$onChange = this.onChange.bind(this);
684
+ this.attach(doc);
685
+
686
+ if (typeof column == "undefined")
687
+ this.setPosition(row.row, row.column);
688
+ else
689
+ this.setPosition(row, column);
690
+ };
691
+
692
+ (function() {
693
+
694
+ oop.implement(this, EventEmitter);
695
+ this.getPosition = function() {
696
+ return this.$clipPositionToDocument(this.row, this.column);
697
+ };
698
+ this.getDocument = function() {
699
+ return this.document;
700
+ };
701
+ this.$insertRight = false;
702
+ this.onChange = function(delta) {
703
+ if (delta.start.row == delta.end.row && delta.start.row != this.row)
704
+ return;
705
+
706
+ if (delta.start.row > this.row)
707
+ return;
708
+
709
+ var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight);
710
+ this.setPosition(point.row, point.column, true);
711
+ };
712
+
713
+ function $pointsInOrder(point1, point2, equalPointsInOrder) {
714
+ var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column;
715
+ return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter);
716
+ }
717
+
718
+ function $getTransformedPoint(delta, point, moveIfEqual) {
719
+ var deltaIsInsert = delta.action == "insert";
720
+ var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row);
721
+ var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column);
722
+ var deltaStart = delta.start;
723
+ var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range.
724
+ if ($pointsInOrder(point, deltaStart, moveIfEqual)) {
725
+ return {
726
+ row: point.row,
727
+ column: point.column
728
+ };
729
+ }
730
+ if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) {
731
+ return {
732
+ row: point.row + deltaRowShift,
733
+ column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0)
734
+ };
735
+ }
736
+ return {
737
+ row: deltaStart.row,
738
+ column: deltaStart.column
739
+ };
740
+ }
741
+ this.setPosition = function(row, column, noClip) {
742
+ var pos;
743
+ if (noClip) {
744
+ pos = {
745
+ row: row,
746
+ column: column
747
+ };
748
+ } else {
749
+ pos = this.$clipPositionToDocument(row, column);
750
+ }
751
+
752
+ if (this.row == pos.row && this.column == pos.column)
753
+ return;
754
+
755
+ var old = {
756
+ row: this.row,
757
+ column: this.column
758
+ };
759
+
760
+ this.row = pos.row;
761
+ this.column = pos.column;
762
+ this._signal("change", {
763
+ old: old,
764
+ value: pos
765
+ });
766
+ };
767
+ this.detach = function() {
768
+ this.document.removeEventListener("change", this.$onChange);
769
+ };
770
+ this.attach = function(doc) {
771
+ this.document = doc || this.document;
772
+ this.document.on("change", this.$onChange);
773
+ };
774
+ this.$clipPositionToDocument = function(row, column) {
775
+ var pos = {};
776
+
777
+ if (row >= this.document.getLength()) {
778
+ pos.row = Math.max(0, this.document.getLength() - 1);
779
+ pos.column = this.document.getLine(pos.row).length;
780
+ }
781
+ else if (row < 0) {
782
+ pos.row = 0;
783
+ pos.column = 0;
784
+ }
785
+ else {
786
+ pos.row = row;
787
+ pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
788
+ }
789
+
790
+ if (column < 0)
791
+ pos.column = 0;
792
+
793
+ return pos;
794
+ };
795
+
796
+ }).call(Anchor.prototype);
797
+
798
+ });
799
+
800
+ define("ace/document",[], function(require, exports, module) {
801
+ "use strict";
802
+
803
+ var oop = require("./lib/oop");
804
+ var applyDelta = require("./apply_delta").applyDelta;
805
+ var EventEmitter = require("./lib/event_emitter").EventEmitter;
806
+ var Range = require("./range").Range;
807
+ var Anchor = require("./anchor").Anchor;
808
+
809
+ var Document = function(textOrLines) {
810
+ this.$lines = [""];
811
+ if (textOrLines.length === 0) {
812
+ this.$lines = [""];
813
+ } else if (Array.isArray(textOrLines)) {
814
+ this.insertMergedLines({row: 0, column: 0}, textOrLines);
815
+ } else {
816
+ this.insert({row: 0, column:0}, textOrLines);
817
+ }
818
+ };
819
+
820
+ (function() {
821
+
822
+ oop.implement(this, EventEmitter);
823
+ this.setValue = function(text) {
824
+ var len = this.getLength() - 1;
825
+ this.remove(new Range(0, 0, len, this.getLine(len).length));
826
+ this.insert({row: 0, column: 0}, text);
827
+ };
828
+ this.getValue = function() {
829
+ return this.getAllLines().join(this.getNewLineCharacter());
830
+ };
831
+ this.createAnchor = function(row, column) {
832
+ return new Anchor(this, row, column);
833
+ };
834
+ if ("aaa".split(/a/).length === 0) {
835
+ this.$split = function(text) {
836
+ return text.replace(/\r\n|\r/g, "\n").split("\n");
837
+ };
838
+ } else {
839
+ this.$split = function(text) {
840
+ return text.split(/\r\n|\r|\n/);
841
+ };
842
+ }
843
+
844
+
845
+ this.$detectNewLine = function(text) {
846
+ var match = text.match(/^.*?(\r\n|\r|\n)/m);
847
+ this.$autoNewLine = match ? match[1] : "\n";
848
+ this._signal("changeNewLineMode");
849
+ };
850
+ this.getNewLineCharacter = function() {
851
+ switch (this.$newLineMode) {
852
+ case "windows":
853
+ return "\r\n";
854
+ case "unix":
855
+ return "\n";
856
+ default:
857
+ return this.$autoNewLine || "\n";
858
+ }
859
+ };
860
+
861
+ this.$autoNewLine = "";
862
+ this.$newLineMode = "auto";
863
+ this.setNewLineMode = function(newLineMode) {
864
+ if (this.$newLineMode === newLineMode)
865
+ return;
866
+
867
+ this.$newLineMode = newLineMode;
868
+ this._signal("changeNewLineMode");
869
+ };
870
+ this.getNewLineMode = function() {
871
+ return this.$newLineMode;
872
+ };
873
+ this.isNewLine = function(text) {
874
+ return (text == "\r\n" || text == "\r" || text == "\n");
875
+ };
876
+ this.getLine = function(row) {
877
+ return this.$lines[row] || "";
878
+ };
879
+ this.getLines = function(firstRow, lastRow) {
880
+ return this.$lines.slice(firstRow, lastRow + 1);
881
+ };
882
+ this.getAllLines = function() {
883
+ return this.getLines(0, this.getLength());
884
+ };
885
+ this.getLength = function() {
886
+ return this.$lines.length;
887
+ };
888
+ this.getTextRange = function(range) {
889
+ return this.getLinesForRange(range).join(this.getNewLineCharacter());
890
+ };
891
+ this.getLinesForRange = function(range) {
892
+ var lines;
893
+ if (range.start.row === range.end.row) {
894
+ lines = [this.getLine(range.start.row).substring(range.start.column, range.end.column)];
895
+ } else {
896
+ lines = this.getLines(range.start.row, range.end.row);
897
+ lines[0] = (lines[0] || "").substring(range.start.column);
898
+ var l = lines.length - 1;
899
+ if (range.end.row - range.start.row == l)
900
+ lines[l] = lines[l].substring(0, range.end.column);
901
+ }
902
+ return lines;
903
+ };
904
+ this.insertLines = function(row, lines) {
905
+ console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead.");
906
+ return this.insertFullLines(row, lines);
907
+ };
908
+ this.removeLines = function(firstRow, lastRow) {
909
+ console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead.");
910
+ return this.removeFullLines(firstRow, lastRow);
911
+ };
912
+ this.insertNewLine = function(position) {
913
+ console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead.");
914
+ return this.insertMergedLines(position, ["", ""]);
915
+ };
916
+ this.insert = function(position, text) {
917
+ if (this.getLength() <= 1)
918
+ this.$detectNewLine(text);
919
+
920
+ return this.insertMergedLines(position, this.$split(text));
921
+ };
922
+ this.insertInLine = function(position, text) {
923
+ var start = this.clippedPos(position.row, position.column);
924
+ var end = this.pos(position.row, position.column + text.length);
925
+
926
+ this.applyDelta({
927
+ start: start,
928
+ end: end,
929
+ action: "insert",
930
+ lines: [text]
931
+ }, true);
932
+
933
+ return this.clonePos(end);
934
+ };
935
+
936
+ this.clippedPos = function(row, column) {
937
+ var length = this.getLength();
938
+ if (row === undefined) {
939
+ row = length;
940
+ } else if (row < 0) {
941
+ row = 0;
942
+ } else if (row >= length) {
943
+ row = length - 1;
944
+ column = undefined;
945
+ }
946
+ var line = this.getLine(row);
947
+ if (column == undefined)
948
+ column = line.length;
949
+ column = Math.min(Math.max(column, 0), line.length);
950
+ return {row: row, column: column};
951
+ };
952
+
953
+ this.clonePos = function(pos) {
954
+ return {row: pos.row, column: pos.column};
955
+ };
956
+
957
+ this.pos = function(row, column) {
958
+ return {row: row, column: column};
959
+ };
960
+
961
+ this.$clipPosition = function(position) {
962
+ var length = this.getLength();
963
+ if (position.row >= length) {
964
+ position.row = Math.max(0, length - 1);
965
+ position.column = this.getLine(length - 1).length;
966
+ } else {
967
+ position.row = Math.max(0, position.row);
968
+ position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length);
969
+ }
970
+ return position;
971
+ };
972
+ this.insertFullLines = function(row, lines) {
973
+ row = Math.min(Math.max(row, 0), this.getLength());
974
+ var column = 0;
975
+ if (row < this.getLength()) {
976
+ lines = lines.concat([""]);
977
+ column = 0;
978
+ } else {
979
+ lines = [""].concat(lines);
980
+ row--;
981
+ column = this.$lines[row].length;
982
+ }
983
+ this.insertMergedLines({row: row, column: column}, lines);
984
+ };
985
+ this.insertMergedLines = function(position, lines) {
986
+ var start = this.clippedPos(position.row, position.column);
987
+ var end = {
988
+ row: start.row + lines.length - 1,
989
+ column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length
990
+ };
991
+
992
+ this.applyDelta({
993
+ start: start,
994
+ end: end,
995
+ action: "insert",
996
+ lines: lines
997
+ });
998
+
999
+ return this.clonePos(end);
1000
+ };
1001
+ this.remove = function(range) {
1002
+ var start = this.clippedPos(range.start.row, range.start.column);
1003
+ var end = this.clippedPos(range.end.row, range.end.column);
1004
+ this.applyDelta({
1005
+ start: start,
1006
+ end: end,
1007
+ action: "remove",
1008
+ lines: this.getLinesForRange({start: start, end: end})
1009
+ });
1010
+ return this.clonePos(start);
1011
+ };
1012
+ this.removeInLine = function(row, startColumn, endColumn) {
1013
+ var start = this.clippedPos(row, startColumn);
1014
+ var end = this.clippedPos(row, endColumn);
1015
+
1016
+ this.applyDelta({
1017
+ start: start,
1018
+ end: end,
1019
+ action: "remove",
1020
+ lines: this.getLinesForRange({start: start, end: end})
1021
+ }, true);
1022
+
1023
+ return this.clonePos(start);
1024
+ };
1025
+ this.removeFullLines = function(firstRow, lastRow) {
1026
+ firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1);
1027
+ lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1);
1028
+ var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0;
1029
+ var deleteLastNewLine = lastRow < this.getLength() - 1;
1030
+ var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow );
1031
+ var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 );
1032
+ var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow );
1033
+ var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length );
1034
+ var range = new Range(startRow, startCol, endRow, endCol);
1035
+ var deletedLines = this.$lines.slice(firstRow, lastRow + 1);
1036
+
1037
+ this.applyDelta({
1038
+ start: range.start,
1039
+ end: range.end,
1040
+ action: "remove",
1041
+ lines: this.getLinesForRange(range)
1042
+ });
1043
+ return deletedLines;
1044
+ };
1045
+ this.removeNewLine = function(row) {
1046
+ if (row < this.getLength() - 1 && row >= 0) {
1047
+ this.applyDelta({
1048
+ start: this.pos(row, this.getLine(row).length),
1049
+ end: this.pos(row + 1, 0),
1050
+ action: "remove",
1051
+ lines: ["", ""]
1052
+ });
1053
+ }
1054
+ };
1055
+ this.replace = function(range, text) {
1056
+ if (!(range instanceof Range))
1057
+ range = Range.fromPoints(range.start, range.end);
1058
+ if (text.length === 0 && range.isEmpty())
1059
+ return range.start;
1060
+ if (text == this.getTextRange(range))
1061
+ return range.end;
1062
+
1063
+ this.remove(range);
1064
+ var end;
1065
+ if (text) {
1066
+ end = this.insert(range.start, text);
1067
+ }
1068
+ else {
1069
+ end = range.start;
1070
+ }
1071
+
1072
+ return end;
1073
+ };
1074
+ this.applyDeltas = function(deltas) {
1075
+ for (var i=0; i<deltas.length; i++) {
1076
+ this.applyDelta(deltas[i]);
1077
+ }
1078
+ };
1079
+ this.revertDeltas = function(deltas) {
1080
+ for (var i=deltas.length-1; i>=0; i--) {
1081
+ this.revertDelta(deltas[i]);
1082
+ }
1083
+ };
1084
+ this.applyDelta = function(delta, doNotValidate) {
1085
+ var isInsert = delta.action == "insert";
1086
+ if (isInsert ? delta.lines.length <= 1 && !delta.lines[0]
1087
+ : !Range.comparePoints(delta.start, delta.end)) {
1088
+ return;
1089
+ }
1090
+
1091
+ if (isInsert && delta.lines.length > 20000) {
1092
+ this.$splitAndapplyLargeDelta(delta, 20000);
1093
+ }
1094
+ else {
1095
+ applyDelta(this.$lines, delta, doNotValidate);
1096
+ this._signal("change", delta);
1097
+ }
1098
+ };
1099
+
1100
+ this.$splitAndapplyLargeDelta = function(delta, MAX) {
1101
+ var lines = delta.lines;
1102
+ var l = lines.length - MAX + 1;
1103
+ var row = delta.start.row;
1104
+ var column = delta.start.column;
1105
+ for (var from = 0, to = 0; from < l; from = to) {
1106
+ to += MAX - 1;
1107
+ var chunk = lines.slice(from, to);
1108
+ chunk.push("");
1109
+ this.applyDelta({
1110
+ start: this.pos(row + from, column),
1111
+ end: this.pos(row + to, column = 0),
1112
+ action: delta.action,
1113
+ lines: chunk
1114
+ }, true);
1115
+ }
1116
+ delta.lines = lines.slice(from);
1117
+ delta.start.row = row + from;
1118
+ delta.start.column = column;
1119
+ this.applyDelta(delta, true);
1120
+ };
1121
+ this.revertDelta = function(delta) {
1122
+ this.applyDelta({
1123
+ start: this.clonePos(delta.start),
1124
+ end: this.clonePos(delta.end),
1125
+ action: (delta.action == "insert" ? "remove" : "insert"),
1126
+ lines: delta.lines.slice()
1127
+ });
1128
+ };
1129
+ this.indexToPosition = function(index, startRow) {
1130
+ var lines = this.$lines || this.getAllLines();
1131
+ var newlineLength = this.getNewLineCharacter().length;
1132
+ for (var i = startRow || 0, l = lines.length; i < l; i++) {
1133
+ index -= lines[i].length + newlineLength;
1134
+ if (index < 0)
1135
+ return {row: i, column: index + lines[i].length + newlineLength};
1136
+ }
1137
+ return {row: l-1, column: index + lines[l-1].length + newlineLength};
1138
+ };
1139
+ this.positionToIndex = function(pos, startRow) {
1140
+ var lines = this.$lines || this.getAllLines();
1141
+ var newlineLength = this.getNewLineCharacter().length;
1142
+ var index = 0;
1143
+ var row = Math.min(pos.row, lines.length);
1144
+ for (var i = startRow || 0; i < row; ++i)
1145
+ index += lines[i].length + newlineLength;
1146
+
1147
+ return index + pos.column;
1148
+ };
1149
+
1150
+ }).call(Document.prototype);
1151
+
1152
+ exports.Document = Document;
1153
+ });
1154
+
1155
+ define("ace/lib/lang",[], function(require, exports, module) {
1156
+ "use strict";
1157
+
1158
+ exports.last = function(a) {
1159
+ return a[a.length - 1];
1160
+ };
1161
+
1162
+ exports.stringReverse = function(string) {
1163
+ return string.split("").reverse().join("");
1164
+ };
1165
+
1166
+ exports.stringRepeat = function (string, count) {
1167
+ var result = '';
1168
+ while (count > 0) {
1169
+ if (count & 1)
1170
+ result += string;
1171
+
1172
+ if (count >>= 1)
1173
+ string += string;
1174
+ }
1175
+ return result;
1176
+ };
1177
+
1178
+ var trimBeginRegexp = /^\s\s*/;
1179
+ var trimEndRegexp = /\s\s*$/;
1180
+
1181
+ exports.stringTrimLeft = function (string) {
1182
+ return string.replace(trimBeginRegexp, '');
1183
+ };
1184
+
1185
+ exports.stringTrimRight = function (string) {
1186
+ return string.replace(trimEndRegexp, '');
1187
+ };
1188
+
1189
+ exports.copyObject = function(obj) {
1190
+ var copy = {};
1191
+ for (var key in obj) {
1192
+ copy[key] = obj[key];
1193
+ }
1194
+ return copy;
1195
+ };
1196
+
1197
+ exports.copyArray = function(array){
1198
+ var copy = [];
1199
+ for (var i=0, l=array.length; i<l; i++) {
1200
+ if (array[i] && typeof array[i] == "object")
1201
+ copy[i] = this.copyObject(array[i]);
1202
+ else
1203
+ copy[i] = array[i];
1204
+ }
1205
+ return copy;
1206
+ };
1207
+
1208
+ exports.deepCopy = function deepCopy(obj) {
1209
+ if (typeof obj !== "object" || !obj)
1210
+ return obj;
1211
+ var copy;
1212
+ if (Array.isArray(obj)) {
1213
+ copy = [];
1214
+ for (var key = 0; key < obj.length; key++) {
1215
+ copy[key] = deepCopy(obj[key]);
1216
+ }
1217
+ return copy;
1218
+ }
1219
+ if (Object.prototype.toString.call(obj) !== "[object Object]")
1220
+ return obj;
1221
+
1222
+ copy = {};
1223
+ for (var key in obj)
1224
+ copy[key] = deepCopy(obj[key]);
1225
+ return copy;
1226
+ };
1227
+
1228
+ exports.arrayToMap = function(arr) {
1229
+ var map = {};
1230
+ for (var i=0; i<arr.length; i++) {
1231
+ map[arr[i]] = 1;
1232
+ }
1233
+ return map;
1234
+
1235
+ };
1236
+
1237
+ exports.createMap = function(props) {
1238
+ var map = Object.create(null);
1239
+ for (var i in props) {
1240
+ map[i] = props[i];
1241
+ }
1242
+ return map;
1243
+ };
1244
+ exports.arrayRemove = function(array, value) {
1245
+ for (var i = 0; i <= array.length; i++) {
1246
+ if (value === array[i]) {
1247
+ array.splice(i, 1);
1248
+ }
1249
+ }
1250
+ };
1251
+
1252
+ exports.escapeRegExp = function(str) {
1253
+ return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
1254
+ };
1255
+
1256
+ exports.escapeHTML = function(str) {
1257
+ return ("" + str).replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
1258
+ };
1259
+
1260
+ exports.getMatchOffsets = function(string, regExp) {
1261
+ var matches = [];
1262
+
1263
+ string.replace(regExp, function(str) {
1264
+ matches.push({
1265
+ offset: arguments[arguments.length-2],
1266
+ length: str.length
1267
+ });
1268
+ });
1269
+
1270
+ return matches;
1271
+ };
1272
+ exports.deferredCall = function(fcn) {
1273
+ var timer = null;
1274
+ var callback = function() {
1275
+ timer = null;
1276
+ fcn();
1277
+ };
1278
+
1279
+ var deferred = function(timeout) {
1280
+ deferred.cancel();
1281
+ timer = setTimeout(callback, timeout || 0);
1282
+ return deferred;
1283
+ };
1284
+
1285
+ deferred.schedule = deferred;
1286
+
1287
+ deferred.call = function() {
1288
+ this.cancel();
1289
+ fcn();
1290
+ return deferred;
1291
+ };
1292
+
1293
+ deferred.cancel = function() {
1294
+ clearTimeout(timer);
1295
+ timer = null;
1296
+ return deferred;
1297
+ };
1298
+
1299
+ deferred.isPending = function() {
1300
+ return timer;
1301
+ };
1302
+
1303
+ return deferred;
1304
+ };
1305
+
1306
+
1307
+ exports.delayedCall = function(fcn, defaultTimeout) {
1308
+ var timer = null;
1309
+ var callback = function() {
1310
+ timer = null;
1311
+ fcn();
1312
+ };
1313
+
1314
+ var _self = function(timeout) {
1315
+ if (timer == null)
1316
+ timer = setTimeout(callback, timeout || defaultTimeout);
1317
+ };
1318
+
1319
+ _self.delay = function(timeout) {
1320
+ timer && clearTimeout(timer);
1321
+ timer = setTimeout(callback, timeout || defaultTimeout);
1322
+ };
1323
+ _self.schedule = _self;
1324
+
1325
+ _self.call = function() {
1326
+ this.cancel();
1327
+ fcn();
1328
+ };
1329
+
1330
+ _self.cancel = function() {
1331
+ timer && clearTimeout(timer);
1332
+ timer = null;
1333
+ };
1334
+
1335
+ _self.isPending = function() {
1336
+ return timer;
1337
+ };
1338
+
1339
+ return _self;
1340
+ };
1341
+ });
1342
+
1343
+ define("ace/worker/mirror",[], function(require, exports, module) {
1344
+ "use strict";
1345
+
1346
+ var Range = require("../range").Range;
1347
+ var Document = require("../document").Document;
1348
+ var lang = require("../lib/lang");
1349
+
1350
+ var Mirror = exports.Mirror = function(sender) {
1351
+ this.sender = sender;
1352
+ var doc = this.doc = new Document("");
1353
+
1354
+ var deferredUpdate = this.deferredUpdate = lang.delayedCall(this.onUpdate.bind(this));
1355
+
1356
+ var _self = this;
1357
+ sender.on("change", function(e) {
1358
+ var data = e.data;
1359
+ if (data[0].start) {
1360
+ doc.applyDeltas(data);
1361
+ } else {
1362
+ for (var i = 0; i < data.length; i += 2) {
1363
+ if (Array.isArray(data[i+1])) {
1364
+ var d = {action: "insert", start: data[i], lines: data[i+1]};
1365
+ } else {
1366
+ var d = {action: "remove", start: data[i], end: data[i+1]};
1367
+ }
1368
+ doc.applyDelta(d, true);
1369
+ }
1370
+ }
1371
+ if (_self.$timeout)
1372
+ return deferredUpdate.schedule(_self.$timeout);
1373
+ _self.onUpdate();
1374
+ });
1375
+ };
1376
+
1377
+ (function() {
1378
+
1379
+ this.$timeout = 500;
1380
+
1381
+ this.setTimeout = function(timeout) {
1382
+ this.$timeout = timeout;
1383
+ };
1384
+
1385
+ this.setValue = function(value) {
1386
+ this.doc.setValue(value);
1387
+ this.deferredUpdate.schedule(this.$timeout);
1388
+ };
1389
+
1390
+ this.getValue = function(callbackId) {
1391
+ this.sender.callback(this.doc.getValue(), callbackId);
1392
+ };
1393
+
1394
+ this.onUpdate = function() {
1395
+ };
1396
+
1397
+ this.isPending = function() {
1398
+ return this.deferredUpdate.isPending();
1399
+ };
1400
+
1401
+ }).call(Mirror.prototype);
1402
+
1403
+ });
1404
+
1405
+ define("ace/mode/lua/luaparse",[], function(require, exports, module) {
1406
+
1407
+ (function (root, name, factory) {
1408
+ factory(exports)
1409
+ }(this, 'luaparse', function (exports) {
1410
+ 'use strict';
1411
+
1412
+ exports.version = '0.1.4';
1413
+
1414
+ var input, options, length;
1415
+ var defaultOptions = exports.defaultOptions = {
1416
+ wait: false
1417
+ , comments: true
1418
+ , scope: false
1419
+ , locations: false
1420
+ , ranges: false
1421
+ };
1422
+ var EOF = 1, StringLiteral = 2, Keyword = 4, Identifier = 8
1423
+ , NumericLiteral = 16, Punctuator = 32, BooleanLiteral = 64
1424
+ , NilLiteral = 128, VarargLiteral = 256;
1425
+
1426
+ exports.tokenTypes = { EOF: EOF, StringLiteral: StringLiteral
1427
+ , Keyword: Keyword, Identifier: Identifier, NumericLiteral: NumericLiteral
1428
+ , Punctuator: Punctuator, BooleanLiteral: BooleanLiteral
1429
+ , NilLiteral: NilLiteral, VarargLiteral: VarargLiteral
1430
+ };
1431
+ var errors = exports.errors = {
1432
+ unexpected: 'Unexpected %1 \'%2\' near \'%3\''
1433
+ , expected: '\'%1\' expected near \'%2\''
1434
+ , expectedToken: '%1 expected near \'%2\''
1435
+ , unfinishedString: 'unfinished string near \'%1\''
1436
+ , malformedNumber: 'malformed number near \'%1\''
1437
+ };
1438
+ //
1439
+ var ast = exports.ast = {
1440
+ labelStatement: function(label) {
1441
+ return {
1442
+ type: 'LabelStatement'
1443
+ , label: label
1444
+ };
1445
+ }
1446
+
1447
+ , breakStatement: function() {
1448
+ return {
1449
+ type: 'BreakStatement'
1450
+ };
1451
+ }
1452
+
1453
+ , gotoStatement: function(label) {
1454
+ return {
1455
+ type: 'GotoStatement'
1456
+ , label: label
1457
+ };
1458
+ }
1459
+
1460
+ , returnStatement: function(args) {
1461
+ return {
1462
+ type: 'ReturnStatement'
1463
+ , 'arguments': args
1464
+ };
1465
+ }
1466
+
1467
+ , ifStatement: function(clauses) {
1468
+ return {
1469
+ type: 'IfStatement'
1470
+ , clauses: clauses
1471
+ };
1472
+ }
1473
+ , ifClause: function(condition, body) {
1474
+ return {
1475
+ type: 'IfClause'
1476
+ , condition: condition
1477
+ , body: body
1478
+ };
1479
+ }
1480
+ , elseifClause: function(condition, body) {
1481
+ return {
1482
+ type: 'ElseifClause'
1483
+ , condition: condition
1484
+ , body: body
1485
+ };
1486
+ }
1487
+ , elseClause: function(body) {
1488
+ return {
1489
+ type: 'ElseClause'
1490
+ , body: body
1491
+ };
1492
+ }
1493
+
1494
+ , whileStatement: function(condition, body) {
1495
+ return {
1496
+ type: 'WhileStatement'
1497
+ , condition: condition
1498
+ , body: body
1499
+ };
1500
+ }
1501
+
1502
+ , doStatement: function(body) {
1503
+ return {
1504
+ type: 'DoStatement'
1505
+ , body: body
1506
+ };
1507
+ }
1508
+
1509
+ , repeatStatement: function(condition, body) {
1510
+ return {
1511
+ type: 'RepeatStatement'
1512
+ , condition: condition
1513
+ , body: body
1514
+ };
1515
+ }
1516
+
1517
+ , localStatement: function(variables, init) {
1518
+ return {
1519
+ type: 'LocalStatement'
1520
+ , variables: variables
1521
+ , init: init
1522
+ };
1523
+ }
1524
+
1525
+ , assignmentStatement: function(variables, init) {
1526
+ return {
1527
+ type: 'AssignmentStatement'
1528
+ , variables: variables
1529
+ , init: init
1530
+ };
1531
+ }
1532
+
1533
+ , callStatement: function(expression) {
1534
+ return {
1535
+ type: 'CallStatement'
1536
+ , expression: expression
1537
+ };
1538
+ }
1539
+
1540
+ , functionStatement: function(identifier, parameters, isLocal, body) {
1541
+ return {
1542
+ type: 'FunctionDeclaration'
1543
+ , identifier: identifier
1544
+ , isLocal: isLocal
1545
+ , parameters: parameters
1546
+ , body: body
1547
+ };
1548
+ }
1549
+
1550
+ , forNumericStatement: function(variable, start, end, step, body) {
1551
+ return {
1552
+ type: 'ForNumericStatement'
1553
+ , variable: variable
1554
+ , start: start
1555
+ , end: end
1556
+ , step: step
1557
+ , body: body
1558
+ };
1559
+ }
1560
+
1561
+ , forGenericStatement: function(variables, iterators, body) {
1562
+ return {
1563
+ type: 'ForGenericStatement'
1564
+ , variables: variables
1565
+ , iterators: iterators
1566
+ , body: body
1567
+ };
1568
+ }
1569
+
1570
+ , chunk: function(body) {
1571
+ return {
1572
+ type: 'Chunk'
1573
+ , body: body
1574
+ };
1575
+ }
1576
+
1577
+ , identifier: function(name) {
1578
+ return {
1579
+ type: 'Identifier'
1580
+ , name: name
1581
+ };
1582
+ }
1583
+
1584
+ , literal: function(type, value, raw) {
1585
+ type = (type === StringLiteral) ? 'StringLiteral'
1586
+ : (type === NumericLiteral) ? 'NumericLiteral'
1587
+ : (type === BooleanLiteral) ? 'BooleanLiteral'
1588
+ : (type === NilLiteral) ? 'NilLiteral'
1589
+ : 'VarargLiteral';
1590
+
1591
+ return {
1592
+ type: type
1593
+ , value: value
1594
+ , raw: raw
1595
+ };
1596
+ }
1597
+
1598
+ , tableKey: function(key, value) {
1599
+ return {
1600
+ type: 'TableKey'
1601
+ , key: key
1602
+ , value: value
1603
+ };
1604
+ }
1605
+ , tableKeyString: function(key, value) {
1606
+ return {
1607
+ type: 'TableKeyString'
1608
+ , key: key
1609
+ , value: value
1610
+ };
1611
+ }
1612
+ , tableValue: function(value) {
1613
+ return {
1614
+ type: 'TableValue'
1615
+ , value: value
1616
+ };
1617
+ }
1618
+
1619
+
1620
+ , tableConstructorExpression: function(fields) {
1621
+ return {
1622
+ type: 'TableConstructorExpression'
1623
+ , fields: fields
1624
+ };
1625
+ }
1626
+ , binaryExpression: function(operator, left, right) {
1627
+ var type = ('and' === operator || 'or' === operator) ?
1628
+ 'LogicalExpression' :
1629
+ 'BinaryExpression';
1630
+
1631
+ return {
1632
+ type: type
1633
+ , operator: operator
1634
+ , left: left
1635
+ , right: right
1636
+ };
1637
+ }
1638
+ , unaryExpression: function(operator, argument) {
1639
+ return {
1640
+ type: 'UnaryExpression'
1641
+ , operator: operator
1642
+ , argument: argument
1643
+ };
1644
+ }
1645
+ , memberExpression: function(base, indexer, identifier) {
1646
+ return {
1647
+ type: 'MemberExpression'
1648
+ , indexer: indexer
1649
+ , identifier: identifier
1650
+ , base: base
1651
+ };
1652
+ }
1653
+
1654
+ , indexExpression: function(base, index) {
1655
+ return {
1656
+ type: 'IndexExpression'
1657
+ , base: base
1658
+ , index: index
1659
+ };
1660
+ }
1661
+
1662
+ , callExpression: function(base, args) {
1663
+ return {
1664
+ type: 'CallExpression'
1665
+ , base: base
1666
+ , 'arguments': args
1667
+ };
1668
+ }
1669
+
1670
+ , tableCallExpression: function(base, args) {
1671
+ return {
1672
+ type: 'TableCallExpression'
1673
+ , base: base
1674
+ , 'arguments': args
1675
+ };
1676
+ }
1677
+
1678
+ , stringCallExpression: function(base, argument) {
1679
+ return {
1680
+ type: 'StringCallExpression'
1681
+ , base: base
1682
+ , argument: argument
1683
+ };
1684
+ }
1685
+
1686
+ , comment: function(value, raw) {
1687
+ return {
1688
+ type: 'Comment'
1689
+ , value: value
1690
+ , raw: raw
1691
+ };
1692
+ }
1693
+ };
1694
+ function finishNode(node) {
1695
+ if (trackLocations) {
1696
+ var location = locations.pop();
1697
+ location.complete();
1698
+ if (options.locations) node.loc = location.loc;
1699
+ if (options.ranges) node.range = location.range;
1700
+ }
1701
+ return node;
1702
+ }
1703
+ var slice = Array.prototype.slice
1704
+ , toString = Object.prototype.toString
1705
+ , indexOf = function indexOf(array, element) {
1706
+ for (var i = 0, length = array.length; i < length; i++) {
1707
+ if (array[i] === element) return i;
1708
+ }
1709
+ return -1;
1710
+ };
1711
+ function indexOfObject(array, property, element) {
1712
+ for (var i = 0, length = array.length; i < length; i++) {
1713
+ if (array[i][property] === element) return i;
1714
+ }
1715
+ return -1;
1716
+ }
1717
+ //
1718
+ //
1719
+ function sprintf(format) {
1720
+ var args = slice.call(arguments, 1);
1721
+ format = format.replace(/%(\d)/g, function (match, index) {
1722
+ return '' + args[index - 1] || '';
1723
+ });
1724
+ return format;
1725
+ }
1726
+ //
1727
+ //
1728
+ function extend() {
1729
+ var args = slice.call(arguments)
1730
+ , dest = {}
1731
+ , src, prop;
1732
+
1733
+ for (var i = 0, length = args.length; i < length; i++) {
1734
+ src = args[i];
1735
+ for (prop in src) if (src.hasOwnProperty(prop)) {
1736
+ dest[prop] = src[prop];
1737
+ }
1738
+ }
1739
+ return dest;
1740
+ }
1741
+ //
1742
+ //
1743
+ //
1744
+ //
1745
+ function raise(token) {
1746
+ var message = sprintf.apply(null, slice.call(arguments, 1))
1747
+ , error, col;
1748
+
1749
+ if ('undefined' !== typeof token.line) {
1750
+ col = token.range[0] - token.lineStart;
1751
+ error = new SyntaxError(sprintf('[%1:%2] %3', token.line, col, message));
1752
+ error.line = token.line;
1753
+ error.index = token.range[0];
1754
+ error.column = col;
1755
+ } else {
1756
+ col = index - lineStart + 1;
1757
+ error = new SyntaxError(sprintf('[%1:%2] %3', line, col, message));
1758
+ error.index = index;
1759
+ error.line = line;
1760
+ error.column = col;
1761
+ }
1762
+ throw error;
1763
+ }
1764
+ //
1765
+ //
1766
+ function raiseUnexpectedToken(type, token) {
1767
+ raise(token, errors.expectedToken, type, token.value);
1768
+ }
1769
+ //
1770
+ //
1771
+ //
1772
+ //
1773
+ function unexpected(found, near) {
1774
+ if ('undefined' === typeof near) near = lookahead.value;
1775
+ if ('undefined' !== typeof found.type) {
1776
+ var type;
1777
+ switch (found.type) {
1778
+ case StringLiteral: type = 'string'; break;
1779
+ case Keyword: type = 'keyword'; break;
1780
+ case Identifier: type = 'identifier'; break;
1781
+ case NumericLiteral: type = 'number'; break;
1782
+ case Punctuator: type = 'symbol'; break;
1783
+ case BooleanLiteral: type = 'boolean'; break;
1784
+ case NilLiteral:
1785
+ return raise(found, errors.unexpected, 'symbol', 'nil', near);
1786
+ }
1787
+ return raise(found, errors.unexpected, type, found.value, near);
1788
+ }
1789
+ return raise(found, errors.unexpected, 'symbol', found, near);
1790
+ }
1791
+ //
1792
+ //
1793
+ //
1794
+ //
1795
+ var index
1796
+ , token
1797
+ , previousToken
1798
+ , lookahead
1799
+ , comments
1800
+ , tokenStart
1801
+ , line
1802
+ , lineStart;
1803
+
1804
+ exports.lex = lex;
1805
+
1806
+ function lex() {
1807
+ skipWhiteSpace();
1808
+ while (45 === input.charCodeAt(index) &&
1809
+ 45 === input.charCodeAt(index + 1)) {
1810
+ scanComment();
1811
+ skipWhiteSpace();
1812
+ }
1813
+ if (index >= length) return {
1814
+ type : EOF
1815
+ , value: '<eof>'
1816
+ , line: line
1817
+ , lineStart: lineStart
1818
+ , range: [index, index]
1819
+ };
1820
+
1821
+ var charCode = input.charCodeAt(index)
1822
+ , next = input.charCodeAt(index + 1);
1823
+ tokenStart = index;
1824
+ if (isIdentifierStart(charCode)) return scanIdentifierOrKeyword();
1825
+
1826
+ switch (charCode) {
1827
+ case 39: case 34: // '"
1828
+ return scanStringLiteral();
1829
+ case 48: case 49: case 50: case 51: case 52: case 53:
1830
+ case 54: case 55: case 56: case 57:
1831
+ return scanNumericLiteral();
1832
+
1833
+ case 46: // .
1834
+ if (isDecDigit(next)) return scanNumericLiteral();
1835
+ if (46 === next) {
1836
+ if (46 === input.charCodeAt(index + 2)) return scanVarargLiteral();
1837
+ return scanPunctuator('..');
1838
+ }
1839
+ return scanPunctuator('.');
1840
+
1841
+ case 61: // =
1842
+ if (61 === next) return scanPunctuator('==');
1843
+ return scanPunctuator('=');
1844
+
1845
+ case 62: // >
1846
+ if (61 === next) return scanPunctuator('>=');
1847
+ return scanPunctuator('>');
1848
+
1849
+ case 60: // <
1850
+ if (61 === next) return scanPunctuator('<=');
1851
+ return scanPunctuator('<');
1852
+
1853
+ case 126: // ~
1854
+ if (61 === next) return scanPunctuator('~=');
1855
+ return scanPunctuator('~');
1856
+
1857
+ case 58: // :
1858
+ if (58 === next) return scanPunctuator('::');
1859
+ return scanPunctuator(':');
1860
+
1861
+ case 91: // [
1862
+ if (91 === next || 61 === next) return scanLongStringLiteral();
1863
+ return scanPunctuator('[');
1864
+ case 42: case 47: case 94: case 37: case 44: case 123: case 125:
1865
+ case 93: case 40: case 41: case 59: case 35: case 45: case 43: case 38: case 124:
1866
+ return scanPunctuator(input.charAt(index));
1867
+ }
1868
+
1869
+ return unexpected(input.charAt(index));
1870
+ }
1871
+ function skipWhiteSpace() {
1872
+ while (index < length) {
1873
+ var charCode = input.charCodeAt(index);
1874
+ if (isWhiteSpace(charCode)) {
1875
+ index++;
1876
+ } else if (isLineTerminator(charCode)) {
1877
+ line++;
1878
+ lineStart = ++index;
1879
+ } else {
1880
+ break;
1881
+ }
1882
+ }
1883
+ }
1884
+ function scanIdentifierOrKeyword() {
1885
+ var value, type;
1886
+ while (isIdentifierPart(input.charCodeAt(++index)));
1887
+ value = input.slice(tokenStart, index);
1888
+ if (isKeyword(value)) {
1889
+ type = Keyword;
1890
+ } else if ('true' === value || 'false' === value) {
1891
+ type = BooleanLiteral;
1892
+ value = ('true' === value);
1893
+ } else if ('nil' === value) {
1894
+ type = NilLiteral;
1895
+ value = null;
1896
+ } else {
1897
+ type = Identifier;
1898
+ }
1899
+
1900
+ return {
1901
+ type: type
1902
+ , value: value
1903
+ , line: line
1904
+ , lineStart: lineStart
1905
+ , range: [tokenStart, index]
1906
+ };
1907
+ }
1908
+ function scanPunctuator(value) {
1909
+ index += value.length;
1910
+ return {
1911
+ type: Punctuator
1912
+ , value: value
1913
+ , line: line
1914
+ , lineStart: lineStart
1915
+ , range: [tokenStart, index]
1916
+ };
1917
+ }
1918
+ function scanVarargLiteral() {
1919
+ index += 3;
1920
+ return {
1921
+ type: VarargLiteral
1922
+ , value: '...'
1923
+ , line: line
1924
+ , lineStart: lineStart
1925
+ , range: [tokenStart, index]
1926
+ };
1927
+ }
1928
+ function scanStringLiteral() {
1929
+ var delimiter = input.charCodeAt(index++)
1930
+ , stringStart = index
1931
+ , string = ''
1932
+ , charCode;
1933
+
1934
+ while (index < length) {
1935
+ charCode = input.charCodeAt(index++);
1936
+ if (delimiter === charCode) break;
1937
+ if (92 === charCode) { // \
1938
+ string += input.slice(stringStart, index - 1) + readEscapeSequence();
1939
+ stringStart = index;
1940
+ }
1941
+ else if (index >= length || isLineTerminator(charCode)) {
1942
+ string += input.slice(stringStart, index - 1);
1943
+ raise({}, errors.unfinishedString, string + String.fromCharCode(charCode));
1944
+ }
1945
+ }
1946
+ string += input.slice(stringStart, index - 1);
1947
+
1948
+ return {
1949
+ type: StringLiteral
1950
+ , value: string
1951
+ , line: line
1952
+ , lineStart: lineStart
1953
+ , range: [tokenStart, index]
1954
+ };
1955
+ }
1956
+ function scanLongStringLiteral() {
1957
+ var string = readLongString();
1958
+ if (false === string) raise(token, errors.expected, '[', token.value);
1959
+
1960
+ return {
1961
+ type: StringLiteral
1962
+ , value: string
1963
+ , line: line
1964
+ , lineStart: lineStart
1965
+ , range: [tokenStart, index]
1966
+ };
1967
+ }
1968
+ //
1969
+ function scanNumericLiteral() {
1970
+ var character = input.charAt(index)
1971
+ , next = input.charAt(index + 1);
1972
+
1973
+ var value = ('0' === character && 'xX'.indexOf(next || null) >= 0) ?
1974
+ readHexLiteral() : readDecLiteral();
1975
+
1976
+ return {
1977
+ type: NumericLiteral
1978
+ , value: value
1979
+ , line: line
1980
+ , lineStart: lineStart
1981
+ , range: [tokenStart, index]
1982
+ };
1983
+ }
1984
+ //
1985
+ function readHexLiteral() {
1986
+ var fraction = 0 // defaults to 0 as it gets summed
1987
+ , binaryExponent = 1 // defaults to 1 as it gets multiplied
1988
+ , binarySign = 1 // positive
1989
+ , digit, fractionStart, exponentStart, digitStart;
1990
+
1991
+ digitStart = index += 2; // Skip 0x part
1992
+ if (!isHexDigit(input.charCodeAt(index)))
1993
+ raise({}, errors.malformedNumber, input.slice(tokenStart, index));
1994
+
1995
+ while (isHexDigit(input.charCodeAt(index))) index++;
1996
+ digit = parseInt(input.slice(digitStart, index), 16);
1997
+ if ('.' === input.charAt(index)) {
1998
+ fractionStart = ++index;
1999
+
2000
+ while (isHexDigit(input.charCodeAt(index))) index++;
2001
+ fraction = input.slice(fractionStart, index);
2002
+ fraction = (fractionStart === index) ? 0
2003
+ : parseInt(fraction, 16) / Math.pow(16, index - fractionStart);
2004
+ }
2005
+ if ('pP'.indexOf(input.charAt(index) || null) >= 0) {
2006
+ index++;
2007
+ if ('+-'.indexOf(input.charAt(index) || null) >= 0)
2008
+ binarySign = ('+' === input.charAt(index++)) ? 1 : -1;
2009
+
2010
+ exponentStart = index;
2011
+ if (!isDecDigit(input.charCodeAt(index)))
2012
+ raise({}, errors.malformedNumber, input.slice(tokenStart, index));
2013
+
2014
+ while (isDecDigit(input.charCodeAt(index))) index++;
2015
+ binaryExponent = input.slice(exponentStart, index);
2016
+ binaryExponent = Math.pow(2, binaryExponent * binarySign);
2017
+ }
2018
+
2019
+ return (digit + fraction) * binaryExponent;
2020
+ }
2021
+ function readDecLiteral() {
2022
+ while (isDecDigit(input.charCodeAt(index))) index++;
2023
+ if ('.' === input.charAt(index)) {
2024
+ index++;
2025
+ while (isDecDigit(input.charCodeAt(index))) index++;
2026
+ }
2027
+ if ('eE'.indexOf(input.charAt(index) || null) >= 0) {
2028
+ index++;
2029
+ if ('+-'.indexOf(input.charAt(index) || null) >= 0) index++;
2030
+ if (!isDecDigit(input.charCodeAt(index)))
2031
+ raise({}, errors.malformedNumber, input.slice(tokenStart, index));
2032
+
2033
+ while (isDecDigit(input.charCodeAt(index))) index++;
2034
+ }
2035
+
2036
+ return parseFloat(input.slice(tokenStart, index));
2037
+ }
2038
+ function readEscapeSequence() {
2039
+ var sequenceStart = index;
2040
+ switch (input.charAt(index)) {
2041
+ case 'n': index++; return '\n';
2042
+ case 'r': index++; return '\r';
2043
+ case 't': index++; return '\t';
2044
+ case 'v': index++; return '\x0B';
2045
+ case 'b': index++; return '\b';
2046
+ case 'f': index++; return '\f';
2047
+ case 'z': index++; skipWhiteSpace(); return '';
2048
+ case 'x':
2049
+ if (isHexDigit(input.charCodeAt(index + 1)) &&
2050
+ isHexDigit(input.charCodeAt(index + 2))) {
2051
+ index += 3;
2052
+ return '\\' + input.slice(sequenceStart, index);
2053
+ }
2054
+ return '\\' + input.charAt(index++);
2055
+ default:
2056
+ if (isDecDigit(input.charCodeAt(index))) {
2057
+ while (isDecDigit(input.charCodeAt(++index)));
2058
+ return '\\' + input.slice(sequenceStart, index);
2059
+ }
2060
+ return input.charAt(index++);
2061
+ }
2062
+ }
2063
+ //
2064
+ function scanComment() {
2065
+ tokenStart = index;
2066
+ index += 2; // --
2067
+
2068
+ var character = input.charAt(index)
2069
+ , content = ''
2070
+ , isLong = false
2071
+ , commentStart = index
2072
+ , lineStartComment = lineStart
2073
+ , lineComment = line;
2074
+
2075
+ if ('[' === character) {
2076
+ content = readLongString();
2077
+ if (false === content) content = character;
2078
+ else isLong = true;
2079
+ }
2080
+ if (!isLong) {
2081
+ while (index < length) {
2082
+ if (isLineTerminator(input.charCodeAt(index))) break;
2083
+ index++;
2084
+ }
2085
+ if (options.comments) content = input.slice(commentStart, index);
2086
+ }
2087
+
2088
+ if (options.comments) {
2089
+ var node = ast.comment(content, input.slice(tokenStart, index));
2090
+ if (options.locations) {
2091
+ node.loc = {
2092
+ start: { line: lineComment, column: tokenStart - lineStartComment }
2093
+ , end: { line: line, column: index - lineStart }
2094
+ };
2095
+ }
2096
+ if (options.ranges) {
2097
+ node.range = [tokenStart, index];
2098
+ }
2099
+ comments.push(node);
2100
+ }
2101
+ }
2102
+ function readLongString() {
2103
+ var level = 0
2104
+ , content = ''
2105
+ , terminator = false
2106
+ , character, stringStart;
2107
+
2108
+ index++; // [
2109
+ while ('=' === input.charAt(index + level)) level++;
2110
+ if ('[' !== input.charAt(index + level)) return false;
2111
+
2112
+ index += level + 1;
2113
+ if (isLineTerminator(input.charCodeAt(index))) {
2114
+ line++;
2115
+ lineStart = index++;
2116
+ }
2117
+
2118
+ stringStart = index;
2119
+ while (index < length) {
2120
+ character = input.charAt(index++);
2121
+ if (isLineTerminator(character.charCodeAt(0))) {
2122
+ line++;
2123
+ lineStart = index;
2124
+ }
2125
+ if (']' === character) {
2126
+ terminator = true;
2127
+ for (var i = 0; i < level; i++) {
2128
+ if ('=' !== input.charAt(index + i)) terminator = false;
2129
+ }
2130
+ if (']' !== input.charAt(index + level)) terminator = false;
2131
+ }
2132
+ if (terminator) break;
2133
+ }
2134
+ content += input.slice(stringStart, index - 1);
2135
+ index += level + 1;
2136
+
2137
+ return content;
2138
+ }
2139
+ //
2140
+ function next() {
2141
+ previousToken = token;
2142
+ token = lookahead;
2143
+ lookahead = lex();
2144
+ }
2145
+ function consume(value) {
2146
+ if (value === token.value) {
2147
+ next();
2148
+ return true;
2149
+ }
2150
+ return false;
2151
+ }
2152
+ function expect(value) {
2153
+ if (value === token.value) next();
2154
+ else raise(token, errors.expected, value, token.value);
2155
+ }
2156
+ function isWhiteSpace(charCode) {
2157
+ return 9 === charCode || 32 === charCode || 0xB === charCode || 0xC === charCode;
2158
+ }
2159
+
2160
+ function isLineTerminator(charCode) {
2161
+ return 10 === charCode || 13 === charCode;
2162
+ }
2163
+
2164
+ function isDecDigit(charCode) {
2165
+ return charCode >= 48 && charCode <= 57;
2166
+ }
2167
+
2168
+ function isHexDigit(charCode) {
2169
+ return (charCode >= 48 && charCode <= 57) || (charCode >= 97 && charCode <= 102) || (charCode >= 65 && charCode <= 70);
2170
+ }
2171
+ function isIdentifierStart(charCode) {
2172
+ return (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode;
2173
+ }
2174
+
2175
+ function isIdentifierPart(charCode) {
2176
+ return (charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode || (charCode >= 48 && charCode <= 57);
2177
+ }
2178
+ //
2179
+ function isKeyword(id) {
2180
+ switch (id.length) {
2181
+ case 2:
2182
+ return 'do' === id || 'if' === id || 'in' === id || 'or' === id;
2183
+ case 3:
2184
+ return 'and' === id || 'end' === id || 'for' === id || 'not' === id;
2185
+ case 4:
2186
+ return 'else' === id || 'goto' === id || 'then' === id;
2187
+ case 5:
2188
+ return 'break' === id || 'local' === id || 'until' === id || 'while' === id;
2189
+ case 6:
2190
+ return 'elseif' === id || 'repeat' === id || 'return' === id;
2191
+ case 8:
2192
+ return 'function' === id;
2193
+ }
2194
+ return false;
2195
+ }
2196
+
2197
+ function isUnary(token) {
2198
+ if (Punctuator === token.type) return '#-~'.indexOf(token.value) >= 0;
2199
+ if (Keyword === token.type) return 'not' === token.value;
2200
+ return false;
2201
+ }
2202
+ function isCallExpression(expression) {
2203
+ switch (expression.type) {
2204
+ case 'CallExpression':
2205
+ case 'TableCallExpression':
2206
+ case 'StringCallExpression':
2207
+ return true;
2208
+ }
2209
+ return false;
2210
+ }
2211
+ function isBlockFollow(token) {
2212
+ if (EOF === token.type) return true;
2213
+ if (Keyword !== token.type) return false;
2214
+ switch (token.value) {
2215
+ case 'else': case 'elseif':
2216
+ case 'end': case 'until':
2217
+ return true;
2218
+ default:
2219
+ return false;
2220
+ }
2221
+ }
2222
+ var scopes
2223
+ , scopeDepth
2224
+ , globals;
2225
+ function createScope() {
2226
+ scopes.push(Array.apply(null, scopes[scopeDepth++]));
2227
+ }
2228
+ function exitScope() {
2229
+ scopes.pop();
2230
+ scopeDepth--;
2231
+ }
2232
+ function scopeIdentifierName(name) {
2233
+ if (-1 !== indexOf(scopes[scopeDepth], name)) return;
2234
+ scopes[scopeDepth].push(name);
2235
+ }
2236
+ function scopeIdentifier(node) {
2237
+ scopeIdentifierName(node.name);
2238
+ attachScope(node, true);
2239
+ }
2240
+ function attachScope(node, isLocal) {
2241
+ if (!isLocal && -1 === indexOfObject(globals, 'name', node.name))
2242
+ globals.push(node);
2243
+
2244
+ node.isLocal = isLocal;
2245
+ }
2246
+ function scopeHasName(name) {
2247
+ return (-1 !== indexOf(scopes[scopeDepth], name));
2248
+ }
2249
+ //
2250
+ var locations = []
2251
+ , trackLocations;
2252
+
2253
+ function createLocationMarker() {
2254
+ return new Marker(token);
2255
+ }
2256
+
2257
+ function Marker(token) {
2258
+ if (options.locations) {
2259
+ this.loc = {
2260
+ start: {
2261
+ line: token.line
2262
+ , column: token.range[0] - token.lineStart
2263
+ }
2264
+ , end: {
2265
+ line: 0
2266
+ , column: 0
2267
+ }
2268
+ };
2269
+ }
2270
+ if (options.ranges) this.range = [token.range[0], 0];
2271
+ }
2272
+ Marker.prototype.complete = function() {
2273
+ if (options.locations) {
2274
+ this.loc.end.line = previousToken.line;
2275
+ this.loc.end.column = previousToken.range[1] - previousToken.lineStart;
2276
+ }
2277
+ if (options.ranges) {
2278
+ this.range[1] = previousToken.range[1];
2279
+ }
2280
+ };
2281
+ function markLocation() {
2282
+ if (trackLocations) locations.push(createLocationMarker());
2283
+ }
2284
+ function pushLocation(marker) {
2285
+ if (trackLocations) locations.push(marker);
2286
+ }
2287
+ //
2288
+ function parseChunk() {
2289
+ next();
2290
+ markLocation();
2291
+ var body = parseBlock();
2292
+ if (EOF !== token.type) unexpected(token);
2293
+ if (trackLocations && !body.length) previousToken = token;
2294
+ return finishNode(ast.chunk(body));
2295
+ }
2296
+ //
2297
+ function parseBlock(terminator) {
2298
+ var block = []
2299
+ , statement;
2300
+ if (options.scope) createScope();
2301
+
2302
+ while (!isBlockFollow(token)) {
2303
+ if ('return' === token.value) {
2304
+ block.push(parseStatement());
2305
+ break;
2306
+ }
2307
+ statement = parseStatement();
2308
+ if (statement) block.push(statement);
2309
+ }
2310
+
2311
+ if (options.scope) exitScope();
2312
+ return block;
2313
+ }
2314
+ //
2315
+ function parseStatement() {
2316
+ markLocation();
2317
+ if (Keyword === token.type) {
2318
+ switch (token.value) {
2319
+ case 'local': next(); return parseLocalStatement();
2320
+ case 'if': next(); return parseIfStatement();
2321
+ case 'return': next(); return parseReturnStatement();
2322
+ case 'function': next();
2323
+ var name = parseFunctionName();
2324
+ return parseFunctionDeclaration(name);
2325
+ case 'while': next(); return parseWhileStatement();
2326
+ case 'for': next(); return parseForStatement();
2327
+ case 'repeat': next(); return parseRepeatStatement();
2328
+ case 'break': next(); return parseBreakStatement();
2329
+ case 'do': next(); return parseDoStatement();
2330
+ case 'goto': next(); return parseGotoStatement();
2331
+ }
2332
+ }
2333
+
2334
+ if (Punctuator === token.type) {
2335
+ if (consume('::')) return parseLabelStatement();
2336
+ }
2337
+ if (trackLocations) locations.pop();
2338
+ if (consume(';')) return;
2339
+
2340
+ return parseAssignmentOrCallStatement();
2341
+ }
2342
+ function parseLabelStatement() {
2343
+ var name = token.value
2344
+ , label = parseIdentifier();
2345
+
2346
+ if (options.scope) {
2347
+ scopeIdentifierName('::' + name + '::');
2348
+ attachScope(label, true);
2349
+ }
2350
+
2351
+ expect('::');
2352
+ return finishNode(ast.labelStatement(label));
2353
+ }
2354
+ function parseBreakStatement() {
2355
+ return finishNode(ast.breakStatement());
2356
+ }
2357
+ function parseGotoStatement() {
2358
+ var name = token.value
2359
+ , label = parseIdentifier();
2360
+
2361
+ if (options.scope) label.isLabel = scopeHasName('::' + name + '::');
2362
+ return finishNode(ast.gotoStatement(label));
2363
+ }
2364
+ function parseDoStatement() {
2365
+ var body = parseBlock();
2366
+ expect('end');
2367
+ return finishNode(ast.doStatement(body));
2368
+ }
2369
+ function parseWhileStatement() {
2370
+ var condition = parseExpectedExpression();
2371
+ expect('do');
2372
+ var body = parseBlock();
2373
+ expect('end');
2374
+ return finishNode(ast.whileStatement(condition, body));
2375
+ }
2376
+ function parseRepeatStatement() {
2377
+ var body = parseBlock();
2378
+ expect('until');
2379
+ var condition = parseExpectedExpression();
2380
+ return finishNode(ast.repeatStatement(condition, body));
2381
+ }
2382
+ function parseReturnStatement() {
2383
+ var expressions = [];
2384
+
2385
+ if ('end' !== token.value) {
2386
+ var expression = parseExpression();
2387
+ if (null != expression) expressions.push(expression);
2388
+ while (consume(',')) {
2389
+ expression = parseExpectedExpression();
2390
+ expressions.push(expression);
2391
+ }
2392
+ consume(';'); // grammar tells us ; is optional here.
2393
+ }
2394
+ return finishNode(ast.returnStatement(expressions));
2395
+ }
2396
+ function parseIfStatement() {
2397
+ var clauses = []
2398
+ , condition
2399
+ , body
2400
+ , marker;
2401
+ if (trackLocations) {
2402
+ marker = locations[locations.length - 1];
2403
+ locations.push(marker);
2404
+ }
2405
+ condition = parseExpectedExpression();
2406
+ expect('then');
2407
+ body = parseBlock();
2408
+ clauses.push(finishNode(ast.ifClause(condition, body)));
2409
+
2410
+ if (trackLocations) marker = createLocationMarker();
2411
+ while (consume('elseif')) {
2412
+ pushLocation(marker);
2413
+ condition = parseExpectedExpression();
2414
+ expect('then');
2415
+ body = parseBlock();
2416
+ clauses.push(finishNode(ast.elseifClause(condition, body)));
2417
+ if (trackLocations) marker = createLocationMarker();
2418
+ }
2419
+
2420
+ if (consume('else')) {
2421
+ if (trackLocations) {
2422
+ marker = new Marker(previousToken);
2423
+ locations.push(marker);
2424
+ }
2425
+ body = parseBlock();
2426
+ clauses.push(finishNode(ast.elseClause(body)));
2427
+ }
2428
+
2429
+ expect('end');
2430
+ return finishNode(ast.ifStatement(clauses));
2431
+ }
2432
+ //
2433
+ function parseForStatement() {
2434
+ var variable = parseIdentifier()
2435
+ , body;
2436
+ if (options.scope) scopeIdentifier(variable);
2437
+ if (consume('=')) {
2438
+ var start = parseExpectedExpression();
2439
+ expect(',');
2440
+ var end = parseExpectedExpression();
2441
+ var step = consume(',') ? parseExpectedExpression() : null;
2442
+
2443
+ expect('do');
2444
+ body = parseBlock();
2445
+ expect('end');
2446
+
2447
+ return finishNode(ast.forNumericStatement(variable, start, end, step, body));
2448
+ }
2449
+ else {
2450
+ var variables = [variable];
2451
+ while (consume(',')) {
2452
+ variable = parseIdentifier();
2453
+ if (options.scope) scopeIdentifier(variable);
2454
+ variables.push(variable);
2455
+ }
2456
+ expect('in');
2457
+ var iterators = [];
2458
+ do {
2459
+ var expression = parseExpectedExpression();
2460
+ iterators.push(expression);
2461
+ } while (consume(','));
2462
+
2463
+ expect('do');
2464
+ body = parseBlock();
2465
+ expect('end');
2466
+
2467
+ return finishNode(ast.forGenericStatement(variables, iterators, body));
2468
+ }
2469
+ }
2470
+ //
2471
+ //
2472
+ function parseLocalStatement() {
2473
+ var name;
2474
+
2475
+ if (Identifier === token.type) {
2476
+ var variables = []
2477
+ , init = [];
2478
+
2479
+ do {
2480
+ name = parseIdentifier();
2481
+
2482
+ variables.push(name);
2483
+ } while (consume(','));
2484
+
2485
+ if (consume('=')) {
2486
+ do {
2487
+ var expression = parseExpectedExpression();
2488
+ init.push(expression);
2489
+ } while (consume(','));
2490
+ }
2491
+ if (options.scope) {
2492
+ for (var i = 0, l = variables.length; i < l; i++) {
2493
+ scopeIdentifier(variables[i]);
2494
+ }
2495
+ }
2496
+
2497
+ return finishNode(ast.localStatement(variables, init));
2498
+ }
2499
+ if (consume('function')) {
2500
+ name = parseIdentifier();
2501
+ if (options.scope) scopeIdentifier(name);
2502
+ return parseFunctionDeclaration(name, true);
2503
+ } else {
2504
+ raiseUnexpectedToken('<name>', token);
2505
+ }
2506
+ }
2507
+ //
2508
+ function parseAssignmentOrCallStatement() {
2509
+ var previous = token
2510
+ , expression, marker;
2511
+
2512
+ if (trackLocations) marker = createLocationMarker();
2513
+ expression = parsePrefixExpression();
2514
+
2515
+ if (null == expression) return unexpected(token);
2516
+ if (',='.indexOf(token.value) >= 0) {
2517
+ var variables = [expression]
2518
+ , init = []
2519
+ , exp;
2520
+
2521
+ while (consume(',')) {
2522
+ exp = parsePrefixExpression();
2523
+ if (null == exp) raiseUnexpectedToken('<expression>', token);
2524
+ variables.push(exp);
2525
+ }
2526
+ expect('=');
2527
+ do {
2528
+ exp = parseExpectedExpression();
2529
+ init.push(exp);
2530
+ } while (consume(','));
2531
+
2532
+ pushLocation(marker);
2533
+ return finishNode(ast.assignmentStatement(variables, init));
2534
+ }
2535
+ if (isCallExpression(expression)) {
2536
+ pushLocation(marker);
2537
+ return finishNode(ast.callStatement(expression));
2538
+ }
2539
+ return unexpected(previous);
2540
+ }
2541
+ function parseIdentifier() {
2542
+ markLocation();
2543
+ var identifier = token.value;
2544
+ if (Identifier !== token.type) raiseUnexpectedToken('<name>', token);
2545
+ next();
2546
+ return finishNode(ast.identifier(identifier));
2547
+ }
2548
+ //
2549
+ //
2550
+ function parseFunctionDeclaration(name, isLocal) {
2551
+ var parameters = [];
2552
+ expect('(');
2553
+ if (!consume(')')) {
2554
+ while (true) {
2555
+ if (Identifier === token.type) {
2556
+ var parameter = parseIdentifier();
2557
+ if (options.scope) scopeIdentifier(parameter);
2558
+
2559
+ parameters.push(parameter);
2560
+
2561
+ if (consume(',')) continue;
2562
+ else if (consume(')')) break;
2563
+ }
2564
+ else if (VarargLiteral === token.type) {
2565
+ parameters.push(parsePrimaryExpression());
2566
+ expect(')');
2567
+ break;
2568
+ } else {
2569
+ raiseUnexpectedToken('<name> or \'...\'', token);
2570
+ }
2571
+ }
2572
+ }
2573
+
2574
+ var body = parseBlock();
2575
+ expect('end');
2576
+
2577
+ isLocal = isLocal || false;
2578
+ return finishNode(ast.functionStatement(name, parameters, isLocal, body));
2579
+ }
2580
+ //
2581
+ function parseFunctionName() {
2582
+ var base, name, marker;
2583
+
2584
+ if (trackLocations) marker = createLocationMarker();
2585
+ base = parseIdentifier();
2586
+
2587
+ if (options.scope) attachScope(base, false);
2588
+
2589
+ while (consume('.')) {
2590
+ pushLocation(marker);
2591
+ name = parseIdentifier();
2592
+ if (options.scope) attachScope(name, false);
2593
+ base = finishNode(ast.memberExpression(base, '.', name));
2594
+ }
2595
+
2596
+ if (consume(':')) {
2597
+ pushLocation(marker);
2598
+ name = parseIdentifier();
2599
+ if (options.scope) attachScope(name, false);
2600
+ base = finishNode(ast.memberExpression(base, ':', name));
2601
+ }
2602
+
2603
+ return base;
2604
+ }
2605
+ //
2606
+ function parseTableConstructor() {
2607
+ var fields = []
2608
+ , key, value;
2609
+
2610
+ while (true) {
2611
+ markLocation();
2612
+ if (Punctuator === token.type && consume('[')) {
2613
+ key = parseExpectedExpression();
2614
+ expect(']');
2615
+ expect('=');
2616
+ value = parseExpectedExpression();
2617
+ fields.push(finishNode(ast.tableKey(key, value)));
2618
+ } else if (Identifier === token.type) {
2619
+ key = parseExpectedExpression();
2620
+ if (consume('=')) {
2621
+ value = parseExpectedExpression();
2622
+ fields.push(finishNode(ast.tableKeyString(key, value)));
2623
+ } else {
2624
+ fields.push(finishNode(ast.tableValue(key)));
2625
+ }
2626
+ } else {
2627
+ if (null == (value = parseExpression())) {
2628
+ locations.pop();
2629
+ break;
2630
+ }
2631
+ fields.push(finishNode(ast.tableValue(value)));
2632
+ }
2633
+ if (',;'.indexOf(token.value) >= 0) {
2634
+ next();
2635
+ continue;
2636
+ }
2637
+ if ('}' === token.value) break;
2638
+ }
2639
+ expect('}');
2640
+ return finishNode(ast.tableConstructorExpression(fields));
2641
+ }
2642
+ //
2643
+ //
2644
+ //
2645
+ //
2646
+ //
2647
+
2648
+ function parseExpression() {
2649
+ var expression = parseSubExpression(0);
2650
+ return expression;
2651
+ }
2652
+ function parseExpectedExpression() {
2653
+ var expression = parseExpression();
2654
+ if (null == expression) raiseUnexpectedToken('<expression>', token);
2655
+ else return expression;
2656
+ }
2657
+ //
2658
+ //
2659
+ function binaryPrecedence(operator) {
2660
+ var charCode = operator.charCodeAt(0)
2661
+ , length = operator.length;
2662
+
2663
+ if (1 === length) {
2664
+ switch (charCode) {
2665
+ case 94: return 10; // ^
2666
+ case 42: case 47: case 37: return 7; // * / %
2667
+ case 43: case 45: return 6; // + -
2668
+ case 60: case 62: return 3; // < >
2669
+ case 38: case 124: return 7; // & |
2670
+ }
2671
+ } else if (2 === length) {
2672
+ switch (charCode) {
2673
+ case 46: return 5; // ..
2674
+ case 60: case 62: case 61: case 126: return 3; // <= >= == ~=
2675
+ case 111: return 1; // or
2676
+ }
2677
+ } else if (97 === charCode && 'and' === operator) return 2;
2678
+ return 0;
2679
+ }
2680
+ //
2681
+ //
2682
+ function parseSubExpression(minPrecedence) {
2683
+ var operator = token.value
2684
+ , expression, marker;
2685
+
2686
+ if (trackLocations) marker = createLocationMarker();
2687
+ if (isUnary(token)) {
2688
+ markLocation();
2689
+ next();
2690
+ var argument = parseSubExpression(8);
2691
+ if (argument == null) raiseUnexpectedToken('<expression>', token);
2692
+ expression = finishNode(ast.unaryExpression(operator, argument));
2693
+ }
2694
+ if (null == expression) {
2695
+ expression = parsePrimaryExpression();
2696
+ if (null == expression) {
2697
+ expression = parsePrefixExpression();
2698
+ }
2699
+ }
2700
+ if (null == expression) return null;
2701
+
2702
+ var precedence;
2703
+ while (true) {
2704
+ operator = token.value;
2705
+
2706
+ precedence = (Punctuator === token.type || Keyword === token.type) ?
2707
+ binaryPrecedence(operator) : 0;
2708
+
2709
+ if (precedence === 0 || precedence <= minPrecedence) break;
2710
+ if ('^' === operator || '..' === operator) precedence--;
2711
+ next();
2712
+ var right = parseSubExpression(precedence);
2713
+ if (null == right) raiseUnexpectedToken('<expression>', token);
2714
+ if (trackLocations) locations.push(marker);
2715
+ expression = finishNode(ast.binaryExpression(operator, expression, right));
2716
+
2717
+ }
2718
+ return expression;
2719
+ }
2720
+ //
2721
+ function parsePrefixExpression() {
2722
+ var base, name, marker
2723
+ , isLocal;
2724
+
2725
+ if (trackLocations) marker = createLocationMarker();
2726
+ if (Identifier === token.type) {
2727
+ name = token.value;
2728
+ base = parseIdentifier();
2729
+ if (options.scope) attachScope(base, isLocal = scopeHasName(name));
2730
+ } else if (consume('(')) {
2731
+ base = parseExpectedExpression();
2732
+ expect(')');
2733
+ if (options.scope) isLocal = base.isLocal;
2734
+ } else {
2735
+ return null;
2736
+ }
2737
+ var expression, identifier;
2738
+ while (true) {
2739
+ if (Punctuator === token.type) {
2740
+ switch (token.value) {
2741
+ case '[':
2742
+ pushLocation(marker);
2743
+ next();
2744
+ expression = parseExpectedExpression();
2745
+ base = finishNode(ast.indexExpression(base, expression));
2746
+ expect(']');
2747
+ break;
2748
+ case '.':
2749
+ pushLocation(marker);
2750
+ next();
2751
+ identifier = parseIdentifier();
2752
+ if (options.scope) attachScope(identifier, isLocal);
2753
+ base = finishNode(ast.memberExpression(base, '.', identifier));
2754
+ break;
2755
+ case ':':
2756
+ pushLocation(marker);
2757
+ next();
2758
+ identifier = parseIdentifier();
2759
+ if (options.scope) attachScope(identifier, isLocal);
2760
+ base = finishNode(ast.memberExpression(base, ':', identifier));
2761
+ pushLocation(marker);
2762
+ base = parseCallExpression(base);
2763
+ break;
2764
+ case '(': case '{': // args
2765
+ pushLocation(marker);
2766
+ base = parseCallExpression(base);
2767
+ break;
2768
+ default:
2769
+ return base;
2770
+ }
2771
+ } else if (StringLiteral === token.type) {
2772
+ pushLocation(marker);
2773
+ base = parseCallExpression(base);
2774
+ } else {
2775
+ break;
2776
+ }
2777
+ }
2778
+
2779
+ return base;
2780
+ }
2781
+ function parseCallExpression(base) {
2782
+ if (Punctuator === token.type) {
2783
+ switch (token.value) {
2784
+ case '(':
2785
+ next();
2786
+ var expressions = [];
2787
+ var expression = parseExpression();
2788
+ if (null != expression) expressions.push(expression);
2789
+ while (consume(',')) {
2790
+ expression = parseExpectedExpression();
2791
+ expressions.push(expression);
2792
+ }
2793
+
2794
+ expect(')');
2795
+ return finishNode(ast.callExpression(base, expressions));
2796
+
2797
+ case '{':
2798
+ markLocation();
2799
+ next();
2800
+ var table = parseTableConstructor();
2801
+ return finishNode(ast.tableCallExpression(base, table));
2802
+ }
2803
+ } else if (StringLiteral === token.type) {
2804
+ return finishNode(ast.stringCallExpression(base, parsePrimaryExpression()));
2805
+ }
2806
+
2807
+ raiseUnexpectedToken('function arguments', token);
2808
+ }
2809
+ function parsePrimaryExpression() {
2810
+ var literals = StringLiteral | NumericLiteral | BooleanLiteral | NilLiteral | VarargLiteral
2811
+ , value = token.value
2812
+ , type = token.type
2813
+ , marker;
2814
+
2815
+ if (trackLocations) marker = createLocationMarker();
2816
+
2817
+ if (type & literals) {
2818
+ pushLocation(marker);
2819
+ var raw = input.slice(token.range[0], token.range[1]);
2820
+ next();
2821
+ return finishNode(ast.literal(type, value, raw));
2822
+ } else if (Keyword === type && 'function' === value) {
2823
+ pushLocation(marker);
2824
+ next();
2825
+ return parseFunctionDeclaration(null);
2826
+ } else if (consume('{')) {
2827
+ pushLocation(marker);
2828
+ return parseTableConstructor();
2829
+ }
2830
+ }
2831
+ //
2832
+ //
2833
+ //
2834
+ exports.parse = parse;
2835
+
2836
+ function parse(_input, _options) {
2837
+ if ('undefined' === typeof _options && 'object' === typeof _input) {
2838
+ _options = _input;
2839
+ _input = undefined;
2840
+ }
2841
+ if (!_options) _options = {};
2842
+
2843
+ input = _input || '';
2844
+ options = extend(defaultOptions, _options);
2845
+ index = 0;
2846
+ line = 1;
2847
+ lineStart = 0;
2848
+ length = input.length;
2849
+ scopes = [[]];
2850
+ scopeDepth = 0;
2851
+ globals = [];
2852
+ locations = [];
2853
+
2854
+ if (options.comments) comments = [];
2855
+ if (!options.wait) return end();
2856
+ return exports;
2857
+ }
2858
+ exports.write = write;
2859
+
2860
+ function write(_input) {
2861
+ input += String(_input);
2862
+ length = input.length;
2863
+ return exports;
2864
+ }
2865
+ exports.end = end;
2866
+
2867
+ function end(_input) {
2868
+ if ('undefined' !== typeof _input) write(_input);
2869
+
2870
+ length = input.length;
2871
+ trackLocations = options.locations || options.ranges;
2872
+ lookahead = lex();
2873
+
2874
+ var chunk = parseChunk();
2875
+ if (options.comments) chunk.comments = comments;
2876
+ if (options.scope) chunk.globals = globals;
2877
+
2878
+ if (locations.length > 0)
2879
+ throw new Error('Location tracking failed. This is most likely a bug in luaparse');
2880
+
2881
+ return chunk;
2882
+ }
2883
+
2884
+ }));
2885
+
2886
+ });
2887
+
2888
+ define("ace/mode/lua_worker",[], function(require, exports, module) {
2889
+ "use strict";
2890
+
2891
+ var oop = require("../lib/oop");
2892
+ var Mirror = require("../worker/mirror").Mirror;
2893
+ var luaparse = require("../mode/lua/luaparse");
2894
+
2895
+ var Worker = exports.Worker = function(sender) {
2896
+ Mirror.call(this, sender);
2897
+ this.setTimeout(500);
2898
+ };
2899
+
2900
+ oop.inherits(Worker, Mirror);
2901
+
2902
+ (function() {
2903
+
2904
+ this.onUpdate = function() {
2905
+ var value = this.doc.getValue();
2906
+ var errors = [];
2907
+ try {
2908
+ luaparse.parse(value);
2909
+ } catch(e) {
2910
+ if (e instanceof SyntaxError) {
2911
+ errors.push({
2912
+ row: e.line - 1,
2913
+ column: e.column,
2914
+ text: e.message,
2915
+ type: "error"
2916
+ });
2917
+ }
2918
+ }
2919
+ this.sender.emit("annotate", errors);
2920
+ };
2921
+
2922
+ }).call(Worker.prototype);
2923
+
2924
+ });
2925
+
2926
+ define("ace/lib/es5-shim",[], function(require, exports, module) {
2927
+
2928
+ //
2929
+ //
2930
+ function Empty() {}
2931
+
2932
+ if (!Function.prototype.bind) {
2933
+ Function.prototype.bind = function bind(that) { // .length is 1
2934
+ var target = this;
2935
+ if (typeof target != "function") {
2936
+ throw new TypeError("Function.prototype.bind called on incompatible " + target);
2937
+ }
2938
+ var args = slice.call(arguments, 1); // for normal call
2939
+ var bound = function () {
2940
+
2941
+ if (this instanceof bound) {
2942
+ var result = target.apply(
2943
+ this,
2944
+ args.concat(slice.call(arguments))
2945
+ );
2946
+ if (Object(result) === result) {
2947
+ return result;
2948
+ }
2949
+ return this;
2950
+
2951
+ } else {
2952
+ return target.apply(
2953
+ that,
2954
+ args.concat(slice.call(arguments))
2955
+ );
2956
+
2957
+ }
2958
+
2959
+ };
2960
+ if(target.prototype) {
2961
+ Empty.prototype = target.prototype;
2962
+ bound.prototype = new Empty();
2963
+ Empty.prototype = null;
2964
+ }
2965
+ //
2966
+ return bound;
2967
+ };
2968
+ }
2969
+ var call = Function.prototype.call;
2970
+ var prototypeOfArray = Array.prototype;
2971
+ var prototypeOfObject = Object.prototype;
2972
+ var slice = prototypeOfArray.slice;
2973
+ var _toString = call.bind(prototypeOfObject.toString);
2974
+ var owns = call.bind(prototypeOfObject.hasOwnProperty);
2975
+ var defineGetter;
2976
+ var defineSetter;
2977
+ var lookupGetter;
2978
+ var lookupSetter;
2979
+ var supportsAccessors;
2980
+ if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
2981
+ defineGetter = call.bind(prototypeOfObject.__defineGetter__);
2982
+ defineSetter = call.bind(prototypeOfObject.__defineSetter__);
2983
+ lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
2984
+ lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
2985
+ }
2986
+
2987
+ //
2988
+ //
2989
+ if ([1,2].splice(0).length != 2) {
2990
+ if(function() { // test IE < 9 to splice bug - see issue #138
2991
+ function makeArray(l) {
2992
+ var a = new Array(l+2);
2993
+ a[0] = a[1] = 0;
2994
+ return a;
2995
+ }
2996
+ var array = [], lengthBefore;
2997
+
2998
+ array.splice.apply(array, makeArray(20));
2999
+ array.splice.apply(array, makeArray(26));
3000
+
3001
+ lengthBefore = array.length; //46
3002
+ array.splice(5, 0, "XXX"); // add one element
3003
+
3004
+ lengthBefore + 1 == array.length
3005
+
3006
+ if (lengthBefore + 1 == array.length) {
3007
+ return true;// has right splice implementation without bugs
3008
+ }
3009
+ }()) {//IE 6/7
3010
+ var array_splice = Array.prototype.splice;
3011
+ Array.prototype.splice = function(start, deleteCount) {
3012
+ if (!arguments.length) {
3013
+ return [];
3014
+ } else {
3015
+ return array_splice.apply(this, [
3016
+ start === void 0 ? 0 : start,
3017
+ deleteCount === void 0 ? (this.length - start) : deleteCount
3018
+ ].concat(slice.call(arguments, 2)))
3019
+ }
3020
+ };
3021
+ } else {//IE8
3022
+ Array.prototype.splice = function(pos, removeCount){
3023
+ var length = this.length;
3024
+ if (pos > 0) {
3025
+ if (pos > length)
3026
+ pos = length;
3027
+ } else if (pos == void 0) {
3028
+ pos = 0;
3029
+ } else if (pos < 0) {
3030
+ pos = Math.max(length + pos, 0);
3031
+ }
3032
+
3033
+ if (!(pos+removeCount < length))
3034
+ removeCount = length - pos;
3035
+
3036
+ var removed = this.slice(pos, pos+removeCount);
3037
+ var insert = slice.call(arguments, 2);
3038
+ var add = insert.length;
3039
+ if (pos === length) {
3040
+ if (add) {
3041
+ this.push.apply(this, insert);
3042
+ }
3043
+ } else {
3044
+ var remove = Math.min(removeCount, length - pos);
3045
+ var tailOldPos = pos + remove;
3046
+ var tailNewPos = tailOldPos + add - remove;
3047
+ var tailCount = length - tailOldPos;
3048
+ var lengthAfterRemove = length - remove;
3049
+
3050
+ if (tailNewPos < tailOldPos) { // case A
3051
+ for (var i = 0; i < tailCount; ++i) {
3052
+ this[tailNewPos+i] = this[tailOldPos+i];
3053
+ }
3054
+ } else if (tailNewPos > tailOldPos) { // case B
3055
+ for (i = tailCount; i--; ) {
3056
+ this[tailNewPos+i] = this[tailOldPos+i];
3057
+ }
3058
+ } // else, add == remove (nothing to do)
3059
+
3060
+ if (add && pos === lengthAfterRemove) {
3061
+ this.length = lengthAfterRemove; // truncate array
3062
+ this.push.apply(this, insert);
3063
+ } else {
3064
+ this.length = lengthAfterRemove + add; // reserves space
3065
+ for (i = 0; i < add; ++i) {
3066
+ this[pos+i] = insert[i];
3067
+ }
3068
+ }
3069
+ }
3070
+ return removed;
3071
+ };
3072
+ }
3073
+ }
3074
+ if (!Array.isArray) {
3075
+ Array.isArray = function isArray(obj) {
3076
+ return _toString(obj) == "[object Array]";
3077
+ };
3078
+ }
3079
+ var boxedString = Object("a"),
3080
+ splitString = boxedString[0] != "a" || !(0 in boxedString);
3081
+
3082
+ if (!Array.prototype.forEach) {
3083
+ Array.prototype.forEach = function forEach(fun /*, thisp*/) {
3084
+ var object = toObject(this),
3085
+ self = splitString && _toString(this) == "[object String]" ?
3086
+ this.split("") :
3087
+ object,
3088
+ thisp = arguments[1],
3089
+ i = -1,
3090
+ length = self.length >>> 0;
3091
+ if (_toString(fun) != "[object Function]") {
3092
+ throw new TypeError(); // TODO message
3093
+ }
3094
+
3095
+ while (++i < length) {
3096
+ if (i in self) {
3097
+ fun.call(thisp, self[i], i, object);
3098
+ }
3099
+ }
3100
+ };
3101
+ }
3102
+ if (!Array.prototype.map) {
3103
+ Array.prototype.map = function map(fun /*, thisp*/) {
3104
+ var object = toObject(this),
3105
+ self = splitString && _toString(this) == "[object String]" ?
3106
+ this.split("") :
3107
+ object,
3108
+ length = self.length >>> 0,
3109
+ result = Array(length),
3110
+ thisp = arguments[1];
3111
+ if (_toString(fun) != "[object Function]") {
3112
+ throw new TypeError(fun + " is not a function");
3113
+ }
3114
+
3115
+ for (var i = 0; i < length; i++) {
3116
+ if (i in self)
3117
+ result[i] = fun.call(thisp, self[i], i, object);
3118
+ }
3119
+ return result;
3120
+ };
3121
+ }
3122
+ if (!Array.prototype.filter) {
3123
+ Array.prototype.filter = function filter(fun /*, thisp */) {
3124
+ var object = toObject(this),
3125
+ self = splitString && _toString(this) == "[object String]" ?
3126
+ this.split("") :
3127
+ object,
3128
+ length = self.length >>> 0,
3129
+ result = [],
3130
+ value,
3131
+ thisp = arguments[1];
3132
+ if (_toString(fun) != "[object Function]") {
3133
+ throw new TypeError(fun + " is not a function");
3134
+ }
3135
+
3136
+ for (var i = 0; i < length; i++) {
3137
+ if (i in self) {
3138
+ value = self[i];
3139
+ if (fun.call(thisp, value, i, object)) {
3140
+ result.push(value);
3141
+ }
3142
+ }
3143
+ }
3144
+ return result;
3145
+ };
3146
+ }
3147
+ if (!Array.prototype.every) {
3148
+ Array.prototype.every = function every(fun /*, thisp */) {
3149
+ var object = toObject(this),
3150
+ self = splitString && _toString(this) == "[object String]" ?
3151
+ this.split("") :
3152
+ object,
3153
+ length = self.length >>> 0,
3154
+ thisp = arguments[1];
3155
+ if (_toString(fun) != "[object Function]") {
3156
+ throw new TypeError(fun + " is not a function");
3157
+ }
3158
+
3159
+ for (var i = 0; i < length; i++) {
3160
+ if (i in self && !fun.call(thisp, self[i], i, object)) {
3161
+ return false;
3162
+ }
3163
+ }
3164
+ return true;
3165
+ };
3166
+ }
3167
+ if (!Array.prototype.some) {
3168
+ Array.prototype.some = function some(fun /*, thisp */) {
3169
+ var object = toObject(this),
3170
+ self = splitString && _toString(this) == "[object String]" ?
3171
+ this.split("") :
3172
+ object,
3173
+ length = self.length >>> 0,
3174
+ thisp = arguments[1];
3175
+ if (_toString(fun) != "[object Function]") {
3176
+ throw new TypeError(fun + " is not a function");
3177
+ }
3178
+
3179
+ for (var i = 0; i < length; i++) {
3180
+ if (i in self && fun.call(thisp, self[i], i, object)) {
3181
+ return true;
3182
+ }
3183
+ }
3184
+ return false;
3185
+ };
3186
+ }
3187
+ if (!Array.prototype.reduce) {
3188
+ Array.prototype.reduce = function reduce(fun /*, initial*/) {
3189
+ var object = toObject(this),
3190
+ self = splitString && _toString(this) == "[object String]" ?
3191
+ this.split("") :
3192
+ object,
3193
+ length = self.length >>> 0;
3194
+ if (_toString(fun) != "[object Function]") {
3195
+ throw new TypeError(fun + " is not a function");
3196
+ }
3197
+ if (!length && arguments.length == 1) {
3198
+ throw new TypeError("reduce of empty array with no initial value");
3199
+ }
3200
+
3201
+ var i = 0;
3202
+ var result;
3203
+ if (arguments.length >= 2) {
3204
+ result = arguments[1];
3205
+ } else {
3206
+ do {
3207
+ if (i in self) {
3208
+ result = self[i++];
3209
+ break;
3210
+ }
3211
+ if (++i >= length) {
3212
+ throw new TypeError("reduce of empty array with no initial value");
3213
+ }
3214
+ } while (true);
3215
+ }
3216
+
3217
+ for (; i < length; i++) {
3218
+ if (i in self) {
3219
+ result = fun.call(void 0, result, self[i], i, object);
3220
+ }
3221
+ }
3222
+
3223
+ return result;
3224
+ };
3225
+ }
3226
+ if (!Array.prototype.reduceRight) {
3227
+ Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
3228
+ var object = toObject(this),
3229
+ self = splitString && _toString(this) == "[object String]" ?
3230
+ this.split("") :
3231
+ object,
3232
+ length = self.length >>> 0;
3233
+ if (_toString(fun) != "[object Function]") {
3234
+ throw new TypeError(fun + " is not a function");
3235
+ }
3236
+ if (!length && arguments.length == 1) {
3237
+ throw new TypeError("reduceRight of empty array with no initial value");
3238
+ }
3239
+
3240
+ var result, i = length - 1;
3241
+ if (arguments.length >= 2) {
3242
+ result = arguments[1];
3243
+ } else {
3244
+ do {
3245
+ if (i in self) {
3246
+ result = self[i--];
3247
+ break;
3248
+ }
3249
+ if (--i < 0) {
3250
+ throw new TypeError("reduceRight of empty array with no initial value");
3251
+ }
3252
+ } while (true);
3253
+ }
3254
+
3255
+ do {
3256
+ if (i in this) {
3257
+ result = fun.call(void 0, result, self[i], i, object);
3258
+ }
3259
+ } while (i--);
3260
+
3261
+ return result;
3262
+ };
3263
+ }
3264
+ if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
3265
+ Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
3266
+ var self = splitString && _toString(this) == "[object String]" ?
3267
+ this.split("") :
3268
+ toObject(this),
3269
+ length = self.length >>> 0;
3270
+
3271
+ if (!length) {
3272
+ return -1;
3273
+ }
3274
+
3275
+ var i = 0;
3276
+ if (arguments.length > 1) {
3277
+ i = toInteger(arguments[1]);
3278
+ }
3279
+ i = i >= 0 ? i : Math.max(0, length + i);
3280
+ for (; i < length; i++) {
3281
+ if (i in self && self[i] === sought) {
3282
+ return i;
3283
+ }
3284
+ }
3285
+ return -1;
3286
+ };
3287
+ }
3288
+ if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
3289
+ Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
3290
+ var self = splitString && _toString(this) == "[object String]" ?
3291
+ this.split("") :
3292
+ toObject(this),
3293
+ length = self.length >>> 0;
3294
+
3295
+ if (!length) {
3296
+ return -1;
3297
+ }
3298
+ var i = length - 1;
3299
+ if (arguments.length > 1) {
3300
+ i = Math.min(i, toInteger(arguments[1]));
3301
+ }
3302
+ i = i >= 0 ? i : length - Math.abs(i);
3303
+ for (; i >= 0; i--) {
3304
+ if (i in self && sought === self[i]) {
3305
+ return i;
3306
+ }
3307
+ }
3308
+ return -1;
3309
+ };
3310
+ }
3311
+
3312
+ //
3313
+ //
3314
+ if (!Object.getPrototypeOf) {
3315
+ Object.getPrototypeOf = function getPrototypeOf(object) {
3316
+ return object.__proto__ || (
3317
+ object.constructor ?
3318
+ object.constructor.prototype :
3319
+ prototypeOfObject
3320
+ );
3321
+ };
3322
+ }
3323
+ if (!Object.getOwnPropertyDescriptor) {
3324
+ var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
3325
+ "non-object: ";
3326
+ Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
3327
+ if ((typeof object != "object" && typeof object != "function") || object === null)
3328
+ throw new TypeError(ERR_NON_OBJECT + object);
3329
+ if (!owns(object, property))
3330
+ return;
3331
+
3332
+ var descriptor, getter, setter;
3333
+ descriptor = { enumerable: true, configurable: true };
3334
+ if (supportsAccessors) {
3335
+ var prototype = object.__proto__;
3336
+ object.__proto__ = prototypeOfObject;
3337
+
3338
+ var getter = lookupGetter(object, property);
3339
+ var setter = lookupSetter(object, property);
3340
+ object.__proto__ = prototype;
3341
+
3342
+ if (getter || setter) {
3343
+ if (getter) descriptor.get = getter;
3344
+ if (setter) descriptor.set = setter;
3345
+ return descriptor;
3346
+ }
3347
+ }
3348
+ descriptor.value = object[property];
3349
+ return descriptor;
3350
+ };
3351
+ }
3352
+ if (!Object.getOwnPropertyNames) {
3353
+ Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
3354
+ return Object.keys(object);
3355
+ };
3356
+ }
3357
+ if (!Object.create) {
3358
+ var createEmpty;
3359
+ if (Object.prototype.__proto__ === null) {
3360
+ createEmpty = function () {
3361
+ return { "__proto__": null };
3362
+ };
3363
+ } else {
3364
+ createEmpty = function () {
3365
+ var empty = {};
3366
+ for (var i in empty)
3367
+ empty[i] = null;
3368
+ empty.constructor =
3369
+ empty.hasOwnProperty =
3370
+ empty.propertyIsEnumerable =
3371
+ empty.isPrototypeOf =
3372
+ empty.toLocaleString =
3373
+ empty.toString =
3374
+ empty.valueOf =
3375
+ empty.__proto__ = null;
3376
+ return empty;
3377
+ }
3378
+ }
3379
+
3380
+ Object.create = function create(prototype, properties) {
3381
+ var object;
3382
+ if (prototype === null) {
3383
+ object = createEmpty();
3384
+ } else {
3385
+ if (typeof prototype != "object")
3386
+ throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
3387
+ var Type = function () {};
3388
+ Type.prototype = prototype;
3389
+ object = new Type();
3390
+ object.__proto__ = prototype;
3391
+ }
3392
+ if (properties !== void 0)
3393
+ Object.defineProperties(object, properties);
3394
+ return object;
3395
+ };
3396
+ }
3397
+ function doesDefinePropertyWork(object) {
3398
+ try {
3399
+ Object.defineProperty(object, "sentinel", {});
3400
+ return "sentinel" in object;
3401
+ } catch (exception) {
3402
+ }
3403
+ }
3404
+ if (Object.defineProperty) {
3405
+ var definePropertyWorksOnObject = doesDefinePropertyWork({});
3406
+ var definePropertyWorksOnDom = typeof document == "undefined" ||
3407
+ doesDefinePropertyWork(document.createElement("div"));
3408
+ if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
3409
+ var definePropertyFallback = Object.defineProperty;
3410
+ }
3411
+ }
3412
+
3413
+ if (!Object.defineProperty || definePropertyFallback) {
3414
+ var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
3415
+ var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
3416
+ var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
3417
+ "on this javascript engine";
3418
+
3419
+ Object.defineProperty = function defineProperty(object, property, descriptor) {
3420
+ if ((typeof object != "object" && typeof object != "function") || object === null)
3421
+ throw new TypeError(ERR_NON_OBJECT_TARGET + object);
3422
+ if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
3423
+ throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
3424
+ if (definePropertyFallback) {
3425
+ try {
3426
+ return definePropertyFallback.call(Object, object, property, descriptor);
3427
+ } catch (exception) {
3428
+ }
3429
+ }
3430
+ if (owns(descriptor, "value")) {
3431
+
3432
+ if (supportsAccessors && (lookupGetter(object, property) ||
3433
+ lookupSetter(object, property)))
3434
+ {
3435
+ var prototype = object.__proto__;
3436
+ object.__proto__ = prototypeOfObject;
3437
+ delete object[property];
3438
+ object[property] = descriptor.value;
3439
+ object.__proto__ = prototype;
3440
+ } else {
3441
+ object[property] = descriptor.value;
3442
+ }
3443
+ } else {
3444
+ if (!supportsAccessors)
3445
+ throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
3446
+ if (owns(descriptor, "get"))
3447
+ defineGetter(object, property, descriptor.get);
3448
+ if (owns(descriptor, "set"))
3449
+ defineSetter(object, property, descriptor.set);
3450
+ }
3451
+
3452
+ return object;
3453
+ };
3454
+ }
3455
+ if (!Object.defineProperties) {
3456
+ Object.defineProperties = function defineProperties(object, properties) {
3457
+ for (var property in properties) {
3458
+ if (owns(properties, property))
3459
+ Object.defineProperty(object, property, properties[property]);
3460
+ }
3461
+ return object;
3462
+ };
3463
+ }
3464
+ if (!Object.seal) {
3465
+ Object.seal = function seal(object) {
3466
+ return object;
3467
+ };
3468
+ }
3469
+ if (!Object.freeze) {
3470
+ Object.freeze = function freeze(object) {
3471
+ return object;
3472
+ };
3473
+ }
3474
+ try {
3475
+ Object.freeze(function () {});
3476
+ } catch (exception) {
3477
+ Object.freeze = (function freeze(freezeObject) {
3478
+ return function freeze(object) {
3479
+ if (typeof object == "function") {
3480
+ return object;
3481
+ } else {
3482
+ return freezeObject(object);
3483
+ }
3484
+ };
3485
+ })(Object.freeze);
3486
+ }
3487
+ if (!Object.preventExtensions) {
3488
+ Object.preventExtensions = function preventExtensions(object) {
3489
+ return object;
3490
+ };
3491
+ }
3492
+ if (!Object.isSealed) {
3493
+ Object.isSealed = function isSealed(object) {
3494
+ return false;
3495
+ };
3496
+ }
3497
+ if (!Object.isFrozen) {
3498
+ Object.isFrozen = function isFrozen(object) {
3499
+ return false;
3500
+ };
3501
+ }
3502
+ if (!Object.isExtensible) {
3503
+ Object.isExtensible = function isExtensible(object) {
3504
+ if (Object(object) === object) {
3505
+ throw new TypeError(); // TODO message
3506
+ }
3507
+ var name = '';
3508
+ while (owns(object, name)) {
3509
+ name += '?';
3510
+ }
3511
+ object[name] = true;
3512
+ var returnValue = owns(object, name);
3513
+ delete object[name];
3514
+ return returnValue;
3515
+ };
3516
+ }
3517
+ if (!Object.keys) {
3518
+ var hasDontEnumBug = true,
3519
+ dontEnums = [
3520
+ "toString",
3521
+ "toLocaleString",
3522
+ "valueOf",
3523
+ "hasOwnProperty",
3524
+ "isPrototypeOf",
3525
+ "propertyIsEnumerable",
3526
+ "constructor"
3527
+ ],
3528
+ dontEnumsLength = dontEnums.length;
3529
+
3530
+ for (var key in {"toString": null}) {
3531
+ hasDontEnumBug = false;
3532
+ }
3533
+
3534
+ Object.keys = function keys(object) {
3535
+
3536
+ if (
3537
+ (typeof object != "object" && typeof object != "function") ||
3538
+ object === null
3539
+ ) {
3540
+ throw new TypeError("Object.keys called on a non-object");
3541
+ }
3542
+
3543
+ var keys = [];
3544
+ for (var name in object) {
3545
+ if (owns(object, name)) {
3546
+ keys.push(name);
3547
+ }
3548
+ }
3549
+
3550
+ if (hasDontEnumBug) {
3551
+ for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
3552
+ var dontEnum = dontEnums[i];
3553
+ if (owns(object, dontEnum)) {
3554
+ keys.push(dontEnum);
3555
+ }
3556
+ }
3557
+ }
3558
+ return keys;
3559
+ };
3560
+
3561
+ }
3562
+
3563
+ //
3564
+ //
3565
+ if (!Date.now) {
3566
+ Date.now = function now() {
3567
+ return new Date().getTime();
3568
+ };
3569
+ }
3570
+
3571
+
3572
+ //
3573
+ //
3574
+ var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
3575
+ "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
3576
+ "\u2029\uFEFF";
3577
+ if (!String.prototype.trim || ws.trim()) {
3578
+ ws = "[" + ws + "]";
3579
+ var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
3580
+ trimEndRegexp = new RegExp(ws + ws + "*$");
3581
+ String.prototype.trim = function trim() {
3582
+ return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
3583
+ };
3584
+ }
3585
+
3586
+ //
3587
+ //
3588
+ function toInteger(n) {
3589
+ n = +n;
3590
+ if (n !== n) { // isNaN
3591
+ n = 0;
3592
+ } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
3593
+ n = (n > 0 || -1) * Math.floor(Math.abs(n));
3594
+ }
3595
+ return n;
3596
+ }
3597
+
3598
+ function isPrimitive(input) {
3599
+ var type = typeof input;
3600
+ return (
3601
+ input === null ||
3602
+ type === "undefined" ||
3603
+ type === "boolean" ||
3604
+ type === "number" ||
3605
+ type === "string"
3606
+ );
3607
+ }
3608
+
3609
+ function toPrimitive(input) {
3610
+ var val, valueOf, toString;
3611
+ if (isPrimitive(input)) {
3612
+ return input;
3613
+ }
3614
+ valueOf = input.valueOf;
3615
+ if (typeof valueOf === "function") {
3616
+ val = valueOf.call(input);
3617
+ if (isPrimitive(val)) {
3618
+ return val;
3619
+ }
3620
+ }
3621
+ toString = input.toString;
3622
+ if (typeof toString === "function") {
3623
+ val = toString.call(input);
3624
+ if (isPrimitive(val)) {
3625
+ return val;
3626
+ }
3627
+ }
3628
+ throw new TypeError();
3629
+ }
3630
+ var toObject = function (o) {
3631
+ if (o == null) { // this matches both null and undefined
3632
+ throw new TypeError("can't convert "+o+" to object");
3633
+ }
3634
+ return Object(o);
3635
+ };
3636
+
3637
+ });