gollum 2.4.4 → 2.4.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of gollum might be problematic. Click here for more details.

Files changed (391) hide show
  1. data/gollum.gemspec +100 -19
  2. data/lib/gollum.rb +2 -3
  3. data/lib/gollum/frontend/public/gollum/css/gollum.css +3 -1
  4. data/lib/gollum/frontend/public/gollum/css/template.css +8 -12
  5. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js +64 -60
  6. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js +56 -62
  7. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +25 -32
  8. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +56 -63
  9. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +25 -32
  10. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +11 -11
  11. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +59 -53
  12. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +46 -39
  13. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +32 -36
  14. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js +62 -47
  15. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config_test.js +71 -0
  16. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +82 -41
  17. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js +126 -145
  18. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js +25 -33
  19. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +484 -467
  20. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +30 -63
  21. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +29 -37
  22. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +27 -35
  23. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +47 -55
  24. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +61 -41
  25. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js +506 -517
  26. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js +25 -32
  27. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +26 -34
  28. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js +25 -32
  29. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +25 -32
  30. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +28 -38
  31. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +9 -14
  32. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +26 -36
  33. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +44 -36
  34. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +45 -52
  35. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +25 -34
  36. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +26 -33
  37. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +230 -165
  38. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +76 -49
  39. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +66 -61
  40. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js +36 -43
  41. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +138 -156
  42. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +35 -32
  43. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +18 -18
  44. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js +25 -32
  45. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +116 -101
  46. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +117 -83
  47. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +60 -71
  48. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +163 -102
  49. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +60 -41
  50. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js +26 -36
  51. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +26 -36
  52. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +24 -1
  53. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +52 -54
  54. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +32 -39
  55. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js +25 -32
  56. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +9 -1
  57. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +73 -33
  58. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +10 -3
  59. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +25 -32
  60. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js +2 -2
  61. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +55 -58
  62. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/package.json +8 -0
  63. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/test_highlight_rules.js +144 -0
  64. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_javascript.txt +52 -0
  65. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c9search.json +175 -0
  66. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c_cpp.json +124 -0
  67. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_clojure.json +248 -0
  68. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coffee.json +188 -0
  69. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coldfusion.json +41 -0
  70. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_csharp.json +42 -0
  71. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_css.json +231 -0
  72. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_diff.json +732 -0
  73. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_glsl.json +185 -0
  74. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_golang.json +362 -0
  75. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_groovy.json +529 -0
  76. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haxe.json +195 -0
  77. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html.json +150 -0
  78. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_java.json +139 -0
  79. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_javascript.json +555 -0
  80. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_json.json +611 -0
  81. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsx.json +79 -0
  82. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_latex.json +196 -0
  83. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_less.json +292 -0
  84. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_liquid.json +698 -0
  85. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lua.json +451 -0
  86. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_luapage.json +824 -0
  87. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_markdown.json +1202 -0
  88. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ocaml.json +260 -0
  89. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_perl.json +311 -0
  90. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pgsql.json +1020 -0
  91. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_php.json +238 -0
  92. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_powershell.json +255 -0
  93. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_python.json +205 -0
  94. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ruby.json +104 -0
  95. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scad.json +267 -0
  96. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scala.json +748 -0
  97. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scss.json +181 -0
  98. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sh.json +434 -0
  99. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sql.json +73 -0
  100. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_svg.json +931 -0
  101. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tcl.json +536 -0
  102. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_text.json +58 -0
  103. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_textile.json +195 -0
  104. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xml.json +705 -0
  105. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xquery.json +64 -0
  106. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_yaml.json +260 -0
  107. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/abap.js +77 -0
  108. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/abap_highlight_rules.js +133 -0
  109. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc.js +64 -0
  110. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc_highlight_rules.js +234 -0
  111. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js +26 -34
  112. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +195 -55
  113. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +26 -34
  114. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +26 -34
  115. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +31 -31
  116. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +25 -32
  117. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +25 -32
  118. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +25 -33
  119. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +67 -60
  120. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +25 -34
  121. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +112 -130
  122. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +29 -36
  123. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +25 -32
  124. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +22 -7
  125. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +140 -64
  126. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +479 -237
  127. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +321 -230
  128. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +25 -32
  129. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +62 -28
  130. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +39 -20
  131. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +183 -82
  132. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +226 -32
  133. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +25 -32
  134. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +25 -32
  135. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +28 -35
  136. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +25 -32
  137. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +7 -21
  138. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +36 -47
  139. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +202 -697
  140. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +51 -84
  141. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js +25 -32
  142. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +25 -32
  143. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +68 -40
  144. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js +25 -32
  145. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/dart.js +62 -0
  146. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/dart_highlight_rules.js +192 -0
  147. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +25 -31
  148. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +27 -33
  149. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +25 -32
  150. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/asciidoc.js +142 -0
  151. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +31 -37
  152. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js +26 -33
  153. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js +25 -32
  154. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +30 -51
  155. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +25 -32
  156. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js +28 -35
  157. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +35 -30
  158. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +25 -32
  159. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +25 -32
  160. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/latex.js +162 -0
  161. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/lua.js +163 -0
  162. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/markdown.js +125 -0
  163. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +25 -32
  164. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js +25 -32
  165. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js +26 -33
  166. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +25 -32
  167. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js +25 -32
  168. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/glsl.js +52 -0
  169. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/glsl_highlight_rules.js +81 -0
  170. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +0 -1
  171. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +15 -22
  172. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +28 -36
  173. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haml.js +62 -0
  174. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haml_highlight_rules.js +132 -0
  175. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +20 -25
  176. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +11 -15
  177. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +25 -32
  178. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +32 -38
  179. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +162 -69
  180. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +25 -32
  181. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jade.js +58 -0
  182. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jade_highlight_rules.js +347 -0
  183. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +18 -29
  184. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +28 -51
  185. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript/jshint.js +4838 -0
  186. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +98 -180
  187. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +26 -33
  188. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +25 -32
  189. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +163 -64
  190. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +38 -40
  191. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +26 -33
  192. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +26 -34
  193. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +25 -32
  194. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +25 -32
  195. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsp.js +56 -0
  196. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsp_highlight_rules.js +85 -0
  197. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +3 -2
  198. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +1 -1
  199. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +25 -33
  200. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +25 -33
  201. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +25 -32
  202. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +146 -161
  203. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js +25 -32
  204. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lisp.js +60 -0
  205. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lisp_highlight_rules.js +127 -0
  206. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +116 -56
  207. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +75 -101
  208. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene.js +16 -0
  209. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules.js +49 -0
  210. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules_test.js +99 -0
  211. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/makefile.js +62 -0
  212. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/makefile_highlight_rules.js +75 -0
  213. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +35 -41
  214. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +29 -37
  215. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules_test.js +100 -0
  216. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +25 -32
  217. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js +25 -32
  218. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec.js +62 -0
  219. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec_highlight_rules.js +343 -0
  220. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +25 -32
  221. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +39 -53
  222. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +25 -32
  223. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +39 -52
  224. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +33 -24
  225. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +55 -51
  226. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +57 -36
  227. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +53 -153
  228. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +31 -21
  229. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +28 -36
  230. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +44 -61
  231. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js +25 -32
  232. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/r.js +135 -0
  233. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/r_highlight_rules.js +190 -0
  234. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc.js +36 -0
  235. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc_highlight_rules.js +99 -0
  236. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml.js +67 -0
  237. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml_highlight_rules.js +49 -0
  238. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +27 -33
  239. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +102 -90
  240. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +29 -37
  241. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +25 -33
  242. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +32 -54
  243. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +18 -32
  244. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +25 -32
  245. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +25 -32
  246. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +28 -35
  247. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +48 -64
  248. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +28 -18
  249. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +41 -36
  250. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/stylus.js +62 -0
  251. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/stylus_highlight_rules.js +175 -0
  252. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +25 -32
  253. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +26 -33
  254. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tcl.js +110 -0
  255. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tcl_highlight_rules.js +180 -0
  256. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tex.js +48 -0
  257. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tex_highlight_rules.js +107 -0
  258. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +26 -36
  259. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +57 -46
  260. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +25 -32
  261. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +25 -32
  262. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js +26 -33
  263. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/typescript.js +68 -0
  264. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/typescript_highlight_rules.js +98 -0
  265. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +25 -32
  266. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +27 -34
  267. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +183 -78
  268. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +25 -32
  269. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +30 -38
  270. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +32 -37
  271. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/JSONParseTreeHandler.js +92 -0
  272. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +32954 -42497
  273. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/visitors/SyntaxHighlighter.js +316 -0
  274. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +31 -44
  275. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +48 -57
  276. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +30 -18
  277. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +48 -40
  278. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js +26 -34
  279. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +126 -40
  280. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +35 -43
  281. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +28 -35
  282. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +78 -39
  283. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +26 -34
  284. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +39 -36
  285. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +26 -34
  286. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +234 -103
  287. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +26 -34
  288. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +30 -39
  289. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +27 -35
  290. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js +190 -201
  291. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js +25 -32
  292. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +25 -32
  293. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js +25 -32
  294. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +31 -49
  295. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +27 -34
  296. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +52 -55
  297. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js +91 -105
  298. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +31 -34
  299. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js +47 -37
  300. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js +138 -153
  301. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +25 -32
  302. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js +67 -105
  303. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js +25 -32
  304. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +3 -2
  305. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js +25 -32
  306. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js +25 -32
  307. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +30 -34
  308. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.css +217 -0
  309. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.js +33 -0
  310. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +37 -38
  311. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js +27 -34
  312. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +53 -47
  313. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +28 -35
  314. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +54 -48
  315. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +28 -35
  316. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +58 -59
  317. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +28 -35
  318. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +33 -33
  319. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js +26 -33
  320. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +52 -64
  321. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +28 -35
  322. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +33 -36
  323. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js +26 -33
  324. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +29 -25
  325. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js +26 -33
  326. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +14 -21
  327. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js +26 -33
  328. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +48 -60
  329. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +28 -35
  330. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +52 -57
  331. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +28 -35
  332. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +53 -71
  333. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +28 -35
  334. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +54 -77
  335. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +28 -35
  336. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +60 -70
  337. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +28 -35
  338. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +55 -72
  339. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +28 -35
  340. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +55 -64
  341. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +28 -35
  342. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +48 -66
  343. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +28 -35
  344. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +49 -61
  345. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +28 -35
  346. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +38 -44
  347. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js +26 -33
  348. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +59 -87
  349. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +28 -35
  350. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +59 -87
  351. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +28 -35
  352. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +59 -90
  353. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +28 -35
  354. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +59 -87
  355. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +28 -35
  356. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +57 -85
  357. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +28 -35
  358. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +54 -78
  359. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +28 -35
  360. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +45 -68
  361. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +28 -35
  362. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.css +111 -0
  363. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.js +39 -0
  364. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +37 -50
  365. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js +26 -33
  366. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +40 -41
  367. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer_dev.js +205 -0
  368. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +48 -55
  369. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +254 -277
  370. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js +25 -32
  371. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +22 -4
  372. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +97 -56
  373. data/lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt +24 -476
  374. data/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt +2 -2
  375. data/lib/gollum/frontend/views/page.rb +3 -2
  376. metadata +102 -21
  377. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js +0 -59
  378. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js +0 -1686
  379. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js +0 -2993
  380. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js +0 -69
  381. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js +0 -63
  382. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js +0 -10363
  383. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js +0 -165
  384. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js +0 -6177
  385. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js +0 -55
  386. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js +0 -696
  387. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js +0 -598
  388. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js +0 -61
  389. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js +0 -2072
  390. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js +0 -4469
  391. data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js +0 -6396
@@ -1,61 +0,0 @@
1
- /* vim: set sw=4 ts=4 et tw=78: */
2
- /* ***** BEGIN LICENSE BLOCK *****
3
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4
- *
5
- * The contents of this file are subject to the Mozilla Public License Version
6
- * 1.1 (the "License"); you may not use this file except in compliance with
7
- * the License. You may obtain a copy of the License at
8
- * http://www.mozilla.org/MPL/
9
- *
10
- * Software distributed under the License is distributed on an "AS IS" basis,
11
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
- * for the specific language governing rights and limitations under the
13
- * License.
14
- *
15
- * The Original Code is the Narcissus JavaScript engine.
16
- *
17
- * The Initial Developer of the Original Code is
18
- * Brendan Eich <brendan@mozilla.org>.
19
- * Portions created by the Initial Developer are Copyright (C) 2004
20
- * the Initial Developer. All Rights Reserved.
21
- *
22
- * Contributor(s):
23
- * Tom Austin <taustin@ucsc.edu>
24
- * Brendan Eich <brendan@mozilla.org>
25
- * Shu-Yu Guo <shu@rfrn.org>
26
- * Dave Herman <dherman@mozilla.com>
27
- * Dimitris Vardoulakis <dimvar@ccs.neu.edu>
28
- * Patrick Walton <pcwalton@mozilla.com>
29
- *
30
- * Alternatively, the contents of this file may be used under the terms of
31
- * either the GNU General Public License Version 2 or later (the "GPL"), or
32
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
33
- * in which case the provisions of the GPL or the LGPL are applicable instead
34
- * of those above. If you wish to allow use of your version of this file only
35
- * under the terms of either the GPL or the LGPL, and not to allow others to
36
- * use your version of this file under the terms of the MPL, indicate your
37
- * decision by deleting the provisions above and replace them with the notice
38
- * and other provisions required by the GPL or the LGPL. If you do not delete
39
- * the provisions above, a recipient may use your version of this file under
40
- * the terms of any one of the MPL, the GPL or the LGPL.
41
- *
42
- * ***** END LICENSE BLOCK ***** */
43
-
44
- define(function(require, exports, module) {
45
-
46
- // Global variables to hide from the interpreter
47
- exports.hiddenHostGlobals = { Narcissus: true };
48
-
49
- // Desugar SpiderMonkey language extensions?
50
- exports.desugarExtensions = false;
51
-
52
- // Allow HTML comments?
53
- exports.allowHTMLComments = false;
54
-
55
- // Allow non-standard Mozilla extensions?
56
- exports.mozillaMode = true;
57
-
58
- // Allow experimental paren-free mode?
59
- exports.parenFreeMode = false;
60
-
61
- });
@@ -1,2072 +0,0 @@
1
- /* -*- Mode: JS; tab-width: 4; indent-tabs-mode: nil; -*-
2
- * vim: set sw=4 ts=4 et tw=78:
3
- * ***** BEGIN LICENSE BLOCK *****
4
- *
5
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6
- *
7
- * The contents of this file are subject to the Mozilla Public License Version
8
- * 1.1 (the "License"); you may not use this file except in compliance with
9
- * the License. You may obtain a copy of the License at
10
- * http://www.mozilla.org/MPL/
11
- *
12
- * Software distributed under the License is distributed on an "AS IS" basis,
13
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14
- * for the specific language governing rights and limitations under the
15
- * License.
16
- *
17
- * The Original Code is the Narcissus JavaScript engine.
18
- *
19
- * The Initial Developer of the Original Code is
20
- * Brendan Eich <brendan@mozilla.org>.
21
- * Portions created by the Initial Developer are Copyright (C) 2004
22
- * the Initial Developer. All Rights Reserved.
23
- *
24
- * Contributor(s):
25
- * Tom Austin <taustin@ucsc.edu>
26
- * Brendan Eich <brendan@mozilla.org>
27
- * Shu-Yu Guo <shu@rfrn.org>
28
- * Dave Herman <dherman@mozilla.com>
29
- * Dimitris Vardoulakis <dimvar@ccs.neu.edu>
30
- * Patrick Walton <pcwalton@mozilla.com>
31
- *
32
- * Alternatively, the contents of this file may be used under the terms of
33
- * either the GNU General Public License Version 2 or later (the "GPL"), or
34
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
35
- * in which case the provisions of the GPL or the LGPL are applicable instead
36
- * of those above. If you wish to allow use of your version of this file only
37
- * under the terms of either the GPL or the LGPL, and not to allow others to
38
- * use your version of this file under the terms of the MPL, indicate your
39
- * decision by deleting the provisions above and replace them with the notice
40
- * and other provisions required by the GPL or the LGPL. If you do not delete
41
- * the provisions above, a recipient may use your version of this file under
42
- * the terms of any one of the MPL, the GPL or the LGPL.
43
- *
44
- * ***** END LICENSE BLOCK ***** */
45
-
46
- /*
47
- * Narcissus - JS implemented in JS.
48
- *
49
- * Parser.
50
- */
51
-
52
- define(function(require, exports, module) {
53
-
54
- var lexer = require('./lexer');
55
- var definitions = require('./definitions');
56
- var options = require('./options');
57
- var Tokenizer = lexer.Tokenizer;
58
-
59
- var Dict = definitions.Dict;
60
- var Stack = definitions.Stack;
61
-
62
- // Set constants in the local scope.
63
- eval(definitions.consts);
64
-
65
- /*
66
- * pushDestructuringVarDecls :: (node, hoisting node) -> void
67
- *
68
- * Recursively add all destructured declarations to varDecls.
69
- */
70
- function pushDestructuringVarDecls(n, s) {
71
- for (var i in n) {
72
- var sub = n[i];
73
- if (sub.type === IDENTIFIER) {
74
- s.varDecls.push(sub);
75
- } else {
76
- pushDestructuringVarDecls(sub, s);
77
- }
78
- }
79
- }
80
-
81
- function Parser(tokenizer) {
82
- tokenizer.parser = this;
83
- this.t = tokenizer;
84
- this.x = null;
85
- this.unexpectedEOF = false;
86
- options.mozillaMode && (this.mozillaMode = true);
87
- options.parenFreeMode && (this.parenFreeMode = true);
88
- }
89
-
90
- function StaticContext(parentScript, parentBlock, inModule, inFunction, strictMode) {
91
- this.parentScript = parentScript;
92
- this.parentBlock = parentBlock || parentScript;
93
- this.inModule = inModule || false;
94
- this.inFunction = inFunction || false;
95
- this.inForLoopInit = false;
96
- this.topLevel = true;
97
- this.allLabels = new Stack();
98
- this.currentLabels = new Stack();
99
- this.labeledTargets = new Stack();
100
- this.defaultLoopTarget = null;
101
- this.defaultTarget = null;
102
- this.strictMode = strictMode;
103
- }
104
-
105
- StaticContext.prototype = {
106
- // non-destructive update via prototype extension
107
- update: function(ext) {
108
- var desc = {};
109
- for (var key in ext) {
110
- desc[key] = {
111
- value: ext[key],
112
- writable: true,
113
- enumerable: true,
114
- configurable: true
115
- }
116
- }
117
- return Object.create(this, desc);
118
- },
119
- pushLabel: function(label) {
120
- return this.update({ currentLabels: this.currentLabels.push(label),
121
- allLabels: this.allLabels.push(label) });
122
- },
123
- pushTarget: function(target) {
124
- var isDefaultLoopTarget = target.isLoop;
125
- var isDefaultTarget = isDefaultLoopTarget || target.type === SWITCH;
126
-
127
- if (this.currentLabels.isEmpty()) {
128
- if (isDefaultLoopTarget) this.update({ defaultLoopTarget: target });
129
- if (isDefaultTarget) this.update({ defaultTarget: target });
130
- return this;
131
- }
132
-
133
- target.labels = new Dict();
134
- this.currentLabels.forEach(function(label) {
135
- target.labels.set(label, true);
136
- });
137
- return this.update({ currentLabels: new Stack(),
138
- labeledTargets: this.labeledTargets.push(target),
139
- defaultLoopTarget: isDefaultLoopTarget
140
- ? target
141
- : this.defaultLoopTarget,
142
- defaultTarget: isDefaultTarget
143
- ? target
144
- : this.defaultTarget });
145
- },
146
- nest: function() {
147
- return this.topLevel ? this.update({ topLevel: false }) : this;
148
- },
149
- canImport: function() {
150
- return this.topLevel && !this.inFunction;
151
- },
152
- canExport: function() {
153
- return this.inModule && this.topLevel && !this.inFunction;
154
- },
155
- banWith: function() {
156
- return this.strictMode || this.inModule;
157
- },
158
- modulesAllowed: function() {
159
- return this.topLevel && !this.inFunction;
160
- }
161
- };
162
-
163
- var Pp = Parser.prototype;
164
-
165
- Pp.mozillaMode = false;
166
-
167
- Pp.parenFreeMode = false;
168
-
169
- Pp.withContext = function(x, f) {
170
- var x0 = this.x;
171
- this.x = x;
172
- var result = f.call(this);
173
- // NB: we don't bother with finally, since exceptions trash the parser
174
- this.x = x0;
175
- return result;
176
- };
177
-
178
- Pp.newNode = function newNode(opts) {
179
- return new Node(this.t, opts);
180
- };
181
-
182
- Pp.fail = function fail(msg) {
183
- throw this.t.newSyntaxError(msg);
184
- };
185
-
186
- Pp.match = function match(tt, scanOperand, keywordIsName) {
187
- return this.t.match(tt, scanOperand, keywordIsName);
188
- };
189
-
190
- Pp.mustMatch = function mustMatch(tt, keywordIsName) {
191
- return this.t.mustMatch(tt, keywordIsName);
192
- };
193
-
194
- Pp.peek = function peek(scanOperand) {
195
- return this.t.peek(scanOperand);
196
- };
197
-
198
- Pp.peekOnSameLine = function peekOnSameLine(scanOperand) {
199
- return this.t.peekOnSameLine(scanOperand);
200
- };
201
-
202
- Pp.done = function done() {
203
- return this.t.done;
204
- };
205
-
206
- /*
207
- * Script :: (boolean, boolean, boolean) -> node
208
- *
209
- * Parses the toplevel and module/function bodies.
210
- */
211
- Pp.Script = function Script(inModule, inFunction, expectEnd) {
212
- var node = this.newNode(scriptInit());
213
- var x2 = new StaticContext(node, node, inModule, inFunction);
214
- this.withContext(x2, function() {
215
- this.Statements(node, true);
216
- });
217
- if (expectEnd && !this.done())
218
- this.fail("expected end of input");
219
- return node;
220
- };
221
-
222
- /*
223
- * Pragma :: (expression statement node) -> boolean
224
- *
225
- * Checks whether a node is a pragma and annotates it.
226
- */
227
- function Pragma(n) {
228
- if (n.type === SEMICOLON) {
229
- var e = n.expression;
230
- if (e.type === STRING && e.value === "use strict") {
231
- n.pragma = "strict";
232
- return true;
233
- }
234
- }
235
- return false;
236
- }
237
-
238
- /*
239
- * Node :: (tokenizer, optional init object) -> node
240
- */
241
- function Node(t, init) {
242
- var token = t.token;
243
- if (token) {
244
- // If init.type exists it will override token.type.
245
- this.type = token.type;
246
- this.value = token.value;
247
- this.lineno = token.lineno;
248
-
249
- // Start and end are file positions for error handling.
250
- this.start = token.start;
251
- this.end = token.end;
252
- } else {
253
- this.lineno = t.lineno;
254
- }
255
-
256
- this.filename = t.filename;
257
- this.children = [];
258
-
259
- for (var prop in init)
260
- this[prop] = init[prop];
261
- }
262
-
263
- /*
264
- * SyntheticNode :: (optional init object) -> node
265
- */
266
- function SyntheticNode(init) {
267
- this.children = [];
268
- for (var prop in init)
269
- this[prop] = init[prop];
270
- this.synthetic = true;
271
- }
272
-
273
- var Np = Node.prototype = SyntheticNode.prototype = {};
274
- Np.constructor = Node;
275
-
276
- var TO_SOURCE_SKIP = {
277
- type: true,
278
- value: true,
279
- lineno: true,
280
- start: true,
281
- end: true,
282
- tokenizer: true,
283
- assignOp: true
284
- };
285
- function unevalableConst(code) {
286
- var token = definitions.tokens[code];
287
- var constName = definitions.opTypeNames.hasOwnProperty(token)
288
- ? definitions.opTypeNames[token]
289
- : token in definitions.keywords
290
- ? token.toUpperCase()
291
- : token;
292
- return { toSource: function() { return constName } };
293
- }
294
- Np.toSource = function toSource() {
295
- var mock = {};
296
- var self = this;
297
- mock.type = unevalableConst(this.type);
298
- // avoid infinite recursion in case of back-links
299
- if (this.generatingSource)
300
- return mock.toSource();
301
- this.generatingSource = true;
302
- if ("value" in this)
303
- mock.value = this.value;
304
- if ("lineno" in this)
305
- mock.lineno = this.lineno;
306
- if ("start" in this)
307
- mock.start = this.start;
308
- if ("end" in this)
309
- mock.end = this.end;
310
- if (this.assignOp)
311
- mock.assignOp = unevalableConst(this.assignOp);
312
- for (var key in this) {
313
- if (this.hasOwnProperty(key) && !(key in TO_SOURCE_SKIP))
314
- mock[key] = this[key];
315
- }
316
- try {
317
- return mock.toSource();
318
- } finally {
319
- delete this.generatingSource;
320
- }
321
- };
322
-
323
- // Always use push to add operands to an expression, to update start and end.
324
- Np.push = function (kid) {
325
- // kid can be null e.g. [1, , 2].
326
- if (kid !== null) {
327
- if (kid.start < this.start)
328
- this.start = kid.start;
329
- if (this.end < kid.end)
330
- this.end = kid.end;
331
- }
332
- return this.children.push(kid);
333
- }
334
-
335
- Node.indentLevel = 0;
336
-
337
- function tokenString(tt) {
338
- var t = definitions.tokens[tt];
339
- return /^\W/.test(t) ? definitions.opTypeNames[t] : t.toUpperCase();
340
- }
341
-
342
- Np.toString = function () {
343
- var a = [];
344
- for (var i in this) {
345
- if (this.hasOwnProperty(i) && i !== 'type' && i !== 'target')
346
- a.push({id: i, value: this[i]});
347
- }
348
- a.sort(function (a,b) { return (a.id < b.id) ? -1 : 1; });
349
- var INDENTATION = " ";
350
- var n = ++Node.indentLevel;
351
- var s = "{\n" + INDENTATION.repeat(n) + "type: " + tokenString(this.type);
352
- for (i = 0; i < a.length; i++)
353
- s += ",\n" + INDENTATION.repeat(n) + a[i].id + ": " + a[i].value;
354
- n = --Node.indentLevel;
355
- s += "\n" + INDENTATION.repeat(n) + "}";
356
- return s;
357
- }
358
-
359
- Np.synth = function(init) {
360
- var node = new SyntheticNode(init);
361
- node.filename = this.filename;
362
- node.lineno = this.lineno;
363
- node.start = this.start;
364
- node.end = this.end;
365
- return node;
366
- };
367
-
368
- /*
369
- * Helper init objects for common nodes.
370
- */
371
-
372
- var LOOP_INIT = { isLoop: true };
373
-
374
- function blockInit() {
375
- return { type: BLOCK, varDecls: [] };
376
- }
377
-
378
- function scriptInit() {
379
- return { type: SCRIPT,
380
- funDecls: [],
381
- varDecls: [],
382
- modDefns: new Dict(),
383
- modAssns: new Dict(),
384
- modDecls: new Dict(),
385
- modLoads: new Dict(),
386
- impDecls: [],
387
- expDecls: [],
388
- exports: new Dict(),
389
- hasEmptyReturn: false,
390
- hasReturnWithValue: false,
391
- hasYield: false };
392
- }
393
-
394
- definitions.defineGetter(Np, "length",
395
- function() {
396
- throw new Error("Node.prototype.length is gone; " +
397
- "use n.children.length instead");
398
- });
399
-
400
- definitions.defineProperty(String.prototype, "repeat",
401
- function(n) {
402
- var s = "", t = this + s;
403
- while (--n >= 0)
404
- s += t;
405
- return s;
406
- }, false, false, true);
407
-
408
- Pp.MaybeLeftParen = function MaybeLeftParen() {
409
- if (this.parenFreeMode)
410
- return this.match(LEFT_PAREN) ? LEFT_PAREN : END;
411
- return this.mustMatch(LEFT_PAREN).type;
412
- };
413
-
414
- Pp.MaybeRightParen = function MaybeRightParen(p) {
415
- if (p === LEFT_PAREN)
416
- this.mustMatch(RIGHT_PAREN);
417
- }
418
-
419
- /*
420
- * Statements :: (node[, boolean]) -> void
421
- *
422
- * Parses a sequence of Statements.
423
- */
424
- Pp.Statements = function Statements(n, topLevel) {
425
- var prologue = !!topLevel;
426
- try {
427
- while (!this.done() && this.peek(true) !== RIGHT_CURLY) {
428
- var n2 = this.Statement();
429
- n.push(n2);
430
- if (prologue && Pragma(n2)) {
431
- this.x.strictMode = true;
432
- n.strict = true;
433
- } else {
434
- prologue = false;
435
- }
436
- }
437
- } catch (e) {
438
- try {
439
- if (this.done())
440
- this.unexpectedEOF = true;
441
- } catch(e) {}
442
- throw e;
443
- }
444
- }
445
-
446
- Pp.Block = function Block() {
447
- this.mustMatch(LEFT_CURLY);
448
- var n = this.newNode(blockInit());
449
- var x2 = this.x.update({ parentBlock: n }).pushTarget(n);
450
- this.withContext(x2, function() {
451
- this.Statements(n);
452
- });
453
- this.mustMatch(RIGHT_CURLY);
454
- return n;
455
- }
456
-
457
- var DECLARED_FORM = 0, EXPRESSED_FORM = 1, STATEMENT_FORM = 2;
458
-
459
- /*
460
- * Export :: (binding node, boolean) -> Export
461
- *
462
- * Static semantic representation of a module export.
463
- */
464
- function Export(node, isDefinition) {
465
- this.node = node; // the AST node declaring this individual export
466
- this.isDefinition = isDefinition; // is the node an 'export'-annotated definition?
467
- this.resolved = null; // resolved pointer to the target of this export
468
- }
469
-
470
- /*
471
- * registerExport :: (Dict, EXPORT node) -> void
472
- */
473
- function registerExport(exports, decl) {
474
- function register(name, exp) {
475
- if (exports.has(name))
476
- throw new SyntaxError("multiple exports of " + name);
477
- exports.set(name, exp);
478
- }
479
-
480
- switch (decl.type) {
481
- case MODULE:
482
- case FUNCTION:
483
- register(decl.name, new Export(decl, true));
484
- break;
485
-
486
- case VAR:
487
- for (var i = 0; i < decl.children.length; i++)
488
- register(decl.children[i].name, new Export(decl.children[i], true));
489
- break;
490
-
491
- case LET:
492
- case CONST:
493
- throw new Error("NYI: " + definitions.tokens[decl.type]);
494
-
495
- case EXPORT:
496
- for (var i = 0; i < decl.pathList.length; i++) {
497
- var path = decl.pathList[i];
498
- switch (path.type) {
499
- case OBJECT_INIT:
500
- for (var j = 0; j < path.children.length; j++) {
501
- // init :: IDENTIFIER | PROPERTY_INIT
502
- var init = path.children[j];
503
- if (init.type === IDENTIFIER)
504
- register(init.value, new Export(init, false));
505
- else
506
- register(init.children[0].value, new Export(init.children[1], false));
507
- }
508
- break;
509
-
510
- case DOT:
511
- register(path.children[1].value, new Export(path, false));
512
- break;
513
-
514
- case IDENTIFIER:
515
- register(path.value, new Export(path, false));
516
- break;
517
-
518
- default:
519
- throw new Error("unexpected export path: " + definitions.tokens[path.type]);
520
- }
521
- }
522
- break;
523
-
524
- default:
525
- throw new Error("unexpected export decl: " + definitions.tokens[exp.type]);
526
- }
527
- }
528
-
529
- /*
530
- * Module :: (node) -> Module
531
- *
532
- * Static semantic representation of a module.
533
- */
534
- function Module(node) {
535
- var exports = node.body.exports;
536
- var modDefns = node.body.modDefns;
537
-
538
- var exportedModules = new Dict();
539
-
540
- exports.forEach(function(name, exp) {
541
- var node = exp.node;
542
- if (node.type === MODULE) {
543
- exportedModules.set(name, node);
544
- } else if (!exp.isDefinition && node.type === IDENTIFIER && modDefns.has(node.value)) {
545
- var mod = modDefns.get(node.value);
546
- exportedModules.set(name, mod);
547
- }
548
- });
549
-
550
- this.node = node;
551
- this.exports = exports;
552
- this.exportedModules = exportedModules;
553
- }
554
-
555
- /*
556
- * Statement :: () -> node
557
- *
558
- * Parses a Statement.
559
- */
560
- Pp.Statement = function Statement() {
561
- var i, label, n, n2, p, c, ss, tt = this.t.get(true), tt2, x0, x2, x3;
562
-
563
- var comments = this.t.blockComments;
564
-
565
- // Cases for statements ending in a right curly return early, avoiding the
566
- // common semicolon insertion magic after this switch.
567
- switch (tt) {
568
- case IMPORT:
569
- if (!this.x.canImport())
570
- this.fail("illegal context for import statement");
571
- n = this.newNode();
572
- n.pathList = this.ImportPathList();
573
- this.x.parentScript.impDecls.push(n);
574
- break;
575
-
576
- case EXPORT:
577
- if (!this.x.canExport())
578
- this.fail("export statement not in module top level");
579
- switch (this.peek()) {
580
- case MODULE:
581
- case FUNCTION:
582
- case LET:
583
- case VAR:
584
- case CONST:
585
- n = this.Statement();
586
- n.blockComments = comments;
587
- n.exported = true;
588
- this.x.parentScript.expDecls.push(n);
589
- registerExport(this.x.parentScript.exports, n);
590
- return n;
591
- }
592
- n = this.newNode();
593
- n.pathList = this.ExportPathList();
594
- this.x.parentScript.expDecls.push(n);
595
- registerExport(this.x.parentScript.exports, n);
596
- break;
597
-
598
- case FUNCTION:
599
- // DECLARED_FORM extends funDecls of x, STATEMENT_FORM doesn't.
600
- return this.FunctionDefinition(true, this.x.topLevel ? DECLARED_FORM : STATEMENT_FORM, comments);
601
-
602
- case LEFT_CURLY:
603
- n = this.newNode(blockInit());
604
- x2 = this.x.update({ parentBlock: n }).pushTarget(n).nest();
605
- this.withContext(x2, function() {
606
- this.Statements(n);
607
- });
608
- this.mustMatch(RIGHT_CURLY);
609
- return n;
610
-
611
- case IF:
612
- n = this.newNode();
613
- n.condition = this.HeadExpression();
614
- x2 = this.x.pushTarget(n).nest();
615
- this.withContext(x2, function() {
616
- n.thenPart = this.Statement();
617
- n.elsePart = this.match(ELSE, true) ? this.Statement() : null;
618
- });
619
- return n;
620
-
621
- case SWITCH:
622
- // This allows CASEs after a DEFAULT, which is in the standard.
623
- n = this.newNode({ cases: [], defaultIndex: -1 });
624
- n.discriminant = this.HeadExpression();
625
- x2 = this.x.pushTarget(n).nest();
626
- this.withContext(x2, function() {
627
- this.mustMatch(LEFT_CURLY);
628
- while ((tt = this.t.get()) !== RIGHT_CURLY) {
629
- switch (tt) {
630
- case DEFAULT:
631
- if (n.defaultIndex >= 0)
632
- this.fail("More than one switch default");
633
- // FALL THROUGH
634
- case CASE:
635
- n2 = this.newNode();
636
- if (tt === DEFAULT)
637
- n.defaultIndex = n.cases.length;
638
- else
639
- n2.caseLabel = this.Expression(COLON);
640
- break;
641
-
642
- default:
643
- this.fail("Invalid switch case");
644
- }
645
- this.mustMatch(COLON);
646
- n2.statements = this.newNode(blockInit());
647
- while ((tt=this.peek(true)) !== CASE && tt !== DEFAULT &&
648
- tt !== RIGHT_CURLY)
649
- n2.statements.push(this.Statement());
650
- n.cases.push(n2);
651
- }
652
- });
653
- return n;
654
-
655
- case FOR:
656
- n = this.newNode(LOOP_INIT);
657
- n.blockComments = comments;
658
- if (this.match(IDENTIFIER)) {
659
- if (this.t.token.value === "each")
660
- n.isEach = true;
661
- else
662
- this.t.unget();
663
- }
664
- if (!this.parenFreeMode)
665
- this.mustMatch(LEFT_PAREN);
666
- x2 = this.x.pushTarget(n).nest();
667
- x3 = this.x.update({ inForLoopInit: true });
668
- n2 = null;
669
- if ((tt = this.peek(true)) !== SEMICOLON) {
670
- this.withContext(x3, function() {
671
- if (tt === VAR || tt === CONST) {
672
- this.t.get();
673
- n2 = this.Variables();
674
- } else if (tt === LET) {
675
- this.t.get();
676
- if (this.peek() === LEFT_PAREN) {
677
- n2 = this.LetBlock(false);
678
- } else {
679
- // Let in for head, we need to add an implicit block
680
- // around the rest of the for.
681
- this.x.parentBlock = n;
682
- n.varDecls = [];
683
- n2 = this.Variables();
684
- }
685
- } else {
686
- n2 = this.Expression();
687
- }
688
- });
689
- }
690
- if (n2 && this.match(IN)) {
691
- n.type = FOR_IN;
692
- this.withContext(x3, function() {
693
- n.object = this.Expression();
694
- if (n2.type === VAR || n2.type === LET) {
695
- c = n2.children;
696
-
697
- // Destructuring turns one decl into multiples, so either
698
- // there must be only one destructuring or only one
699
- // decl.
700
- if (c.length !== 1 && n2.destructurings.length !== 1) {
701
- // FIXME: this.fail ?
702
- throw new SyntaxError("Invalid for..in left-hand side",
703
- this.filename, n2.lineno);
704
- }
705
- if (n2.destructurings.length > 0) {
706
- n.iterator = n2.destructurings[0];
707
- } else {
708
- n.iterator = c[0];
709
- }
710
- n.varDecl = n2;
711
- } else {
712
- if (n2.type === ARRAY_INIT || n2.type === OBJECT_INIT) {
713
- n2.destructuredNames = this.checkDestructuring(n2);
714
- }
715
- n.iterator = n2;
716
- }
717
- });
718
- } else {
719
- x3.inForLoopInit = false;
720
- n.setup = n2;
721
- this.mustMatch(SEMICOLON);
722
- if (n.isEach)
723
- this.fail("Invalid for each..in loop");
724
- this.withContext(x3, function() {
725
- n.condition = (this.peek(true) === SEMICOLON)
726
- ? null
727
- : this.Expression();
728
- this.mustMatch(SEMICOLON);
729
- tt2 = this.peek(true);
730
- n.update = (this.parenFreeMode
731
- ? tt2 === LEFT_CURLY || definitions.isStatementStartCode[tt2]
732
- : tt2 === RIGHT_PAREN)
733
- ? null
734
- : this.Expression();
735
- });
736
- }
737
- if (!this.parenFreeMode)
738
- this.mustMatch(RIGHT_PAREN);
739
- this.withContext(x2, function() {
740
- n.body = this.Statement();
741
- });
742
- return n;
743
-
744
- case WHILE:
745
- n = this.newNode({ isLoop: true });
746
- n.blockComments = comments;
747
- n.condition = this.HeadExpression();
748
- x2 = this.x.pushTarget(n).nest();
749
- this.withContext(x2, function() {
750
- n.body = this.Statement();
751
- });
752
- return n;
753
-
754
- case DO:
755
- n = this.newNode({ isLoop: true });
756
- n.blockComments = comments;
757
- x2 = this.x.pushTarget(n).next();
758
- this.withContext(x2, function() {
759
- n.body = this.Statement();
760
- });
761
- this.mustMatch(WHILE);
762
- n.condition = this.HeadExpression();
763
- // <script language="JavaScript"> (without version hints) may need
764
- // automatic semicolon insertion without a newline after do-while.
765
- // See http://bugzilla.mozilla.org/show_bug.cgi?id=238945.
766
- this.match(SEMICOLON);
767
- return n;
768
-
769
- case BREAK:
770
- case CONTINUE:
771
- n = this.newNode();
772
- n.blockComments = comments;
773
-
774
- // handle the |foo: break foo;| corner case
775
- x2 = this.x.pushTarget(n);
776
-
777
- if (this.peekOnSameLine() === IDENTIFIER) {
778
- this.t.get();
779
- n.label = this.t.token.value;
780
- }
781
-
782
- if (n.label) {
783
- n.target = x2.labeledTargets.find(function(target) {
784
- return target.labels.has(n.label)
785
- });
786
- } else if (tt === CONTINUE) {
787
- n.target = x2.defaultLoopTarget;
788
- } else {
789
- n.target = x2.defaultTarget;
790
- }
791
-
792
- if (!n.target)
793
- this.fail("Invalid " + ((tt === BREAK) ? "break" : "continue"));
794
- if (!n.target.isLoop && tt === CONTINUE)
795
- this.fail("Invalid continue");
796
-
797
- break;
798
-
799
- case TRY:
800
- n = this.newNode({ catchClauses: [] });
801
- n.blockComments = comments;
802
- n.tryBlock = this.Block();
803
- while (this.match(CATCH)) {
804
- n2 = this.newNode();
805
- p = this.MaybeLeftParen();
806
- switch (this.t.get()) {
807
- case LEFT_BRACKET:
808
- case LEFT_CURLY:
809
- // Destructured catch identifiers.
810
- this.t.unget();
811
- n2.varName = this.DestructuringExpression(true);
812
- break;
813
- case IDENTIFIER:
814
- n2.varName = this.t.token.value;
815
- break;
816
- default:
817
- this.fail("missing identifier in catch");
818
- break;
819
- }
820
- if (this.match(IF)) {
821
- if (!this.mozillaMode)
822
- this.fail("Illegal catch guard");
823
- if (n.catchClauses.length && !n.catchClauses.top().guard)
824
- this.fail("Guarded catch after unguarded");
825
- n2.guard = this.Expression();
826
- }
827
- this.MaybeRightParen(p);
828
- n2.block = this.Block();
829
- n.catchClauses.push(n2);
830
- }
831
- if (this.match(FINALLY))
832
- n.finallyBlock = this.Block();
833
- if (!n.catchClauses.length && !n.finallyBlock)
834
- this.fail("Invalid try statement");
835
- return n;
836
-
837
- case CATCH:
838
- case FINALLY:
839
- this.fail(definitions.tokens[tt] + " without preceding try");
840
-
841
- case THROW:
842
- n = this.newNode();
843
- n.exception = this.Expression();
844
- break;
845
-
846
- case RETURN:
847
- n = this.ReturnOrYield();
848
- break;
849
-
850
- case WITH:
851
- if (this.x.banWith())
852
- this.fail("with statements not allowed in strict code or modules");
853
- n = this.newNode();
854
- n.blockComments = comments;
855
- n.object = this.HeadExpression();
856
- x2 = this.x.pushTarget(n).next();
857
- this.withContext(x2, function() {
858
- n.body = this.Statement();
859
- });
860
- return n;
861
-
862
- case VAR:
863
- case CONST:
864
- n = this.Variables();
865
- break;
866
-
867
- case LET:
868
- if (this.peek() === LEFT_PAREN) {
869
- n = this.LetBlock(true);
870
- return n;
871
- }
872
- n = this.Variables();
873
- break;
874
-
875
- case DEBUGGER:
876
- n = this.newNode();
877
- break;
878
-
879
- case NEWLINE:
880
- case SEMICOLON:
881
- n = this.newNode({ type: SEMICOLON });
882
- n.blockComments = comments;
883
- n.expression = null;
884
- return n;
885
-
886
- case IDENTIFIER:
887
- case USE:
888
- case MODULE:
889
- switch (this.t.token.value) {
890
- case "use":
891
- if (!isPragmaToken(this.peekOnSameLine())) {
892
- this.t.unget();
893
- break;
894
- }
895
- return this.newNode({ type: USE, params: this.Pragmas() });
896
-
897
- case "module":
898
- if (!this.x.modulesAllowed())
899
- this.fail("module declaration not at top level");
900
- this.x.parentScript.hasModules = true;
901
- tt = this.peekOnSameLine();
902
- if (tt !== IDENTIFIER && tt !== LEFT_CURLY) {
903
- this.t.unget();
904
- break;
905
- }
906
- n = this.newNode({ type: MODULE });
907
- n.blockComments = comments;
908
- this.mustMatch(IDENTIFIER);
909
- label = this.t.token.value;
910
-
911
- if (this.match(LEFT_CURLY)) {
912
- n.name = label;
913
- n.body = this.Script(true, false);
914
- n.module = new Module(n);
915
- this.mustMatch(RIGHT_CURLY);
916
- this.x.parentScript.modDefns.set(n.name, n);
917
- return n;
918
- }
919
-
920
- this.t.unget();
921
- this.ModuleVariables(n);
922
- return n;
923
-
924
- default:
925
- tt = this.peek();
926
- // Labeled statement.
927
- if (tt === COLON) {
928
- label = this.t.token.value;
929
- if (this.x.allLabels.has(label))
930
- this.fail("Duplicate label: " + label);
931
- this.t.get();
932
- n = this.newNode({ type: LABEL, label: label });
933
- n.blockComments = comments;
934
- x2 = this.x.pushLabel(label).nest();
935
- this.withContext(x2, function() {
936
- n.statement = this.Statement();
937
- });
938
- n.target = (n.statement.type === LABEL) ? n.statement.target : n.statement;
939
- return n;
940
- }
941
- // FALL THROUGH
942
- }
943
- // FALL THROUGH
944
-
945
- default:
946
- // Expression statement.
947
- // We unget the current token to parse the expression as a whole.
948
- n = this.newNode({ type: SEMICOLON });
949
- this.t.unget();
950
- n.blockComments = comments;
951
- n.expression = this.Expression();
952
- n.end = n.expression.end;
953
- break;
954
- }
955
-
956
- n.blockComments = comments;
957
- this.MagicalSemicolon();
958
- return n;
959
- }
960
-
961
- /*
962
- * isPragmaToken :: (number) -> boolean
963
- */
964
- function isPragmaToken(tt) {
965
- switch (tt) {
966
- case IDENTIFIER:
967
- case STRING:
968
- case NUMBER:
969
- case NULL:
970
- case TRUE:
971
- case FALSE:
972
- return true;
973
- }
974
- return false;
975
- }
976
-
977
- /*
978
- * Pragmas :: () -> Array[Array[token]]
979
- */
980
- Pp.Pragmas = function Pragmas() {
981
- var pragmas = [];
982
- do {
983
- pragmas.push(this.Pragma());
984
- } while (this.match(COMMA));
985
- this.MagicalSemicolon();
986
- return pragmas;
987
- }
988
-
989
- /*
990
- * Pragmas :: () -> Array[token]
991
- */
992
- Pp.Pragma = function Pragma() {
993
- var items = [];
994
- var tt;
995
- do {
996
- tt = this.t.get(true);
997
- items.push(this.t.token);
998
- } while (isPragmaToken(this.peek()));
999
- return items;
1000
- }
1001
-
1002
- /*
1003
- * MagicalSemicolon :: () -> void
1004
- */
1005
- Pp.MagicalSemicolon = function MagicalSemicolon() {
1006
- var tt;
1007
- if (this.t.lineno === this.t.token.lineno) {
1008
- tt = this.peekOnSameLine();
1009
- if (tt !== END && tt !== NEWLINE && tt !== SEMICOLON && tt !== RIGHT_CURLY)
1010
- this.fail("missing ; before statement");
1011
- }
1012
- this.match(SEMICOLON);
1013
- }
1014
-
1015
- /*
1016
- * ReturnOrYield :: () -> (RETURN | YIELD) node
1017
- */
1018
- Pp.ReturnOrYield = function ReturnOrYield() {
1019
- var n, b, tt = this.t.token.type, tt2;
1020
-
1021
- var parentScript = this.x.parentScript;
1022
-
1023
- if (tt === RETURN) {
1024
- if (!this.x.inFunction)
1025
- this.fail("Return not in function");
1026
- } else /* if (tt === YIELD) */ {
1027
- if (!this.x.inFunction)
1028
- this.fail("Yield not in function");
1029
- parentScript.hasYield = true;
1030
- }
1031
- n = this.newNode({ value: undefined });
1032
-
1033
- tt2 = (tt === RETURN) ? this.peekOnSameLine(true) : this.peek(true);
1034
- if (tt2 !== END && tt2 !== NEWLINE &&
1035
- tt2 !== SEMICOLON && tt2 !== RIGHT_CURLY
1036
- && (tt !== YIELD ||
1037
- (tt2 !== tt && tt2 !== RIGHT_BRACKET && tt2 !== RIGHT_PAREN &&
1038
- tt2 !== COLON && tt2 !== COMMA))) {
1039
- if (tt === RETURN) {
1040
- n.value = this.Expression();
1041
- parentScript.hasReturnWithValue = true;
1042
- } else {
1043
- n.value = this.AssignExpression();
1044
- }
1045
- } else if (tt === RETURN) {
1046
- parentScript.hasEmptyReturn = true;
1047
- }
1048
-
1049
- return n;
1050
- }
1051
-
1052
- /*
1053
- * ModuleExpression :: () -> (STRING | IDENTIFIER | DOT) node
1054
- */
1055
- Pp.ModuleExpression = function ModuleExpression() {
1056
- return this.match(STRING) ? this.newNode() : this.QualifiedPath();
1057
- }
1058
-
1059
- /*
1060
- * ImportPathList :: () -> Array[DOT node]
1061
- */
1062
- Pp.ImportPathList = function ImportPathList() {
1063
- var a = [];
1064
- do {
1065
- a.push(this.ImportPath());
1066
- } while (this.match(COMMA));
1067
- return a;
1068
- }
1069
-
1070
- /*
1071
- * ImportPath :: () -> DOT node
1072
- */
1073
- Pp.ImportPath = function ImportPath() {
1074
- var n = this.QualifiedPath();
1075
- if (!this.match(DOT)) {
1076
- if (n.type === IDENTIFIER)
1077
- this.fail("cannot import local variable");
1078
- return n;
1079
- }
1080
-
1081
- var n2 = this.newNode();
1082
- n2.push(n);
1083
- n2.push(this.ImportSpecifierSet());
1084
- return n2;
1085
- }
1086
-
1087
- /*
1088
- * ExplicitSpecifierSet :: (() -> node) -> OBJECT_INIT node
1089
- */
1090
- Pp.ExplicitSpecifierSet = function ExplicitSpecifierSet(SpecifierRHS) {
1091
- var n, n2, id, tt;
1092
-
1093
- n = this.newNode({ type: OBJECT_INIT });
1094
- this.mustMatch(LEFT_CURLY);
1095
-
1096
- if (!this.match(RIGHT_CURLY)) {
1097
- do {
1098
- id = this.Identifier();
1099
- if (this.match(COLON)) {
1100
- n2 = this.newNode({ type: PROPERTY_INIT });
1101
- n2.push(id);
1102
- n2.push(SpecifierRHS());
1103
- n.push(n2);
1104
- } else {
1105
- n.push(id);
1106
- }
1107
- } while (!this.match(RIGHT_CURLY) && this.mustMatch(COMMA));
1108
- }
1109
-
1110
- return n;
1111
- }
1112
-
1113
- /*
1114
- * ImportSpecifierSet :: () -> (IDENTIFIER | OBJECT_INIT) node
1115
- */
1116
- Pp.ImportSpecifierSet = function ImportSpecifierSet() {
1117
- var self = this;
1118
- return this.match(MUL)
1119
- ? this.newNode({ type: IDENTIFIER, name: "*" })
1120
- : ExplicitSpecifierSet(function() { return self.Identifier() });
1121
- }
1122
-
1123
- /*
1124
- * Identifier :: () -> IDENTIFIER node
1125
- */
1126
- Pp.Identifier = function Identifier() {
1127
- this.mustMatch(IDENTIFIER);
1128
- return this.newNode({ type: IDENTIFIER });
1129
- }
1130
-
1131
- /*
1132
- * IdentifierName :: () -> IDENTIFIER node
1133
- */
1134
- Pp.IdentifierName = function IdentifierName() {
1135
- this.mustMatch(IDENTIFIER, true);
1136
- return this.newNode({ type: IDENTIFIER });
1137
- }
1138
-
1139
- /*
1140
- * QualifiedPath :: () -> (IDENTIFIER | DOT) node
1141
- */
1142
- Pp.QualifiedPath = function QualifiedPath() {
1143
- var n, n2;
1144
-
1145
- n = this.Identifier();
1146
-
1147
- while (this.match(DOT)) {
1148
- if (this.peek() !== IDENTIFIER) {
1149
- // Unget the '.' token, which isn't part of the QualifiedPath.
1150
- this.t.unget();
1151
- break;
1152
- }
1153
- n2 = this.newNode();
1154
- n2.push(n);
1155
- n2.push(this.Identifier());
1156
- n = n2;
1157
- }
1158
-
1159
- return n;
1160
- }
1161
-
1162
- /*
1163
- * ExportPath :: () -> (IDENTIFIER | DOT | OBJECT_INIT) node
1164
- */
1165
- Pp.ExportPath = function ExportPath() {
1166
- var self = this;
1167
- if (this.peek() === LEFT_CURLY)
1168
- return this.ExplicitSpecifierSet(function() { return self.QualifiedPath() });
1169
- return this.QualifiedPath();
1170
- }
1171
-
1172
- /*
1173
- * ExportPathList :: () -> Array[(IDENTIFIER | DOT | OBJECT_INIT) node]
1174
- */
1175
- Pp.ExportPathList = function ExportPathList() {
1176
- var a = [];
1177
- do {
1178
- a.push(this.ExportPath());
1179
- } while (this.match(COMMA));
1180
- return a;
1181
- }
1182
-
1183
- /*
1184
- * FunctionDefinition :: (boolean,
1185
- * DECLARED_FORM or EXPRESSED_FORM or STATEMENT_FORM,
1186
- * [string] or null or undefined)
1187
- * -> node
1188
- */
1189
- Pp.FunctionDefinition = function FunctionDefinition(requireName, functionForm, comments) {
1190
- var tt;
1191
- var f = this.newNode({ params: [], paramComments: [] });
1192
- if (typeof comments === "undefined")
1193
- comments = null;
1194
- f.blockComments = comments;
1195
- if (f.type !== FUNCTION)
1196
- f.type = (f.value === "get") ? GETTER : SETTER;
1197
- if (this.match(MUL))
1198
- f.isExplicitGenerator = true;
1199
- if (this.match(IDENTIFIER, false, true))
1200
- f.name = this.t.token.value;
1201
- else if (requireName)
1202
- this.fail("missing function identifier");
1203
-
1204
- var inModule = this.x.inModule;
1205
- x2 = new StaticContext(null, null, inModule, true, this.x.strictMode);
1206
- this.withContext(x2, function() {
1207
- this.mustMatch(LEFT_PAREN);
1208
- if (!this.match(RIGHT_PAREN)) {
1209
- do {
1210
- tt = this.t.get();
1211
- f.paramComments.push(this.t.lastBlockComment());
1212
- switch (tt) {
1213
- case LEFT_BRACKET:
1214
- case LEFT_CURLY:
1215
- // Destructured formal parameters.
1216
- this.t.unget();
1217
- f.params.push(this.DestructuringExpression());
1218
- break;
1219
- case IDENTIFIER:
1220
- f.params.push(this.t.token.value);
1221
- break;
1222
- default:
1223
- this.fail("missing formal parameter");
1224
- }
1225
- } while (this.match(COMMA));
1226
- this.mustMatch(RIGHT_PAREN);
1227
- }
1228
-
1229
- // Do we have an expression closure or a normal body?
1230
- tt = this.t.get(true);
1231
- if (tt !== LEFT_CURLY)
1232
- this.t.unget();
1233
-
1234
- if (tt !== LEFT_CURLY) {
1235
- f.body = this.AssignExpression();
1236
- } else {
1237
- f.body = this.Script(inModule, true);
1238
- }
1239
- });
1240
-
1241
- if (tt === LEFT_CURLY)
1242
- this.mustMatch(RIGHT_CURLY);
1243
-
1244
- f.end = this.t.token.end;
1245
- f.functionForm = functionForm;
1246
- if (functionForm === DECLARED_FORM)
1247
- this.x.parentScript.funDecls.push(f);
1248
-
1249
- if (this.x.inModule && !f.isExplicitGenerator && f.body.hasYield)
1250
- this.fail("yield in non-generator function");
1251
-
1252
- if (f.isExplicitGenerator || f.body.hasYield)
1253
- f.body = this.newNode({ type: GENERATOR, body: f.body });
1254
-
1255
- return f;
1256
- }
1257
-
1258
- /*
1259
- * ModuleVariables :: (MODULE node) -> void
1260
- *
1261
- * Parses a comma-separated list of module declarations (and maybe
1262
- * initializations).
1263
- */
1264
- Pp.ModuleVariables = function ModuleVariables(n) {
1265
- var n1, n2;
1266
- do {
1267
- n1 = this.Identifier();
1268
- if (this.match(ASSIGN)) {
1269
- n2 = this.ModuleExpression();
1270
- n1.initializer = n2;
1271
- if (n2.type === STRING)
1272
- this.x.parentScript.modLoads.set(n1.value, n2.value);
1273
- else
1274
- this.x.parentScript.modAssns.set(n1.value, n1);
1275
- }
1276
- n.push(n1);
1277
- } while (this.match(COMMA));
1278
- }
1279
-
1280
- /*
1281
- * Variables :: () -> node
1282
- *
1283
- * Parses a comma-separated list of var declarations (and maybe
1284
- * initializations).
1285
- */
1286
- Pp.Variables = function Variables(letBlock) {
1287
- var n, n2, ss, i, s, tt;
1288
-
1289
- tt = this.t.token.type;
1290
- switch (tt) {
1291
- case VAR:
1292
- case CONST:
1293
- s = this.x.parentScript;
1294
- break;
1295
- case LET:
1296
- s = this.x.parentBlock;
1297
- break;
1298
- case LEFT_PAREN:
1299
- tt = LET;
1300
- s = letBlock;
1301
- break;
1302
- }
1303
-
1304
- n = this.newNode({ type: tt, destructurings: [] });
1305
-
1306
- do {
1307
- tt = this.t.get();
1308
- if (tt === LEFT_BRACKET || tt === LEFT_CURLY) {
1309
- // Need to unget to parse the full destructured expression.
1310
- this.t.unget();
1311
-
1312
- var dexp = this.DestructuringExpression(true);
1313
-
1314
- n2 = this.newNode({ type: IDENTIFIER,
1315
- name: dexp,
1316
- readOnly: n.type === CONST });
1317
- n.push(n2);
1318
- pushDestructuringVarDecls(n2.name.destructuredNames, s);
1319
- n.destructurings.push({ exp: dexp, decl: n2 });
1320
-
1321
- if (this.x.inForLoopInit && this.peek() === IN) {
1322
- continue;
1323
- }
1324
-
1325
- this.mustMatch(ASSIGN);
1326
- if (this.t.token.assignOp)
1327
- this.fail("Invalid variable initialization");
1328
-
1329
- n2.blockComment = this.t.lastBlockComment();
1330
- n2.initializer = this.AssignExpression();
1331
-
1332
- continue;
1333
- }
1334
-
1335
- if (tt !== IDENTIFIER)
1336
- this.fail("missing variable name");
1337
-
1338
- n2 = this.newNode({ type: IDENTIFIER,
1339
- name: this.t.token.value,
1340
- readOnly: n.type === CONST });
1341
- n.push(n2);
1342
- s.varDecls.push(n2);
1343
-
1344
- if (this.match(ASSIGN)) {
1345
- var comment = this.t.lastBlockComment();
1346
- if (this.t.token.assignOp)
1347
- this.fail("Invalid variable initialization");
1348
-
1349
- n2.initializer = this.AssignExpression();
1350
- } else {
1351
- var comment = this.t.lastBlockComment();
1352
- }
1353
- n2.blockComment = comment;
1354
- } while (this.match(COMMA));
1355
-
1356
- return n;
1357
- }
1358
-
1359
- /*
1360
- * LetBlock :: (boolean) -> node
1361
- *
1362
- * Does not handle let inside of for loop init.
1363
- */
1364
- Pp.LetBlock = function LetBlock(isStatement) {
1365
- var n, n2;
1366
-
1367
- // t.token.type must be LET
1368
- n = this.newNode({ type: LET_BLOCK, varDecls: [] });
1369
- this.mustMatch(LEFT_PAREN);
1370
- n.variables = this.Variables(n);
1371
- this.mustMatch(RIGHT_PAREN);
1372
-
1373
- if (isStatement && this.peek() !== LEFT_CURLY) {
1374
- /*
1375
- * If this is really an expression in let statement guise, then we
1376
- * need to wrap the LET_BLOCK node in a SEMICOLON node so that we pop
1377
- * the return value of the expression.
1378
- */
1379
- n2 = this.newNode({ type: SEMICOLON, expression: n });
1380
- isStatement = false;
1381
- }
1382
-
1383
- if (isStatement)
1384
- n.block = this.Block();
1385
- else
1386
- n.expression = this.AssignExpression();
1387
-
1388
- return n;
1389
- }
1390
-
1391
- Pp.checkDestructuring = function checkDestructuring(n, simpleNamesOnly) {
1392
- if (n.type === ARRAY_COMP)
1393
- this.fail("Invalid array comprehension left-hand side");
1394
- if (n.type !== ARRAY_INIT && n.type !== OBJECT_INIT)
1395
- return;
1396
-
1397
- var lhss = {};
1398
- var nn, n2, idx, sub, cc, c = n.children;
1399
- for (var i = 0, j = c.length; i < j; i++) {
1400
- if (!(nn = c[i]))
1401
- continue;
1402
- if (nn.type === PROPERTY_INIT) {
1403
- cc = nn.children;
1404
- sub = cc[1];
1405
- idx = cc[0].value;
1406
- } else if (n.type === OBJECT_INIT) {
1407
- // Do we have destructuring shorthand {foo, bar}?
1408
- sub = nn;
1409
- idx = nn.value;
1410
- } else {
1411
- sub = nn;
1412
- idx = i;
1413
- }
1414
-
1415
- if (sub.type === ARRAY_INIT || sub.type === OBJECT_INIT) {
1416
- lhss[idx] = this.checkDestructuring(sub, simpleNamesOnly);
1417
- } else {
1418
- if (simpleNamesOnly && sub.type !== IDENTIFIER) {
1419
- // In declarations, lhs must be simple names
1420
- this.fail("missing name in pattern");
1421
- }
1422
-
1423
- lhss[idx] = sub;
1424
- }
1425
- }
1426
-
1427
- return lhss;
1428
- }
1429
-
1430
- Pp.DestructuringExpression = function DestructuringExpression(simpleNamesOnly) {
1431
- var n = this.PrimaryExpression();
1432
- // Keep the list of lefthand sides for varDecls
1433
- n.destructuredNames = this.checkDestructuring(n, simpleNamesOnly);
1434
- return n;
1435
- }
1436
-
1437
- Pp.GeneratorExpression = function GeneratorExpression(e) {
1438
- return this.newNode({ type: GENERATOR,
1439
- expression: e,
1440
- tail: this.ComprehensionTail() });
1441
- }
1442
-
1443
- Pp.ComprehensionTail = function ComprehensionTail() {
1444
- var body, n, n2, n3, p;
1445
-
1446
- // t.token.type must be FOR
1447
- body = this.newNode({ type: COMP_TAIL });
1448
-
1449
- do {
1450
- // Comprehension tails are always for..in loops.
1451
- n = this.newNode({ type: FOR_IN, isLoop: true });
1452
- if (this.match(IDENTIFIER)) {
1453
- // But sometimes they're for each..in.
1454
- if (this.mozillaMode && this.t.token.value === "each")
1455
- n.isEach = true;
1456
- else
1457
- this.t.unget();
1458
- }
1459
- p = this.MaybeLeftParen();
1460
- switch(this.t.get()) {
1461
- case LEFT_BRACKET:
1462
- case LEFT_CURLY:
1463
- this.t.unget();
1464
- // Destructured left side of for in comprehension tails.
1465
- n.iterator = this.DestructuringExpression();
1466
- break;
1467
-
1468
- case IDENTIFIER:
1469
- n.iterator = n3 = this.newNode({ type: IDENTIFIER });
1470
- n3.name = n3.value;
1471
- n.varDecl = n2 = this.newNode({ type: VAR });
1472
- n2.push(n3);
1473
- this.x.parentScript.varDecls.push(n3);
1474
- // Don't add to varDecls since the semantics of comprehensions is
1475
- // such that the variables are in their own function when
1476
- // desugared.
1477
- break;
1478
-
1479
- default:
1480
- this.fail("missing identifier");
1481
- }
1482
- this.mustMatch(IN);
1483
- n.object = this.Expression();
1484
- this.MaybeRightParen(p);
1485
- body.push(n);
1486
- } while (this.match(FOR));
1487
-
1488
- // Optional guard.
1489
- if (this.match(IF))
1490
- body.guard = this.HeadExpression();
1491
-
1492
- return body;
1493
- }
1494
-
1495
- Pp.HeadExpression = function HeadExpression() {
1496
- var p = this.MaybeLeftParen();
1497
- var n = this.ParenExpression();
1498
- this.MaybeRightParen(p);
1499
- if (p === END && !n.parenthesized) {
1500
- var tt = this.peek();
1501
- if (tt !== LEFT_CURLY && !definitions.isStatementStartCode[tt])
1502
- this.fail("Unparenthesized head followed by unbraced body");
1503
- }
1504
- return n;
1505
- }
1506
-
1507
- Pp.ParenExpression = function ParenExpression() {
1508
- // Always accept the 'in' operator in a parenthesized expression,
1509
- // where it's unambiguous, even if we might be parsing the init of a
1510
- // for statement.
1511
- var x2 = this.x.update({
1512
- inForLoopInit: this.x.inForLoopInit && (this.t.token.type === LEFT_PAREN)
1513
- });
1514
- var n = this.withContext(x2, function() {
1515
- return this.Expression();
1516
- });
1517
- if (this.match(FOR)) {
1518
- if (n.type === YIELD && !n.parenthesized)
1519
- this.fail("Yield expression must be parenthesized");
1520
- if (n.type === COMMA && !n.parenthesized)
1521
- this.fail("Generator expression must be parenthesized");
1522
- n = this.GeneratorExpression(n);
1523
- }
1524
-
1525
- return n;
1526
- }
1527
-
1528
- /*
1529
- * Expression :: () -> node
1530
- *
1531
- * Top-down expression parser matched against SpiderMonkey.
1532
- */
1533
- Pp.Expression = function Expression() {
1534
- var n, n2;
1535
-
1536
- n = this.AssignExpression();
1537
- if (this.match(COMMA)) {
1538
- n2 = this.newNode({ type: COMMA });
1539
- n2.push(n);
1540
- n = n2;
1541
- do {
1542
- n2 = n.children[n.children.length-1];
1543
- if (n2.type === YIELD && !n2.parenthesized)
1544
- this.fail("Yield expression must be parenthesized");
1545
- n.push(this.AssignExpression());
1546
- } while (this.match(COMMA));
1547
- }
1548
-
1549
- return n;
1550
- }
1551
-
1552
- Pp.AssignExpression = function AssignExpression() {
1553
- var n, lhs;
1554
-
1555
- // Have to treat yield like an operand because it could be the leftmost
1556
- // operand of the expression.
1557
- if (this.match(YIELD, true))
1558
- return this.ReturnOrYield();
1559
-
1560
- n = this.newNode({ type: ASSIGN });
1561
- lhs = this.ConditionalExpression();
1562
-
1563
- if (!this.match(ASSIGN)) {
1564
- return lhs;
1565
- }
1566
-
1567
- n.blockComment = this.t.lastBlockComment();
1568
-
1569
- switch (lhs.type) {
1570
- case OBJECT_INIT:
1571
- case ARRAY_INIT:
1572
- lhs.destructuredNames = this.checkDestructuring(lhs);
1573
- // FALL THROUGH
1574
- case IDENTIFIER: case DOT: case INDEX: case CALL:
1575
- break;
1576
- default:
1577
- this.fail("Bad left-hand side of assignment");
1578
- break;
1579
- }
1580
-
1581
- n.assignOp = lhs.assignOp = this.t.token.assignOp;
1582
- n.push(lhs);
1583
- n.push(this.AssignExpression());
1584
-
1585
- return n;
1586
- }
1587
-
1588
- Pp.ConditionalExpression = function ConditionalExpression() {
1589
- var n, n2;
1590
-
1591
- n = this.OrExpression();
1592
- if (this.match(HOOK)) {
1593
- n2 = n;
1594
- n = this.newNode({ type: HOOK });
1595
- n.push(n2);
1596
- /*
1597
- * Always accept the 'in' operator in the middle clause of a ternary,
1598
- * where it's unambiguous, even if we might be parsing the init of a
1599
- * for statement.
1600
- */
1601
- var x2 = this.x.update({ inForLoopInit: false });
1602
- this.withContext(x2, function() {
1603
- n.push(this.AssignExpression());
1604
- });
1605
- if (!this.match(COLON))
1606
- this.fail("missing : after ?");
1607
- n.push(this.AssignExpression());
1608
- }
1609
-
1610
- return n;
1611
- }
1612
-
1613
- Pp.OrExpression = function OrExpression() {
1614
- var n, n2;
1615
-
1616
- n = this.AndExpression();
1617
- while (this.match(OR)) {
1618
- n2 = this.newNode();
1619
- n2.push(n);
1620
- n2.push(this.AndExpression());
1621
- n = n2;
1622
- }
1623
-
1624
- return n;
1625
- }
1626
-
1627
- Pp.AndExpression = function AndExpression() {
1628
- var n, n2;
1629
-
1630
- n = this.BitwiseOrExpression();
1631
- while (this.match(AND)) {
1632
- n2 = this.newNode();
1633
- n2.push(n);
1634
- n2.push(this.BitwiseOrExpression());
1635
- n = n2;
1636
- }
1637
-
1638
- return n;
1639
- }
1640
-
1641
- Pp.BitwiseOrExpression = function BitwiseOrExpression() {
1642
- var n, n2;
1643
-
1644
- n = this.BitwiseXorExpression();
1645
- while (this.match(BITWISE_OR)) {
1646
- n2 = this.newNode();
1647
- n2.push(n);
1648
- n2.push(this.BitwiseXorExpression());
1649
- n = n2;
1650
- }
1651
-
1652
- return n;
1653
- }
1654
-
1655
- Pp.BitwiseXorExpression = function BitwiseXorExpression() {
1656
- var n, n2;
1657
-
1658
- n = this.BitwiseAndExpression();
1659
- while (this.match(BITWISE_XOR)) {
1660
- n2 = this.newNode();
1661
- n2.push(n);
1662
- n2.push(this.BitwiseAndExpression());
1663
- n = n2;
1664
- }
1665
-
1666
- return n;
1667
- }
1668
-
1669
- Pp.BitwiseAndExpression = function BitwiseAndExpression() {
1670
- var n, n2;
1671
-
1672
- n = this.EqualityExpression();
1673
- while (this.match(BITWISE_AND)) {
1674
- n2 = this.newNode();
1675
- n2.push(n);
1676
- n2.push(this.EqualityExpression());
1677
- n = n2;
1678
- }
1679
-
1680
- return n;
1681
- }
1682
-
1683
- Pp.EqualityExpression = function EqualityExpression() {
1684
- var n, n2;
1685
-
1686
- n = this.RelationalExpression();
1687
- while (this.match(EQ) || this.match(NE) ||
1688
- this.match(STRICT_EQ) || this.match(STRICT_NE)) {
1689
- n2 = this.newNode();
1690
- n2.push(n);
1691
- n2.push(this.RelationalExpression());
1692
- n = n2;
1693
- }
1694
-
1695
- return n;
1696
- }
1697
-
1698
- Pp.RelationalExpression = function RelationalExpression() {
1699
- var n, n2;
1700
-
1701
- /*
1702
- * Uses of the in operator in shiftExprs are always unambiguous,
1703
- * so unset the flag that prohibits recognizing it.
1704
- */
1705
- var x2 = this.x.update({ inForLoopInit: false });
1706
- this.withContext(x2, function() {
1707
- n = this.ShiftExpression();
1708
- while ((this.match(LT) || this.match(LE) || this.match(GE) || this.match(GT) ||
1709
- (!this.x.inForLoopInit && this.match(IN)) ||
1710
- this.match(INSTANCEOF))) {
1711
- n2 = this.newNode();
1712
- n2.push(n);
1713
- n2.push(this.ShiftExpression());
1714
- n = n2;
1715
- }
1716
- });
1717
-
1718
- return n;
1719
- }
1720
-
1721
- Pp.ShiftExpression = function ShiftExpression() {
1722
- var n, n2;
1723
-
1724
- n = this.AddExpression();
1725
- while (this.match(LSH) || this.match(RSH) || this.match(URSH)) {
1726
- n2 = this.newNode();
1727
- n2.push(n);
1728
- n2.push(this.AddExpression());
1729
- n = n2;
1730
- }
1731
-
1732
- return n;
1733
- }
1734
-
1735
- Pp.AddExpression = function AddExpression() {
1736
- var n, n2;
1737
-
1738
- n = this.MultiplyExpression();
1739
- while (this.match(PLUS) || this.match(MINUS)) {
1740
- n2 = this.newNode();
1741
- n2.push(n);
1742
- n2.push(this.MultiplyExpression());
1743
- n = n2;
1744
- }
1745
-
1746
- return n;
1747
- }
1748
-
1749
- Pp.MultiplyExpression = function MultiplyExpression() {
1750
- var n, n2;
1751
-
1752
- n = this.UnaryExpression();
1753
- while (this.match(MUL) || this.match(DIV) || this.match(MOD)) {
1754
- n2 = this.newNode();
1755
- n2.push(n);
1756
- n2.push(this.UnaryExpression());
1757
- n = n2;
1758
- }
1759
-
1760
- return n;
1761
- }
1762
-
1763
- Pp.UnaryExpression = function UnaryExpression() {
1764
- var n, n2, tt;
1765
-
1766
- switch (tt = this.t.get(true)) {
1767
- case DELETE: case VOID: case TYPEOF:
1768
- case NOT: case BITWISE_NOT: case PLUS: case MINUS:
1769
- if (tt === PLUS)
1770
- n = this.newNode({ type: UNARY_PLUS });
1771
- else if (tt === MINUS)
1772
- n = this.newNode({ type: UNARY_MINUS });
1773
- else
1774
- n = this.newNode();
1775
- n.push(this.UnaryExpression());
1776
- break;
1777
-
1778
- case INCREMENT:
1779
- case DECREMENT:
1780
- // Prefix increment/decrement.
1781
- n = this.newNode();
1782
- n.push(this.MemberExpression(true));
1783
- break;
1784
-
1785
- default:
1786
- this.t.unget();
1787
- n = this.MemberExpression(true);
1788
-
1789
- // Don't look across a newline boundary for a postfix {in,de}crement.
1790
- if (this.t.tokens[(this.t.tokenIndex + this.t.lookahead - 1) & 3].lineno ===
1791
- this.t.lineno) {
1792
- if (this.match(INCREMENT) || this.match(DECREMENT)) {
1793
- n2 = this.newNode({ postfix: true });
1794
- n2.push(n);
1795
- n = n2;
1796
- }
1797
- }
1798
- break;
1799
- }
1800
-
1801
- return n;
1802
- }
1803
-
1804
- Pp.MemberExpression = function MemberExpression(allowCallSyntax) {
1805
- var n, n2, name, tt;
1806
-
1807
- if (this.match(NEW)) {
1808
- n = this.newNode();
1809
- n.push(this.MemberExpression(false));
1810
- if (this.match(LEFT_PAREN)) {
1811
- n.type = NEW_WITH_ARGS;
1812
- n.push(this.ArgumentList());
1813
- }
1814
- } else {
1815
- n = this.PrimaryExpression();
1816
- }
1817
-
1818
- while ((tt = this.t.get()) !== END) {
1819
- switch (tt) {
1820
- case DOT:
1821
- n2 = this.newNode();
1822
- n2.push(n);
1823
- n2.push(this.IdentifierName());
1824
- break;
1825
-
1826
- case LEFT_BRACKET:
1827
- n2 = this.newNode({ type: INDEX });
1828
- n2.push(n);
1829
- n2.push(this.Expression());
1830
- this.mustMatch(RIGHT_BRACKET);
1831
- break;
1832
-
1833
- case LEFT_PAREN:
1834
- if (allowCallSyntax) {
1835
- n2 = this.newNode({ type: CALL });
1836
- n2.push(n);
1837
- n2.push(this.ArgumentList());
1838
- break;
1839
- }
1840
-
1841
- // FALL THROUGH
1842
- default:
1843
- this.t.unget();
1844
- return n;
1845
- }
1846
-
1847
- n = n2;
1848
- }
1849
-
1850
- return n;
1851
- }
1852
-
1853
- Pp.ArgumentList = function ArgumentList() {
1854
- var n, n2;
1855
-
1856
- n = this.newNode({ type: LIST });
1857
- if (this.match(RIGHT_PAREN, true))
1858
- return n;
1859
- do {
1860
- n2 = this.AssignExpression();
1861
- if (n2.type === YIELD && !n2.parenthesized && this.peek() === COMMA)
1862
- this.fail("Yield expression must be parenthesized");
1863
- if (this.match(FOR)) {
1864
- n2 = this.GeneratorExpression(n2);
1865
- if (n.children.length > 1 || this.peek(true) === COMMA)
1866
- this.fail("Generator expression must be parenthesized");
1867
- }
1868
- n.push(n2);
1869
- } while (this.match(COMMA));
1870
- this.mustMatch(RIGHT_PAREN);
1871
-
1872
- return n;
1873
- }
1874
-
1875
- Pp.PrimaryExpression = function PrimaryExpression() {
1876
- var n, n2, tt = this.t.get(true);
1877
-
1878
- switch (tt) {
1879
- case FUNCTION:
1880
- n = this.FunctionDefinition(false, EXPRESSED_FORM);
1881
- break;
1882
-
1883
- case LEFT_BRACKET:
1884
- n = this.newNode({ type: ARRAY_INIT });
1885
- while ((tt = this.peek(true)) !== RIGHT_BRACKET) {
1886
- if (tt === COMMA) {
1887
- this.t.get();
1888
- n.push(null);
1889
- continue;
1890
- }
1891
- n.push(this.AssignExpression());
1892
- if (tt !== COMMA && !this.match(COMMA))
1893
- break;
1894
- }
1895
-
1896
- // If we matched exactly one element and got a FOR, we have an
1897
- // array comprehension.
1898
- if (n.children.length === 1 && this.match(FOR)) {
1899
- n2 = this.newNode({ type: ARRAY_COMP,
1900
- expression: n.children[0],
1901
- tail: this.ComprehensionTail() });
1902
- n = n2;
1903
- }
1904
- this.mustMatch(RIGHT_BRACKET);
1905
- break;
1906
-
1907
- case LEFT_CURLY:
1908
- var id, fd;
1909
- n = this.newNode({ type: OBJECT_INIT });
1910
-
1911
- object_init:
1912
- if (!this.match(RIGHT_CURLY)) {
1913
- do {
1914
- tt = this.t.get();
1915
- if ((this.t.token.value === "get" || this.t.token.value === "set") &&
1916
- this.peek() === IDENTIFIER) {
1917
- n.push(this.FunctionDefinition(true, EXPRESSED_FORM));
1918
- } else {
1919
- var comments = this.t.blockComments;
1920
- switch (tt) {
1921
- case IDENTIFIER: case NUMBER: case STRING:
1922
- id = this.newNode({ type: IDENTIFIER });
1923
- break;
1924
- case RIGHT_CURLY:
1925
- break object_init;
1926
- default:
1927
- if (this.t.token.value in definitions.keywords) {
1928
- id = this.newNode({ type: IDENTIFIER });
1929
- break;
1930
- }
1931
- this.fail("Invalid property name");
1932
- }
1933
- if (this.match(COLON)) {
1934
- n2 = this.newNode({ type: PROPERTY_INIT });
1935
- n2.push(id);
1936
- n2.push(this.AssignExpression());
1937
- n2.blockComments = comments;
1938
- n.push(n2);
1939
- } else {
1940
- // Support, e.g., |var {x, y} = o| as destructuring shorthand
1941
- // for |var {x: x, y: y} = o|, per proposed JS2/ES4 for JS1.8.
1942
- if (this.peek() !== COMMA && this.peek() !== RIGHT_CURLY)
1943
- this.fail("missing : after property");
1944
- n.push(id);
1945
- }
1946
- }
1947
- } while (this.match(COMMA));
1948
- this.mustMatch(RIGHT_CURLY);
1949
- }
1950
- break;
1951
-
1952
- case LEFT_PAREN:
1953
- n = this.ParenExpression();
1954
- this.mustMatch(RIGHT_PAREN);
1955
- n.parenthesized = true;
1956
- break;
1957
-
1958
- case LET:
1959
- n = this.LetBlock(false);
1960
- break;
1961
-
1962
- case NULL: case THIS: case TRUE: case FALSE:
1963
- case IDENTIFIER: case NUMBER: case STRING: case REGEXP:
1964
- n = this.newNode();
1965
- break;
1966
-
1967
- default:
1968
- this.fail("missing operand; found " + definitions.tokens[tt]);
1969
- break;
1970
- }
1971
-
1972
- return n;
1973
- }
1974
-
1975
- /*
1976
- * parse :: (source, filename, line number) -> node
1977
- */
1978
- function parse(s, f, l) {
1979
- var t = new Tokenizer(s, f, l, options.allowHTMLComments);
1980
- var p = new Parser(t);
1981
- return p.Script(false, false, true);
1982
- }
1983
-
1984
- /*
1985
- * parseFunction :: (source, boolean,
1986
- * DECLARED_FORM or EXPRESSED_FORM or STATEMENT_FORM,
1987
- * filename, line number)
1988
- * -> node
1989
- */
1990
- function parseFunction(s, requireName, form, f, l) {
1991
- var t = new Tokenizer(s, f, l);
1992
- var p = new Parser(t);
1993
- p.x = new StaticContext(null, null, false, false, false);
1994
- return p.FunctionDefinition(requireName, form);
1995
- }
1996
-
1997
- /*
1998
- * parseStdin :: (source, {line number}, string, (string) -> boolean) -> program node
1999
- */
2000
- function parseStdin(s, ln, prefix, isCommand) {
2001
- // the special .begin command is only recognized at the beginning
2002
- if (s.match(/^[\s]*\.begin[\s]*$/)) {
2003
- ++ln.value;
2004
- return parseMultiline(ln, prefix);
2005
- }
2006
-
2007
- // commands at the beginning are treated as the entire input
2008
- if (isCommand(s.trim()))
2009
- s = "";
2010
-
2011
- for (;;) {
2012
- try {
2013
- var t = new Tokenizer(s, "stdin", ln.value, false);
2014
- var p = new Parser(t);
2015
- var n = p.Script(false, false);
2016
- ln.value = t.lineno;
2017
- return n;
2018
- } catch (e) {
2019
- if (!p.unexpectedEOF)
2020
- throw e;
2021
-
2022
- // commands in the middle are not treated as part of the input
2023
- var more;
2024
- do {
2025
- if (prefix)
2026
- putstr(prefix);
2027
- more = readline();
2028
- if (!more)
2029
- throw e;
2030
- } while (isCommand(more.trim()));
2031
-
2032
- s += "\n" + more;
2033
- }
2034
- }
2035
- }
2036
-
2037
- /*
2038
- * parseMultiline :: ({line number}, string | null) -> program node
2039
- */
2040
- function parseMultiline(ln, prefix) {
2041
- var s = "";
2042
- for (;;) {
2043
- if (prefix)
2044
- putstr(prefix);
2045
- var more = readline();
2046
- if (more === null)
2047
- return null;
2048
- // the only command recognized in multiline mode is .end
2049
- if (more.match(/^[\s]*\.end[\s]*$/))
2050
- break;
2051
- s += "\n" + more;
2052
- }
2053
- var t = new Tokenizer(s, "stdin", ln.value, false);
2054
- var p = new Parser(t);
2055
- var n = p.Script(false, false);
2056
- ln.value = t.lineno;
2057
- return n;
2058
- }
2059
-
2060
- exports.parse = parse;
2061
- exports.parseStdin = parseStdin;
2062
- exports.parseFunction = parseFunction;
2063
- exports.Node = Node;
2064
- exports.DECLARED_FORM = DECLARED_FORM;
2065
- exports.EXPRESSED_FORM = EXPRESSED_FORM;
2066
- exports.STATEMENT_FORM = STATEMENT_FORM;
2067
- exports.Tokenizer = Tokenizer;
2068
- exports.Parser = Parser;
2069
- exports.Module = Module;
2070
- exports.Export = Export;
2071
-
2072
- });