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,4469 +0,0 @@
1
- define(function(require, exports, module) {
2
- /*!
3
- * JSHint, by JSHint Community.
4
- *
5
- * Licensed under the same slightly modified MIT license that JSLint is.
6
- * It stops evil-doers everywhere.
7
- *
8
- * JSHint is a derivative work of JSLint:
9
- *
10
- * Copyright (c) 2002 Douglas Crockford (www.JSLint.com)
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining
13
- * a copy of this software and associated documentation files (the "Software"),
14
- * to deal in the Software without restriction, including without limitation
15
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
- * and/or sell copies of the Software, and to permit persons to whom
17
- * the Software is furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included
20
- * in all copies or substantial portions of the Software.
21
- *
22
- * The Software shall be used for Good, not Evil.
23
- *
24
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30
- * DEALINGS IN THE SOFTWARE.
31
- *
32
- * JSHint was forked from 2010-12-16 edition of JSLint.
33
- *
34
- */
35
-
36
- /*
37
- JSHINT is a global function. It takes two parameters.
38
-
39
- var myResult = JSHINT(source, option);
40
-
41
- The first parameter is either a string or an array of strings. If it is a
42
- string, it will be split on '\n' or '\r'. If it is an array of strings, it
43
- is assumed that each string represents one line. The source can be a
44
- JavaScript text or a JSON text.
45
-
46
- The second parameter is an optional object of options which control the
47
- operation of JSHINT. Most of the options are booleans: They are all
48
- optional and have a default value of false. One of the options, predef,
49
- can be an array of names, which will be used to declare global variables,
50
- or an object whose keys are used as global names, with a boolean value
51
- that determines if they are assignable.
52
-
53
- If it checks out, JSHINT returns true. Otherwise, it returns false.
54
-
55
- If false, you can inspect JSHINT.errors to find out the problems.
56
- JSHINT.errors is an array of objects containing these members:
57
-
58
- {
59
- line : The line (relative to 0) at which the lint was found
60
- character : The character (relative to 0) at which the lint was found
61
- reason : The problem
62
- evidence : The text line in which the problem occurred
63
- raw : The raw message before the details were inserted
64
- a : The first detail
65
- b : The second detail
66
- c : The third detail
67
- d : The fourth detail
68
- }
69
-
70
- If a fatal error was found, a null will be the last element of the
71
- JSHINT.errors array.
72
-
73
- You can request a Function Report, which shows all of the functions
74
- and the parameters and vars that they use. This can be used to find
75
- implied global variables and other problems. The report is in HTML and
76
- can be inserted in an HTML <body>.
77
-
78
- var myReport = JSHINT.report(limited);
79
-
80
- If limited is true, then the report will be limited to only errors.
81
-
82
- You can request a data structure which contains JSHint's results.
83
-
84
- var myData = JSHINT.data();
85
-
86
- It returns a structure with this form:
87
-
88
- {
89
- errors: [
90
- {
91
- line: NUMBER,
92
- character: NUMBER,
93
- reason: STRING,
94
- evidence: STRING
95
- }
96
- ],
97
- functions: [
98
- name: STRING,
99
- line: NUMBER,
100
- last: NUMBER,
101
- param: [
102
- STRING
103
- ],
104
- closure: [
105
- STRING
106
- ],
107
- var: [
108
- STRING
109
- ],
110
- exception: [
111
- STRING
112
- ],
113
- outer: [
114
- STRING
115
- ],
116
- unused: [
117
- STRING
118
- ],
119
- global: [
120
- STRING
121
- ],
122
- label: [
123
- STRING
124
- ]
125
- ],
126
- globals: [
127
- STRING
128
- ],
129
- member: {
130
- STRING: NUMBER
131
- },
132
- unused: [
133
- {
134
- name: STRING,
135
- line: NUMBER
136
- }
137
- ],
138
- implieds: [
139
- {
140
- name: STRING,
141
- line: NUMBER
142
- }
143
- ],
144
- urls: [
145
- STRING
146
- ],
147
- json: BOOLEAN
148
- }
149
-
150
- Empty arrays will not be included.
151
-
152
- */
153
-
154
- /*jshint
155
- evil: true, nomen: false, onevar: false, regexp: false, strict: true, boss: true,
156
- undef: true, maxlen: 100, indent:4
157
- */
158
-
159
- /*members "\b", "\t", "\n", "\f", "\r", "!=", "!==", "\"", "%", "(begin)",
160
- "(breakage)", "(context)", "(error)", "(global)", "(identifier)", "(last)",
161
- "(line)", "(loopage)", "(name)", "(onevar)", "(params)", "(scope)",
162
- "(statement)", "(verb)", "*", "+", "++", "-", "--", "\/", "<", "<=", "==",
163
- "===", ">", ">=", $, $$, $A, $F, $H, $R, $break, $continue, $w, Abstract, Ajax,
164
- __filename, __dirname, ActiveXObject, Array, ArrayBuffer, ArrayBufferView, Audio,
165
- Autocompleter, Assets, Boolean, Builder, Buffer, Browser, COM, CScript, Canvas,
166
- CustomAnimation, Class, Control, Chain, Color, Cookie, Core, DataView, Date,
167
- Debug, Draggable, Draggables, Droppables, Document, DomReady, DOMReady, DOMParser, Drag,
168
- E, Enumerator, Enumerable, Element, Elements, Error, Effect, EvalError, Event,
169
- Events, FadeAnimation, Field, Flash, Float32Array, Float64Array, Form,
170
- FormField, Frame, FormData, Function, Fx, GetObject, Group, Hash, HotKey,
171
- HTMLElement, HTMLAnchorElement, HTMLBaseElement, HTMLBlockquoteElement,
172
- HTMLBodyElement, HTMLBRElement, HTMLButtonElement, HTMLCanvasElement, HTMLDirectoryElement,
173
- HTMLDivElement, HTMLDListElement, HTMLFieldSetElement,
174
- HTMLFontElement, HTMLFormElement, HTMLFrameElement, HTMLFrameSetElement,
175
- HTMLHeadElement, HTMLHeadingElement, HTMLHRElement, HTMLHtmlElement,
176
- HTMLIFrameElement, HTMLImageElement, HTMLInputElement, HTMLIsIndexElement,
177
- HTMLLabelElement, HTMLLayerElement, HTMLLegendElement, HTMLLIElement,
178
- HTMLLinkElement, HTMLMapElement, HTMLMenuElement, HTMLMetaElement,
179
- HTMLModElement, HTMLObjectElement, HTMLOListElement, HTMLOptGroupElement,
180
- HTMLOptionElement, HTMLParagraphElement, HTMLParamElement, HTMLPreElement,
181
- HTMLQuoteElement, HTMLScriptElement, HTMLSelectElement, HTMLStyleElement,
182
- HtmlTable, HTMLTableCaptionElement, HTMLTableCellElement, HTMLTableColElement,
183
- HTMLTableElement, HTMLTableRowElement, HTMLTableSectionElement,
184
- HTMLTextAreaElement, HTMLTitleElement, HTMLUListElement, HTMLVideoElement,
185
- Iframe, IframeShim, Image, Int16Array, Int32Array, Int8Array,
186
- Insertion, InputValidator, JSON, Keyboard, Locale, LN10, LN2, LOG10E, LOG2E,
187
- MAX_VALUE, MIN_VALUE, Mask, Math, MenuItem, MessageChannel, MessageEvent, MessagePort,
188
- MoveAnimation, MooTools, Native, NEGATIVE_INFINITY, Number, Object, ObjectRange, Option,
189
- Options, OverText, PI, POSITIVE_INFINITY, PeriodicalExecuter, Point, Position, Prototype,
190
- RangeError, Rectangle, ReferenceError, RegExp, ResizeAnimation, Request, RotateAnimation,
191
- SQRT1_2, SQRT2, ScrollBar, ScriptEngine, ScriptEngineBuildVersion,
192
- ScriptEngineMajorVersion, ScriptEngineMinorVersion, Scriptaculous, Scroller,
193
- Slick, Slider, Selector, SharedWorker, String, Style, SyntaxError, Sortable, Sortables,
194
- SortableObserver, Sound, Spinner, System, Swiff, Text, TextArea, Template,
195
- Timer, Tips, Type, TypeError, Toggle, Try, "use strict", unescape, URI, URIError, URL,
196
- VBArray, WSH, WScript, XDomainRequest, Web, Window, XMLDOM, XMLHttpRequest, XMLSerializer,
197
- XPathEvaluator, XPathException, XPathExpression, XPathNamespace, XPathNSResolver, XPathResult,
198
- "\\", a, addEventListener, address, alert, apply, applicationCache, arguments, arity, asi, atob,
199
- b, basic, basicToken, bitwise, block, blur, boolOptions, boss, browser, btoa, c, call, callee,
200
- caller, cases, charAt, charCodeAt, character, clearInterval, clearTimeout,
201
- close, closed, closure, comment, condition, confirm, console, constructor,
202
- content, couch, create, css, curly, d, data, datalist, dd, debug, decodeURI,
203
- decodeURIComponent, defaultStatus, defineClass, deserialize, devel, document,
204
- dojo, dijit, dojox, define, else, emit, encodeURI, encodeURIComponent,
205
- entityify, eqeqeq, eqnull, errors, es5, escape, esnext, eval, event, evidence, evil,
206
- ex, exception, exec, exps, expr, exports, FileReader, first, floor, focus,
207
- forin, fragment, frames, from, fromCharCode, fud, funcscope, funct, function, functions,
208
- g, gc, getComputedStyle, getRow, getter, getterToken, GLOBAL, global, globals, globalstrict,
209
- hasOwnProperty, help, history, i, id, identifier, immed, implieds, importPackage, include,
210
- indent, indexOf, init, ins, instanceOf, isAlpha, isApplicationRunning, isArray,
211
- isDigit, isFinite, isNaN, iterator, java, join, jshint,
212
- JSHINT, json, jquery, jQuery, keys, label, labelled, last, lastsemic, laxbreak, laxcomma,
213
- latedef, lbp, led, left, length, line, load, loadClass, localStorage, location,
214
- log, loopfunc, m, match, maxerr, maxlen, member,message, meta, module, moveBy,
215
- moveTo, mootools, multistr, name, navigator, new, newcap, noarg, node, noempty, nomen,
216
- nonew, nonstandard, nud, onbeforeunload, onblur, onerror, onevar, onecase, onfocus,
217
- onload, onresize, onunload, open, openDatabase, openURL, opener, opera, options, outer, param,
218
- parent, parseFloat, parseInt, passfail, plusplus, predef, print, process, prompt,
219
- proto, prototype, prototypejs, provides, push, quit, range, raw, reach, reason, regexp,
220
- readFile, readUrl, regexdash, removeEventListener, replace, report, require,
221
- reserved, resizeBy, resizeTo, resolvePath, resumeUpdates, respond, rhino, right,
222
- runCommand, scroll, screen, scripturl, scrollBy, scrollTo, scrollbar, search, seal,
223
- send, serialize, sessionStorage, setInterval, setTimeout, setter, setterToken, shift, slice,
224
- smarttabs, sort, spawn, split, stack, status, start, strict, sub, substr, supernew, shadow,
225
- supplant, sum, sync, test, toLowerCase, toString, toUpperCase, toint32, token, top, trailing,
226
- type, typeOf, Uint16Array, Uint32Array, Uint8Array, undef, undefs, unused, urls, validthis,
227
- value, valueOf, var, version, WebSocket, withstmt, white, window, Worker, wsh*/
228
-
229
- /*global exports: false */
230
-
231
- // We build the application inside a function so that we produce only a single
232
- // global variable. That function will be invoked immediately, and its return
233
- // value is the JSHINT function itself.
234
-
235
- var JSHINT = (function () {
236
- "use strict";
237
-
238
- var anonname, // The guessed name for anonymous functions.
239
-
240
- // These are operators that should not be used with the ! operator.
241
-
242
- bang = {
243
- '<' : true,
244
- '<=' : true,
245
- '==' : true,
246
- '===': true,
247
- '!==': true,
248
- '!=' : true,
249
- '>' : true,
250
- '>=' : true,
251
- '+' : true,
252
- '-' : true,
253
- '*' : true,
254
- '/' : true,
255
- '%' : true
256
- },
257
-
258
- // These are the JSHint boolean options.
259
- boolOptions = {
260
- asi : true, // if automatic semicolon insertion should be tolerated
261
- bitwise : true, // if bitwise operators should not be allowed
262
- boss : true, // if advanced usage of assignments should be allowed
263
- browser : true, // if the standard browser globals should be predefined
264
- couch : true, // if CouchDB globals should be predefined
265
- curly : true, // if curly braces around all blocks should be required
266
- debug : true, // if debugger statements should be allowed
267
- devel : true, // if logging globals should be predefined (console,
268
- // alert, etc.)
269
- dojo : true, // if Dojo Toolkit globals should be predefined
270
- eqeqeq : true, // if === should be required
271
- eqnull : true, // if == null comparisons should be tolerated
272
- es5 : true, // if ES5 syntax should be allowed
273
- esnext : true, // if es.next specific syntax should be allowed
274
- evil : true, // if eval should be allowed
275
- expr : true, // if ExpressionStatement should be allowed as Programs
276
- forin : true, // if for in statements must filter
277
- funcscope : true, // if only function scope should be used for scope tests
278
- globalstrict: true, // if global "use strict"; should be allowed (also
279
- // enables 'strict')
280
- immed : true, // if immediate invocations must be wrapped in parens
281
- iterator : true, // if the `__iterator__` property should be allowed
282
- jquery : true, // if jQuery globals should be predefined
283
- lastsemic : true, // if semicolons may be ommitted for the trailing
284
- // statements inside of a one-line blocks.
285
- latedef : true, // if the use before definition should not be tolerated
286
- laxbreak : true, // if line breaks should not be checked
287
- laxcomma : true, // if line breaks should not be checked around commas
288
- loopfunc : true, // if functions should be allowed to be defined within
289
- // loops
290
- mootools : true, // if MooTools globals should be predefined
291
- multistr : true, // allow multiline strings
292
- newcap : true, // if constructor names must be capitalized
293
- noarg : true, // if arguments.caller and arguments.callee should be
294
- // disallowed
295
- node : true, // if the Node.js environment globals should be
296
- // predefined
297
- noempty : true, // if empty blocks should be disallowed
298
- nonew : true, // if using `new` for side-effects should be disallowed
299
- nonstandard : true, // if non-standard (but widely adopted) globals should
300
- // be predefined
301
- nomen : true, // if names should be checked
302
- onevar : true, // if only one var statement per function should be
303
- // allowed
304
- onecase : true, // if one case switch statements should be allowed
305
- passfail : true, // if the scan should stop on first error
306
- plusplus : true, // if increment/decrement should not be allowed
307
- proto : true, // if the `__proto__` property should be allowed
308
- prototypejs : true, // if Prototype and Scriptaculous globals should be
309
- // predefined
310
- regexdash : true, // if unescaped first/last dash (-) inside brackets
311
- // should be tolerated
312
- regexp : true, // if the . should not be allowed in regexp literals
313
- rhino : true, // if the Rhino environment globals should be predefined
314
- undef : true, // if variables should be declared before used
315
- scripturl : true, // if script-targeted URLs should be tolerated
316
- shadow : true, // if variable shadowing should be tolerated
317
- smarttabs : true, // if smarttabs should be tolerated
318
- // (http://www.emacswiki.org/emacs/SmartTabs)
319
- strict : true, // require the "use strict"; pragma
320
- sub : true, // if all forms of subscript notation are tolerated
321
- supernew : true, // if `new function () { ... };` and `new Object;`
322
- // should be tolerated
323
- trailing : true, // if trailing whitespace rules apply
324
- validthis : true, // if 'this' inside a non-constructor function is valid.
325
- // This is a function scoped option only.
326
- withstmt : true, // if with statements should be allowed
327
- white : true, // if strict whitespace rules apply
328
- wsh : true // if the Windows Scripting Host environment globals
329
- // should be predefined
330
- },
331
-
332
- // These are the JSHint options that can take any value
333
- // (we use this object to detect invalid options)
334
- valOptions = {
335
- maxlen: false,
336
- indent: false,
337
- maxerr: false,
338
- predef: false
339
- },
340
-
341
-
342
- // browser contains a set of global names which are commonly provided by a
343
- // web browser environment.
344
- browser = {
345
- ArrayBuffer : false,
346
- ArrayBufferView : false,
347
- Audio : false,
348
- addEventListener : false,
349
- applicationCache : false,
350
- atob : false,
351
- blur : false,
352
- btoa : false,
353
- clearInterval : false,
354
- clearTimeout : false,
355
- close : false,
356
- closed : false,
357
- DataView : false,
358
- DOMParser : false,
359
- defaultStatus : false,
360
- document : false,
361
- event : false,
362
- FileReader : false,
363
- Float32Array : false,
364
- Float64Array : false,
365
- FormData : false,
366
- focus : false,
367
- frames : false,
368
- getComputedStyle : false,
369
- HTMLElement : false,
370
- HTMLAnchorElement : false,
371
- HTMLBaseElement : false,
372
- HTMLBlockquoteElement : false,
373
- HTMLBodyElement : false,
374
- HTMLBRElement : false,
375
- HTMLButtonElement : false,
376
- HTMLCanvasElement : false,
377
- HTMLDirectoryElement : false,
378
- HTMLDivElement : false,
379
- HTMLDListElement : false,
380
- HTMLFieldSetElement : false,
381
- HTMLFontElement : false,
382
- HTMLFormElement : false,
383
- HTMLFrameElement : false,
384
- HTMLFrameSetElement : false,
385
- HTMLHeadElement : false,
386
- HTMLHeadingElement : false,
387
- HTMLHRElement : false,
388
- HTMLHtmlElement : false,
389
- HTMLIFrameElement : false,
390
- HTMLImageElement : false,
391
- HTMLInputElement : false,
392
- HTMLIsIndexElement : false,
393
- HTMLLabelElement : false,
394
- HTMLLayerElement : false,
395
- HTMLLegendElement : false,
396
- HTMLLIElement : false,
397
- HTMLLinkElement : false,
398
- HTMLMapElement : false,
399
- HTMLMenuElement : false,
400
- HTMLMetaElement : false,
401
- HTMLModElement : false,
402
- HTMLObjectElement : false,
403
- HTMLOListElement : false,
404
- HTMLOptGroupElement : false,
405
- HTMLOptionElement : false,
406
- HTMLParagraphElement : false,
407
- HTMLParamElement : false,
408
- HTMLPreElement : false,
409
- HTMLQuoteElement : false,
410
- HTMLScriptElement : false,
411
- HTMLSelectElement : false,
412
- HTMLStyleElement : false,
413
- HTMLTableCaptionElement : false,
414
- HTMLTableCellElement : false,
415
- HTMLTableColElement : false,
416
- HTMLTableElement : false,
417
- HTMLTableRowElement : false,
418
- HTMLTableSectionElement : false,
419
- HTMLTextAreaElement : false,
420
- HTMLTitleElement : false,
421
- HTMLUListElement : false,
422
- HTMLVideoElement : false,
423
- history : false,
424
- Int16Array : false,
425
- Int32Array : false,
426
- Int8Array : false,
427
- Image : false,
428
- length : false,
429
- localStorage : false,
430
- location : false,
431
- MessageChannel : false,
432
- MessageEvent : false,
433
- MessagePort : false,
434
- moveBy : false,
435
- moveTo : false,
436
- name : false,
437
- navigator : false,
438
- onbeforeunload : true,
439
- onblur : true,
440
- onerror : true,
441
- onfocus : true,
442
- onload : true,
443
- onresize : true,
444
- onunload : true,
445
- open : false,
446
- openDatabase : false,
447
- opener : false,
448
- Option : false,
449
- parent : false,
450
- print : false,
451
- removeEventListener : false,
452
- resizeBy : false,
453
- resizeTo : false,
454
- screen : false,
455
- scroll : false,
456
- scrollBy : false,
457
- scrollTo : false,
458
- sessionStorage : false,
459
- setInterval : false,
460
- setTimeout : false,
461
- SharedWorker : false,
462
- status : false,
463
- top : false,
464
- Uint16Array : false,
465
- Uint32Array : false,
466
- Uint8Array : false,
467
- WebSocket : false,
468
- window : false,
469
- Worker : false,
470
- XMLHttpRequest : false,
471
- XMLSerializer : false,
472
- XPathEvaluator : false,
473
- XPathException : false,
474
- XPathExpression : false,
475
- XPathNamespace : false,
476
- XPathNSResolver : false,
477
- XPathResult : false
478
- },
479
-
480
- couch = {
481
- "require" : false,
482
- respond : false,
483
- getRow : false,
484
- emit : false,
485
- send : false,
486
- start : false,
487
- sum : false,
488
- log : false,
489
- exports : false,
490
- module : false,
491
- provides : false
492
- },
493
-
494
- devel = {
495
- alert : false,
496
- confirm : false,
497
- console : false,
498
- Debug : false,
499
- opera : false,
500
- prompt : false
501
- },
502
-
503
- dojo = {
504
- dojo : false,
505
- dijit : false,
506
- dojox : false,
507
- define : false,
508
- "require" : false
509
- },
510
-
511
- escapes = {
512
- '\b': '\\b',
513
- '\t': '\\t',
514
- '\n': '\\n',
515
- '\f': '\\f',
516
- '\r': '\\r',
517
- '"' : '\\"',
518
- '/' : '\\/',
519
- '\\': '\\\\'
520
- },
521
-
522
- funct, // The current function
523
-
524
- functionicity = [
525
- 'closure', 'exception', 'global', 'label',
526
- 'outer', 'unused', 'var'
527
- ],
528
-
529
- functions, // All of the functions
530
-
531
- global, // The global scope
532
- implied, // Implied globals
533
- inblock,
534
- indent,
535
- jsonmode,
536
-
537
- jquery = {
538
- '$' : false,
539
- jQuery : false
540
- },
541
-
542
- lines,
543
- lookahead,
544
- member,
545
- membersOnly,
546
-
547
- mootools = {
548
- '$' : false,
549
- '$$' : false,
550
- Assets : false,
551
- Browser : false,
552
- Chain : false,
553
- Class : false,
554
- Color : false,
555
- Cookie : false,
556
- Core : false,
557
- Document : false,
558
- DomReady : false,
559
- DOMReady : false,
560
- Drag : false,
561
- Element : false,
562
- Elements : false,
563
- Event : false,
564
- Events : false,
565
- Fx : false,
566
- Group : false,
567
- Hash : false,
568
- HtmlTable : false,
569
- Iframe : false,
570
- IframeShim : false,
571
- InputValidator : false,
572
- instanceOf : false,
573
- Keyboard : false,
574
- Locale : false,
575
- Mask : false,
576
- MooTools : false,
577
- Native : false,
578
- Options : false,
579
- OverText : false,
580
- Request : false,
581
- Scroller : false,
582
- Slick : false,
583
- Slider : false,
584
- Sortables : false,
585
- Spinner : false,
586
- Swiff : false,
587
- Tips : false,
588
- Type : false,
589
- typeOf : false,
590
- URI : false,
591
- Window : false
592
- },
593
-
594
- nexttoken,
595
-
596
- node = {
597
- __filename : false,
598
- __dirname : false,
599
- Buffer : false,
600
- console : false,
601
- exports : false,
602
- GLOBAL : false,
603
- global : false,
604
- module : false,
605
- process : false,
606
- require : false,
607
- setTimeout : false,
608
- clearTimeout : false,
609
- setInterval : false,
610
- clearInterval : false
611
- },
612
-
613
- noreach,
614
- option,
615
- predefined, // Global variables defined by option
616
- prereg,
617
- prevtoken,
618
-
619
- prototypejs = {
620
- '$' : false,
621
- '$$' : false,
622
- '$A' : false,
623
- '$F' : false,
624
- '$H' : false,
625
- '$R' : false,
626
- '$break' : false,
627
- '$continue' : false,
628
- '$w' : false,
629
- Abstract : false,
630
- Ajax : false,
631
- Class : false,
632
- Enumerable : false,
633
- Element : false,
634
- Event : false,
635
- Field : false,
636
- Form : false,
637
- Hash : false,
638
- Insertion : false,
639
- ObjectRange : false,
640
- PeriodicalExecuter: false,
641
- Position : false,
642
- Prototype : false,
643
- Selector : false,
644
- Template : false,
645
- Toggle : false,
646
- Try : false,
647
- Autocompleter : false,
648
- Builder : false,
649
- Control : false,
650
- Draggable : false,
651
- Draggables : false,
652
- Droppables : false,
653
- Effect : false,
654
- Sortable : false,
655
- SortableObserver : false,
656
- Sound : false,
657
- Scriptaculous : false
658
- },
659
-
660
- rhino = {
661
- defineClass : false,
662
- deserialize : false,
663
- gc : false,
664
- help : false,
665
- importPackage: false,
666
- "java" : false,
667
- load : false,
668
- loadClass : false,
669
- print : false,
670
- quit : false,
671
- readFile : false,
672
- readUrl : false,
673
- runCommand : false,
674
- seal : false,
675
- serialize : false,
676
- spawn : false,
677
- sync : false,
678
- toint32 : false,
679
- version : false
680
- },
681
-
682
- scope, // The current scope
683
- stack,
684
-
685
- // standard contains the global names that are provided by the
686
- // ECMAScript standard.
687
- standard = {
688
- Array : false,
689
- Boolean : false,
690
- Date : false,
691
- decodeURI : false,
692
- decodeURIComponent : false,
693
- encodeURI : false,
694
- encodeURIComponent : false,
695
- Error : false,
696
- 'eval' : false,
697
- EvalError : false,
698
- Function : false,
699
- hasOwnProperty : false,
700
- isFinite : false,
701
- isNaN : false,
702
- JSON : false,
703
- Math : false,
704
- Number : false,
705
- Object : false,
706
- parseInt : false,
707
- parseFloat : false,
708
- RangeError : false,
709
- ReferenceError : false,
710
- RegExp : false,
711
- String : false,
712
- SyntaxError : false,
713
- TypeError : false,
714
- URIError : false
715
- },
716
-
717
- // widely adopted global names that are not part of ECMAScript standard
718
- nonstandard = {
719
- escape : false,
720
- unescape : false
721
- },
722
-
723
- standard_member = {
724
- E : true,
725
- LN2 : true,
726
- LN10 : true,
727
- LOG2E : true,
728
- LOG10E : true,
729
- MAX_VALUE : true,
730
- MIN_VALUE : true,
731
- NEGATIVE_INFINITY : true,
732
- PI : true,
733
- POSITIVE_INFINITY : true,
734
- SQRT1_2 : true,
735
- SQRT2 : true
736
- },
737
-
738
- directive,
739
- syntax = {},
740
- tab,
741
- token,
742
- urls,
743
- useESNextSyntax,
744
- warnings,
745
-
746
- wsh = {
747
- ActiveXObject : true,
748
- Enumerator : true,
749
- GetObject : true,
750
- ScriptEngine : true,
751
- ScriptEngineBuildVersion : true,
752
- ScriptEngineMajorVersion : true,
753
- ScriptEngineMinorVersion : true,
754
- VBArray : true,
755
- WSH : true,
756
- WScript : true,
757
- XDomainRequest : true
758
- };
759
-
760
- // Regular expressions. Some of these are stupidly long.
761
- var ax, cx, tx, nx, nxg, lx, ix, jx, ft;
762
- (function () {
763
- /*jshint maxlen:300 */
764
-
765
- // unsafe comment or string
766
- ax = /@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i;
767
-
768
- // unsafe characters that are silently deleted by one or more browsers
769
- cx = /[\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
770
-
771
- // token
772
- tx = /^\s*([(){}\[.,:;'"~\?\]#@]|==?=?|\/(\*(jshint|jslint|members?|global)?|=|\/)?|\*[\/=]?|\+(?:=|\++)?|-(?:=|-+)?|%=?|&[&=]?|\|[|=]?|>>?>?=?|<([\/=!]|\!(\[|--)?|<=?)?|\^=?|\!=?=?|[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+([xX][0-9a-fA-F]+|\.[0-9]*)?([eE][+\-]?[0-9]+)?)/;
773
-
774
- // characters in strings that need escapement
775
- nx = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/;
776
- nxg = /[\u0000-\u001f&<"\/\\\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
777
-
778
- // star slash
779
- lx = /\*\/|\/\*/;
780
-
781
- // identifier
782
- ix = /^([a-zA-Z_$][a-zA-Z0-9_$]*)$/;
783
-
784
- // javascript url
785
- jx = /^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\s*:/i;
786
-
787
- // catches /* falls through */ comments
788
- ft = /^\s*\/\*\s*falls\sthrough\s*\*\/\s*$/;
789
- }());
790
-
791
- function F() {} // Used by Object.create
792
-
793
- function is_own(object, name) {
794
-
795
- // The object.hasOwnProperty method fails when the property under consideration
796
- // is named 'hasOwnProperty'. So we have to use this more convoluted form.
797
-
798
- return Object.prototype.hasOwnProperty.call(object, name);
799
- }
800
-
801
- function checkOption(name, t) {
802
- if (valOptions[name] === undefined && boolOptions[name] === undefined) {
803
- warning("Bad option: '" + name + "'.", t);
804
- }
805
- }
806
-
807
- // Provide critical ES5 functions to ES3.
808
-
809
- if (typeof Array.isArray !== 'function') {
810
- Array.isArray = function (o) {
811
- return Object.prototype.toString.apply(o) === '[object Array]';
812
- };
813
- }
814
-
815
- if (typeof Object.create !== 'function') {
816
- Object.create = function (o) {
817
- F.prototype = o;
818
- return new F();
819
- };
820
- }
821
-
822
- if (typeof Object.keys !== 'function') {
823
- Object.keys = function (o) {
824
- var a = [], k;
825
- for (k in o) {
826
- if (is_own(o, k)) {
827
- a.push(k);
828
- }
829
- }
830
- return a;
831
- };
832
- }
833
-
834
- // Non standard methods
835
-
836
- if (typeof String.prototype.entityify !== 'function') {
837
- String.prototype.entityify = function () {
838
- return this
839
- .replace(/&/g, '&amp;')
840
- .replace(/</g, '&lt;')
841
- .replace(/>/g, '&gt;');
842
- };
843
- }
844
-
845
- if (typeof String.prototype.isAlpha !== 'function') {
846
- String.prototype.isAlpha = function () {
847
- return (this >= 'a' && this <= 'z\uffff') ||
848
- (this >= 'A' && this <= 'Z\uffff');
849
- };
850
- }
851
-
852
- if (typeof String.prototype.isDigit !== 'function') {
853
- String.prototype.isDigit = function () {
854
- return (this >= '0' && this <= '9');
855
- };
856
- }
857
-
858
- if (typeof String.prototype.supplant !== 'function') {
859
- String.prototype.supplant = function (o) {
860
- return this.replace(/\{([^{}]*)\}/g, function (a, b) {
861
- var r = o[b];
862
- return typeof r === 'string' || typeof r === 'number' ? r : a;
863
- });
864
- };
865
- }
866
-
867
- if (typeof String.prototype.name !== 'function') {
868
- String.prototype.name = function () {
869
-
870
- // If the string looks like an identifier, then we can return it as is.
871
- // If the string contains no control characters, no quote characters, and no
872
- // backslash characters, then we can simply slap some quotes around it.
873
- // Otherwise we must also replace the offending characters with safe
874
- // sequences.
875
-
876
- if (ix.test(this)) {
877
- return this;
878
- }
879
- if (nx.test(this)) {
880
- return '"' + this.replace(nxg, function (a) {
881
- var c = escapes[a];
882
- if (c) {
883
- return c;
884
- }
885
- return '\\u' + ('0000' + a.charCodeAt().toString(16)).slice(-4);
886
- }) + '"';
887
- }
888
- return '"' + this + '"';
889
- };
890
- }
891
-
892
-
893
- function combine(t, o) {
894
- var n;
895
- for (n in o) {
896
- if (is_own(o, n)) {
897
- t[n] = o[n];
898
- }
899
- }
900
- }
901
-
902
- function assume() {
903
- if (option.couch) {
904
- combine(predefined, couch);
905
- }
906
-
907
- if (option.rhino) {
908
- combine(predefined, rhino);
909
- }
910
-
911
- if (option.prototypejs) {
912
- combine(predefined, prototypejs);
913
- }
914
-
915
- if (option.node) {
916
- combine(predefined, node);
917
- option.globalstrict = true;
918
- }
919
-
920
- if (option.devel) {
921
- combine(predefined, devel);
922
- }
923
-
924
- if (option.dojo) {
925
- combine(predefined, dojo);
926
- }
927
-
928
- if (option.browser) {
929
- combine(predefined, browser);
930
- }
931
-
932
- if (option.nonstandard) {
933
- combine(predefined, nonstandard);
934
- }
935
-
936
- if (option.jquery) {
937
- combine(predefined, jquery);
938
- }
939
-
940
- if (option.mootools) {
941
- combine(predefined, mootools);
942
- }
943
-
944
- if (option.wsh) {
945
- combine(predefined, wsh);
946
- }
947
-
948
- if (option.esnext) {
949
- useESNextSyntax();
950
- }
951
-
952
- if (option.globalstrict && option.strict !== false) {
953
- option.strict = true;
954
- }
955
- }
956
-
957
-
958
- // Produce an error warning.
959
- function quit(message, line, chr) {
960
- var percentage = Math.floor((line / lines.length) * 100);
961
-
962
- throw {
963
- name: 'JSHintError',
964
- line: line,
965
- character: chr,
966
- message: message + " (" + percentage + "% scanned).",
967
- raw: message
968
- };
969
- }
970
-
971
- function isundef(scope, m, t, a) {
972
- return JSHINT.undefs.push([scope, m, t, a]);
973
- }
974
-
975
- function warning(m, t, a, b, c, d) {
976
- var ch, l, w;
977
- t = t || nexttoken;
978
- if (t.id === '(end)') { // `~
979
- t = token;
980
- }
981
- l = t.line || 0;
982
- ch = t.from || 0;
983
- w = {
984
- id: '(error)',
985
- raw: m,
986
- evidence: lines[l - 1] || '',
987
- line: l,
988
- character: ch,
989
- a: a,
990
- b: b,
991
- c: c,
992
- d: d
993
- };
994
- w.reason = m.supplant(w);
995
- JSHINT.errors.push(w);
996
- if (option.passfail) {
997
- quit('Stopping. ', l, ch);
998
- }
999
- warnings += 1;
1000
- if (warnings >= option.maxerr) {
1001
- quit("Too many errors.", l, ch);
1002
- }
1003
- return w;
1004
- }
1005
-
1006
- function warningAt(m, l, ch, a, b, c, d) {
1007
- return warning(m, {
1008
- line: l,
1009
- from: ch
1010
- }, a, b, c, d);
1011
- }
1012
-
1013
- function error(m, t, a, b, c, d) {
1014
- var w = warning(m, t, a, b, c, d);
1015
- }
1016
-
1017
- function errorAt(m, l, ch, a, b, c, d) {
1018
- return error(m, {
1019
- line: l,
1020
- from: ch
1021
- }, a, b, c, d);
1022
- }
1023
-
1024
-
1025
-
1026
- // lexical analysis and token construction
1027
-
1028
- var lex = (function lex() {
1029
- var character, from, line, s;
1030
-
1031
- // Private lex methods
1032
-
1033
- function nextLine() {
1034
- var at,
1035
- tw; // trailing whitespace check
1036
-
1037
- if (line >= lines.length)
1038
- return false;
1039
-
1040
- character = 1;
1041
- s = lines[line];
1042
- line += 1;
1043
-
1044
- // If smarttabs option is used check for spaces followed by tabs only.
1045
- // Otherwise check for any occurence of mixed tabs and spaces.
1046
- if (option.smarttabs)
1047
- at = s.search(/ \t/);
1048
- else
1049
- at = s.search(/ \t|\t /);
1050
-
1051
- if (at >= 0)
1052
- warningAt("Mixed spaces and tabs.", line, at + 1);
1053
-
1054
- s = s.replace(/\t/g, tab);
1055
- at = s.search(cx);
1056
-
1057
- if (at >= 0)
1058
- warningAt("Unsafe character.", line, at);
1059
-
1060
- if (option.maxlen && option.maxlen < s.length)
1061
- warningAt("Line too long.", line, s.length);
1062
-
1063
- // Check for trailing whitespaces
1064
- tw = option.trailing && s.match(/^(.*?)\s+$/);
1065
- if (tw && !/^\s+$/.test(s)) {
1066
- warningAt("Trailing whitespace.", line, tw[1].length + 1);
1067
- }
1068
- return true;
1069
- }
1070
-
1071
- // Produce a token object. The token inherits from a syntax symbol.
1072
-
1073
- function it(type, value) {
1074
- var i, t;
1075
- if (type === '(color)' || type === '(range)') {
1076
- t = {type: type};
1077
- } else if (type === '(punctuator)' ||
1078
- (type === '(identifier)' && is_own(syntax, value))) {
1079
- t = syntax[value] || syntax['(error)'];
1080
- } else {
1081
- t = syntax[type];
1082
- }
1083
- t = Object.create(t);
1084
- if (type === '(string)' || type === '(range)') {
1085
- if (!option.scripturl && jx.test(value)) {
1086
- warningAt("Script URL.", line, from);
1087
- }
1088
- }
1089
- if (type === '(identifier)') {
1090
- t.identifier = true;
1091
- if (value === '__proto__' && !option.proto) {
1092
- warningAt("The '{a}' property is deprecated.",
1093
- line, from, value);
1094
- } else if (value === '__iterator__' && !option.iterator) {
1095
- warningAt("'{a}' is only available in JavaScript 1.7.",
1096
- line, from, value);
1097
- } else if (option.nomen && (value.charAt(0) === '_' ||
1098
- value.charAt(value.length - 1) === '_')) {
1099
- if (!option.node || token.id === '.' ||
1100
- (value !== '__dirname' && value !== '__filename')) {
1101
- warningAt("Unexpected {a} in '{b}'.", line, from, "dangling '_'", value);
1102
- }
1103
- }
1104
- }
1105
- t.value = value;
1106
- t.line = line;
1107
- t.character = character;
1108
- t.from = from;
1109
- i = t.id;
1110
- if (i !== '(endline)') {
1111
- prereg = i &&
1112
- (('(,=:[!&|?{};'.indexOf(i.charAt(i.length - 1)) >= 0) ||
1113
- i === 'return' ||
1114
- i === 'case');
1115
- }
1116
- return t;
1117
- }
1118
-
1119
- // Public lex methods
1120
- return {
1121
- init: function (source) {
1122
- if (typeof source === 'string') {
1123
- lines = source
1124
- .replace(/\r\n/g, '\n')
1125
- .replace(/\r/g, '\n')
1126
- .split('\n');
1127
- } else {
1128
- lines = source;
1129
- }
1130
-
1131
- // If the first line is a shebang (#!), make it a blank and move on.
1132
- // Shebangs are used by Node scripts.
1133
- if (lines[0] && lines[0].substr(0, 2) === '#!')
1134
- lines[0] = '';
1135
-
1136
- line = 0;
1137
- nextLine();
1138
- from = 1;
1139
- },
1140
-
1141
- range: function (begin, end) {
1142
- var c, value = '';
1143
- from = character;
1144
- if (s.charAt(0) !== begin) {
1145
- errorAt("Expected '{a}' and instead saw '{b}'.",
1146
- line, character, begin, s.charAt(0));
1147
- }
1148
- for (;;) {
1149
- s = s.slice(1);
1150
- character += 1;
1151
- c = s.charAt(0);
1152
- switch (c) {
1153
- case '':
1154
- errorAt("Missing '{a}'.", line, character, c);
1155
- break;
1156
- case end:
1157
- s = s.slice(1);
1158
- character += 1;
1159
- return it('(range)', value);
1160
- case '\\':
1161
- warningAt("Unexpected '{a}'.", line, character, c);
1162
- }
1163
- value += c;
1164
- }
1165
-
1166
- },
1167
-
1168
-
1169
- // token -- this is called by advance to get the next token
1170
- token: function () {
1171
- var b, c, captures, d, depth, high, i, l, low, q, t, isLiteral, isInRange, n;
1172
-
1173
- function match(x) {
1174
- var r = x.exec(s), r1;
1175
- if (r) {
1176
- l = r[0].length;
1177
- r1 = r[1];
1178
- c = r1.charAt(0);
1179
- s = s.substr(l);
1180
- from = character + l - r1.length;
1181
- character += l;
1182
- return r1;
1183
- }
1184
- }
1185
-
1186
- function string(x) {
1187
- var c, j, r = '', allowNewLine = false;
1188
-
1189
- if (jsonmode && x !== '"') {
1190
- warningAt("Strings must use doublequote.",
1191
- line, character);
1192
- }
1193
-
1194
- function esc(n) {
1195
- var i = parseInt(s.substr(j + 1, n), 16);
1196
- j += n;
1197
- if (i >= 32 && i <= 126 &&
1198
- i !== 34 && i !== 92 && i !== 39) {
1199
- warningAt("Unnecessary escapement.", line, character);
1200
- }
1201
- character += n;
1202
- c = String.fromCharCode(i);
1203
- }
1204
- j = 0;
1205
- unclosedString: for (;;) {
1206
- while (j >= s.length) {
1207
- j = 0;
1208
-
1209
- var cl = line, cf = from;
1210
- if (!nextLine()) {
1211
- errorAt("Unclosed string.", cl, cf);
1212
- break unclosedString;
1213
- }
1214
-
1215
- if (allowNewLine) {
1216
- allowNewLine = false;
1217
- } else {
1218
- warningAt("Unclosed string.", cl, cf);
1219
- }
1220
- }
1221
- c = s.charAt(j);
1222
- if (c === x) {
1223
- character += 1;
1224
- s = s.substr(j + 1);
1225
- return it('(string)', r, x);
1226
- }
1227
- if (c < ' ') {
1228
- if (c === '\n' || c === '\r') {
1229
- break;
1230
- }
1231
- warningAt("Control character in string: {a}.",
1232
- line, character + j, s.slice(0, j));
1233
- } else if (c === '\\') {
1234
- j += 1;
1235
- character += 1;
1236
- c = s.charAt(j);
1237
- n = s.charAt(j + 1);
1238
- switch (c) {
1239
- case '\\':
1240
- case '"':
1241
- case '/':
1242
- break;
1243
- case '\'':
1244
- if (jsonmode) {
1245
- warningAt("Avoid \\'.", line, character);
1246
- }
1247
- break;
1248
- case 'b':
1249
- c = '\b';
1250
- break;
1251
- case 'f':
1252
- c = '\f';
1253
- break;
1254
- case 'n':
1255
- c = '\n';
1256
- break;
1257
- case 'r':
1258
- c = '\r';
1259
- break;
1260
- case 't':
1261
- c = '\t';
1262
- break;
1263
- case '0':
1264
- c = '\0';
1265
- // Octal literals fail in strict mode
1266
- // check if the number is between 00 and 07
1267
- // where 'n' is the token next to 'c'
1268
- if (n >= 0 && n <= 7 && directive["use strict"]) {
1269
- warningAt(
1270
- "Octal literals are not allowed in strict mode.",
1271
- line, character);
1272
- }
1273
- break;
1274
- case 'u':
1275
- esc(4);
1276
- break;
1277
- case 'v':
1278
- if (jsonmode) {
1279
- warningAt("Avoid \\v.", line, character);
1280
- }
1281
- c = '\v';
1282
- break;
1283
- case 'x':
1284
- if (jsonmode) {
1285
- warningAt("Avoid \\x-.", line, character);
1286
- }
1287
- esc(2);
1288
- break;
1289
- case '':
1290
- // last character is escape character
1291
- // always allow new line if escaped, but show
1292
- // warning if option is not set
1293
- allowNewLine = true;
1294
- if (option.multistr) {
1295
- if (jsonmode) {
1296
- warningAt("Avoid EOL escapement.", line, character);
1297
- }
1298
- c = '';
1299
- character -= 1;
1300
- break;
1301
- }
1302
- warningAt("Bad escapement of EOL. Use option multistr if needed.",
1303
- line, character);
1304
- break;
1305
- default:
1306
- warningAt("Bad escapement.", line, character);
1307
- }
1308
- }
1309
- r += c;
1310
- character += 1;
1311
- j += 1;
1312
- }
1313
- }
1314
-
1315
- for (;;) {
1316
- if (!s) {
1317
- return it(nextLine() ? '(endline)' : '(end)', '');
1318
- }
1319
- t = match(tx);
1320
- if (!t) {
1321
- t = '';
1322
- c = '';
1323
- while (s && s < '!') {
1324
- s = s.substr(1);
1325
- }
1326
- if (s) {
1327
- errorAt("Unexpected '{a}'.", line, character, s.substr(0, 1));
1328
- s = '';
1329
- }
1330
- } else {
1331
-
1332
- // identifier
1333
-
1334
- if (c.isAlpha() || c === '_' || c === '$') {
1335
- return it('(identifier)', t);
1336
- }
1337
-
1338
- // number
1339
-
1340
- if (c.isDigit()) {
1341
- if (!isFinite(Number(t))) {
1342
- warningAt("Bad number '{a}'.",
1343
- line, character, t);
1344
- }
1345
- if (s.substr(0, 1).isAlpha()) {
1346
- warningAt("Missing space after '{a}'.",
1347
- line, character, t);
1348
- }
1349
- if (c === '0') {
1350
- d = t.substr(1, 1);
1351
- if (d.isDigit()) {
1352
- if (token.id !== '.') {
1353
- warningAt("Don't use extra leading zeros '{a}'.",
1354
- line, character, t);
1355
- }
1356
- } else if (jsonmode && (d === 'x' || d === 'X')) {
1357
- warningAt("Avoid 0x-. '{a}'.",
1358
- line, character, t);
1359
- }
1360
- }
1361
- if (t.substr(t.length - 1) === '.') {
1362
- warningAt(
1363
- "A trailing decimal point can be confused with a dot '{a}'.", line, character, t);
1364
- }
1365
- return it('(number)', t);
1366
- }
1367
- switch (t) {
1368
-
1369
- // string
1370
-
1371
- case '"':
1372
- case "'":
1373
- return string(t);
1374
-
1375
- // // comment
1376
-
1377
- case '//':
1378
- s = '';
1379
- token.comment = true;
1380
- break;
1381
-
1382
- // /* comment
1383
-
1384
- case '/*':
1385
- for (;;) {
1386
- i = s.search(lx);
1387
- if (i >= 0) {
1388
- break;
1389
- }
1390
- if (!nextLine()) {
1391
- errorAt("Unclosed comment.", line, character);
1392
- }
1393
- }
1394
- character += i + 2;
1395
- if (s.substr(i, 1) === '/') {
1396
- errorAt("Nested comment.", line, character);
1397
- }
1398
- s = s.substr(i + 2);
1399
- token.comment = true;
1400
- break;
1401
-
1402
- // /*members /*jshint /*global
1403
-
1404
- case '/*members':
1405
- case '/*member':
1406
- case '/*jshint':
1407
- case '/*jslint':
1408
- case '/*global':
1409
- case '*/':
1410
- return {
1411
- value: t,
1412
- type: 'special',
1413
- line: line,
1414
- character: character,
1415
- from: from
1416
- };
1417
-
1418
- case '':
1419
- break;
1420
- // /
1421
- case '/':
1422
- if (token.id === '/=') {
1423
- errorAt("A regular expression literal can be confused with '/='.",
1424
- line, from);
1425
- }
1426
- if (prereg) {
1427
- depth = 0;
1428
- captures = 0;
1429
- l = 0;
1430
- for (;;) {
1431
- b = true;
1432
- c = s.charAt(l);
1433
- l += 1;
1434
- switch (c) {
1435
- case '':
1436
- errorAt("Unclosed regular expression.", line, from);
1437
- return quit('Stopping.', line, from);
1438
- case '/':
1439
- if (depth > 0) {
1440
- warningAt("{a} unterminated regular expression " +
1441
- "group(s).", line, from + l, depth);
1442
- }
1443
- c = s.substr(0, l - 1);
1444
- q = {
1445
- g: true,
1446
- i: true,
1447
- m: true
1448
- };
1449
- while (q[s.charAt(l)] === true) {
1450
- q[s.charAt(l)] = false;
1451
- l += 1;
1452
- }
1453
- character += l;
1454
- s = s.substr(l);
1455
- q = s.charAt(0);
1456
- if (q === '/' || q === '*') {
1457
- errorAt("Confusing regular expression.",
1458
- line, from);
1459
- }
1460
- return it('(regexp)', c);
1461
- case '\\':
1462
- c = s.charAt(l);
1463
- if (c < ' ') {
1464
- warningAt(
1465
- "Unexpected control character in regular expression.", line, from + l);
1466
- } else if (c === '<') {
1467
- warningAt(
1468
- "Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
1469
- }
1470
- l += 1;
1471
- break;
1472
- case '(':
1473
- depth += 1;
1474
- b = false;
1475
- if (s.charAt(l) === '?') {
1476
- l += 1;
1477
- switch (s.charAt(l)) {
1478
- case ':':
1479
- case '=':
1480
- case '!':
1481
- l += 1;
1482
- break;
1483
- default:
1484
- warningAt(
1485
- "Expected '{a}' and instead saw '{b}'.", line, from + l, ':', s.charAt(l));
1486
- }
1487
- } else {
1488
- captures += 1;
1489
- }
1490
- break;
1491
- case '|':
1492
- b = false;
1493
- break;
1494
- case ')':
1495
- if (depth === 0) {
1496
- warningAt("Unescaped '{a}'.",
1497
- line, from + l, ')');
1498
- } else {
1499
- depth -= 1;
1500
- }
1501
- break;
1502
- case ' ':
1503
- q = 1;
1504
- while (s.charAt(l) === ' ') {
1505
- l += 1;
1506
- q += 1;
1507
- }
1508
- if (q > 1) {
1509
- warningAt(
1510
- "Spaces are hard to count. Use {{a}}.", line, from + l, q);
1511
- }
1512
- break;
1513
- case '[':
1514
- c = s.charAt(l);
1515
- if (c === '^') {
1516
- l += 1;
1517
- if (option.regexp) {
1518
- warningAt("Insecure '{a}'.",
1519
- line, from + l, c);
1520
- } else if (s.charAt(l) === ']') {
1521
- errorAt("Unescaped '{a}'.",
1522
- line, from + l, '^');
1523
- }
1524
- }
1525
- if (c === ']') {
1526
- warningAt("Empty class.", line,
1527
- from + l - 1);
1528
- }
1529
- isLiteral = false;
1530
- isInRange = false;
1531
- klass: do {
1532
- c = s.charAt(l);
1533
- l += 1;
1534
- switch (c) {
1535
- case '[':
1536
- case '^':
1537
- warningAt("Unescaped '{a}'.",
1538
- line, from + l, c);
1539
- if (isInRange) {
1540
- isInRange = false;
1541
- } else {
1542
- isLiteral = true;
1543
- }
1544
- break;
1545
- case '-':
1546
- if (isLiteral && !isInRange) {
1547
- isLiteral = false;
1548
- isInRange = true;
1549
- } else if (isInRange) {
1550
- isInRange = false;
1551
- } else if (s.charAt(l) === ']') {
1552
- isInRange = true;
1553
- } else {
1554
- if (option.regexdash !== (l === 2 || (l === 3 &&
1555
- s.charAt(1) === '^'))) {
1556
- warningAt("Unescaped '{a}'.",
1557
- line, from + l - 1, '-');
1558
- }
1559
- isLiteral = true;
1560
- }
1561
- break;
1562
- case ']':
1563
- if (isInRange && !option.regexdash) {
1564
- warningAt("Unescaped '{a}'.",
1565
- line, from + l - 1, '-');
1566
- }
1567
- break klass;
1568
- case '\\':
1569
- c = s.charAt(l);
1570
- if (c < ' ') {
1571
- warningAt(
1572
- "Unexpected control character in regular expression.", line, from + l);
1573
- } else if (c === '<') {
1574
- warningAt(
1575
- "Unexpected escaped character '{a}' in regular expression.", line, from + l, c);
1576
- }
1577
- l += 1;
1578
-
1579
- // \w, \s and \d are never part of a character range
1580
- if (/[wsd]/i.test(c)) {
1581
- if (isInRange) {
1582
- warningAt("Unescaped '{a}'.",
1583
- line, from + l, '-');
1584
- isInRange = false;
1585
- }
1586
- isLiteral = false;
1587
- } else if (isInRange) {
1588
- isInRange = false;
1589
- } else {
1590
- isLiteral = true;
1591
- }
1592
- break;
1593
- case '/':
1594
- warningAt("Unescaped '{a}'.",
1595
- line, from + l - 1, '/');
1596
-
1597
- if (isInRange) {
1598
- isInRange = false;
1599
- } else {
1600
- isLiteral = true;
1601
- }
1602
- break;
1603
- case '<':
1604
- if (isInRange) {
1605
- isInRange = false;
1606
- } else {
1607
- isLiteral = true;
1608
- }
1609
- break;
1610
- default:
1611
- if (isInRange) {
1612
- isInRange = false;
1613
- } else {
1614
- isLiteral = true;
1615
- }
1616
- }
1617
- } while (c);
1618
- break;
1619
- case '.':
1620
- if (option.regexp) {
1621
- warningAt("Insecure '{a}'.", line,
1622
- from + l, c);
1623
- }
1624
- break;
1625
- case ']':
1626
- case '?':
1627
- case '{':
1628
- case '}':
1629
- case '+':
1630
- case '*':
1631
- warningAt("Unescaped '{a}'.", line,
1632
- from + l, c);
1633
- }
1634
- if (b) {
1635
- switch (s.charAt(l)) {
1636
- case '?':
1637
- case '+':
1638
- case '*':
1639
- l += 1;
1640
- if (s.charAt(l) === '?') {
1641
- l += 1;
1642
- }
1643
- break;
1644
- case '{':
1645
- l += 1;
1646
- c = s.charAt(l);
1647
- if (c < '0' || c > '9') {
1648
- warningAt(
1649
- "Expected a number and instead saw '{a}'.", line, from + l, c);
1650
- }
1651
- l += 1;
1652
- low = +c;
1653
- for (;;) {
1654
- c = s.charAt(l);
1655
- if (c < '0' || c > '9') {
1656
- break;
1657
- }
1658
- l += 1;
1659
- low = +c + (low * 10);
1660
- }
1661
- high = low;
1662
- if (c === ',') {
1663
- l += 1;
1664
- high = Infinity;
1665
- c = s.charAt(l);
1666
- if (c >= '0' && c <= '9') {
1667
- l += 1;
1668
- high = +c;
1669
- for (;;) {
1670
- c = s.charAt(l);
1671
- if (c < '0' || c > '9') {
1672
- break;
1673
- }
1674
- l += 1;
1675
- high = +c + (high * 10);
1676
- }
1677
- }
1678
- }
1679
- if (s.charAt(l) !== '}') {
1680
- warningAt(
1681
- "Expected '{a}' and instead saw '{b}'.", line, from + l, '}', c);
1682
- } else {
1683
- l += 1;
1684
- }
1685
- if (s.charAt(l) === '?') {
1686
- l += 1;
1687
- }
1688
- if (low > high) {
1689
- warningAt(
1690
- "'{a}' should not be greater than '{b}'.", line, from + l, low, high);
1691
- }
1692
- }
1693
- }
1694
- }
1695
- c = s.substr(0, l - 1);
1696
- character += l;
1697
- s = s.substr(l);
1698
- return it('(regexp)', c);
1699
- }
1700
- return it('(punctuator)', t);
1701
-
1702
- // punctuator
1703
-
1704
- case '#':
1705
- return it('(punctuator)', t);
1706
- default:
1707
- return it('(punctuator)', t);
1708
- }
1709
- }
1710
- }
1711
- }
1712
- };
1713
- }());
1714
-
1715
-
1716
- function addlabel(t, type) {
1717
-
1718
- if (t === 'hasOwnProperty') {
1719
- warning("'hasOwnProperty' is a really bad name.");
1720
- }
1721
-
1722
- // Define t in the current function in the current scope.
1723
- if (is_own(funct, t) && !funct['(global)']) {
1724
- if (funct[t] === true) {
1725
- if (option.latedef)
1726
- warning("'{a}' was used before it was defined.", nexttoken, t);
1727
- } else {
1728
- if (!option.shadow && type !== "exception")
1729
- warning("'{a}' is already defined.", nexttoken, t);
1730
- }
1731
- }
1732
-
1733
- funct[t] = type;
1734
- if (funct['(global)']) {
1735
- global[t] = funct;
1736
- if (is_own(implied, t)) {
1737
- if (option.latedef)
1738
- warning("'{a}' was used before it was defined.", nexttoken, t);
1739
- delete implied[t];
1740
- }
1741
- } else {
1742
- scope[t] = funct;
1743
- }
1744
- }
1745
-
1746
-
1747
- function doOption() {
1748
- var b, obj, filter, o = nexttoken.value, t, v;
1749
-
1750
- switch (o) {
1751
- case '*/':
1752
- error("Unbegun comment.");
1753
- break;
1754
- case '/*members':
1755
- case '/*member':
1756
- o = '/*members';
1757
- if (!membersOnly) {
1758
- membersOnly = {};
1759
- }
1760
- obj = membersOnly;
1761
- break;
1762
- case '/*jshint':
1763
- case '/*jslint':
1764
- obj = option;
1765
- filter = boolOptions;
1766
- break;
1767
- case '/*global':
1768
- obj = predefined;
1769
- break;
1770
- default:
1771
- error("What?");
1772
- }
1773
-
1774
- t = lex.token();
1775
- loop: for (;;) {
1776
- for (;;) {
1777
- if (t.type === 'special' && t.value === '*/') {
1778
- break loop;
1779
- }
1780
- if (t.id !== '(endline)' && t.id !== ',') {
1781
- break;
1782
- }
1783
- t = lex.token();
1784
- }
1785
- if (t.type !== '(string)' && t.type !== '(identifier)' &&
1786
- o !== '/*members') {
1787
- error("Bad option.", t);
1788
- }
1789
-
1790
- v = lex.token();
1791
- if (v.id === ':') {
1792
- v = lex.token();
1793
-
1794
- if (obj === membersOnly) {
1795
- error("Expected '{a}' and instead saw '{b}'.",
1796
- t, '*/', ':');
1797
- }
1798
-
1799
- if (o === '/*jshint') {
1800
- checkOption(t.value, t);
1801
- }
1802
-
1803
- if (t.value === 'indent' && (o === '/*jshint' || o === '/*jslint')) {
1804
- b = +v.value;
1805
- if (typeof b !== 'number' || !isFinite(b) || b <= 0 ||
1806
- Math.floor(b) !== b) {
1807
- error("Expected a small integer and instead saw '{a}'.",
1808
- v, v.value);
1809
- }
1810
- obj.white = true;
1811
- obj.indent = b;
1812
- } else if (t.value === 'maxerr' && (o === '/*jshint' || o === '/*jslint')) {
1813
- b = +v.value;
1814
- if (typeof b !== 'number' || !isFinite(b) || b <= 0 ||
1815
- Math.floor(b) !== b) {
1816
- error("Expected a small integer and instead saw '{a}'.",
1817
- v, v.value);
1818
- }
1819
- obj.maxerr = b;
1820
- } else if (t.value === 'maxlen' && (o === '/*jshint' || o === '/*jslint')) {
1821
- b = +v.value;
1822
- if (typeof b !== 'number' || !isFinite(b) || b <= 0 ||
1823
- Math.floor(b) !== b) {
1824
- error("Expected a small integer and instead saw '{a}'.",
1825
- v, v.value);
1826
- }
1827
- obj.maxlen = b;
1828
- } else if (t.value === 'validthis') {
1829
- if (funct['(global)']) {
1830
- error("Option 'validthis' can't be used in a global scope.");
1831
- } else {
1832
- if (v.value === 'true' || v.value === 'false')
1833
- obj[t.value] = v.value === 'true';
1834
- else
1835
- error("Bad option value.", v);
1836
- }
1837
- } else if (v.value === 'true') {
1838
- obj[t.value] = true;
1839
- } else if (v.value === 'false') {
1840
- obj[t.value] = false;
1841
- } else {
1842
- error("Bad option value.", v);
1843
- }
1844
- t = lex.token();
1845
- } else {
1846
- if (o === '/*jshint' || o === '/*jslint') {
1847
- error("Missing option value.", t);
1848
- }
1849
- obj[t.value] = false;
1850
- t = v;
1851
- }
1852
- }
1853
- if (filter) {
1854
- assume();
1855
- }
1856
- }
1857
-
1858
-
1859
- // We need a peek function. If it has an argument, it peeks that much farther
1860
- // ahead. It is used to distinguish
1861
- // for ( var i in ...
1862
- // from
1863
- // for ( var i = ...
1864
-
1865
- function peek(p) {
1866
- var i = p || 0, j = 0, t;
1867
-
1868
- while (j <= i) {
1869
- t = lookahead[j];
1870
- if (!t) {
1871
- t = lookahead[j] = lex.token();
1872
- }
1873
- j += 1;
1874
- }
1875
- return t;
1876
- }
1877
-
1878
-
1879
-
1880
- // Produce the next token. It looks for programming errors.
1881
-
1882
- function advance(id, t) {
1883
- switch (token.id) {
1884
- case '(number)':
1885
- if (nexttoken.id === '.') {
1886
- warning("A dot following a number can be confused with a decimal point.", token);
1887
- }
1888
- break;
1889
- case '-':
1890
- if (nexttoken.id === '-' || nexttoken.id === '--') {
1891
- warning("Confusing minusses.");
1892
- }
1893
- break;
1894
- case '+':
1895
- if (nexttoken.id === '+' || nexttoken.id === '++') {
1896
- warning("Confusing plusses.");
1897
- }
1898
- break;
1899
- }
1900
-
1901
- if (token.type === '(string)' || token.identifier) {
1902
- anonname = token.value;
1903
- }
1904
-
1905
- if (id && nexttoken.id !== id) {
1906
- if (t) {
1907
- if (nexttoken.id === '(end)') {
1908
- warning("Unmatched '{a}'.", t, t.id);
1909
- } else {
1910
- warning("Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.",
1911
- nexttoken, id, t.id, t.line, nexttoken.value);
1912
- }
1913
- } else if (nexttoken.type !== '(identifier)' ||
1914
- nexttoken.value !== id) {
1915
- warning("Expected '{a}' and instead saw '{b}'.",
1916
- nexttoken, id, nexttoken.value);
1917
- }
1918
- }
1919
-
1920
- prevtoken = token;
1921
- token = nexttoken;
1922
- for (;;) {
1923
- nexttoken = lookahead.shift() || lex.token();
1924
- if (nexttoken.id === '(end)' || nexttoken.id === '(error)') {
1925
- return;
1926
- }
1927
- if (nexttoken.type === 'special') {
1928
- doOption();
1929
- } else {
1930
- if (nexttoken.id !== '(endline)') {
1931
- break;
1932
- }
1933
- }
1934
- }
1935
- }
1936
-
1937
-
1938
- // This is the heart of JSHINT, the Pratt parser. In addition to parsing, it
1939
- // is looking for ad hoc lint patterns. We add .fud to Pratt's model, which is
1940
- // like .nud except that it is only used on the first token of a statement.
1941
- // Having .fud makes it much easier to define statement-oriented languages like
1942
- // JavaScript. I retained Pratt's nomenclature.
1943
-
1944
- // .nud Null denotation
1945
- // .fud First null denotation
1946
- // .led Left denotation
1947
- // lbp Left binding power
1948
- // rbp Right binding power
1949
-
1950
- // They are elements of the parsing method called Top Down Operator Precedence.
1951
-
1952
- function expression(rbp, initial) {
1953
- var left, isArray = false, isObject = false;
1954
-
1955
- if (nexttoken.id === '(end)')
1956
- error("Unexpected early end of program.", token);
1957
-
1958
- advance();
1959
- if (initial) {
1960
- anonname = 'anonymous';
1961
- funct['(verb)'] = token.value;
1962
- }
1963
- if (initial === true && token.fud) {
1964
- left = token.fud();
1965
- } else {
1966
- if (token.nud) {
1967
- left = token.nud();
1968
- } else {
1969
- if (nexttoken.type === '(number)' && token.id === '.') {
1970
- warning("A leading decimal point can be confused with a dot: '.{a}'.",
1971
- token, nexttoken.value);
1972
- advance();
1973
- return token;
1974
- } else {
1975
- error("Expected an identifier and instead saw '{a}'.",
1976
- token, token.id);
1977
- }
1978
- }
1979
- while (rbp < nexttoken.lbp) {
1980
- isArray = token.value === 'Array';
1981
- isObject = token.value === 'Object';
1982
- advance();
1983
- if (isArray && token.id === '(' && nexttoken.id === ')')
1984
- warning("Use the array literal notation [].", token);
1985
- if (isObject && token.id === '(' && nexttoken.id === ')')
1986
- warning("Use the object literal notation {}.", token);
1987
- if (token.led) {
1988
- left = token.led(left);
1989
- } else {
1990
- error("Expected an operator and instead saw '{a}'.",
1991
- token, token.id);
1992
- }
1993
- }
1994
- }
1995
- return left;
1996
- }
1997
-
1998
-
1999
- // Functions for conformance of style.
2000
-
2001
- function adjacent(left, right) {
2002
- left = left || token;
2003
- right = right || nexttoken;
2004
- if (option.white) {
2005
- if (left.character !== right.from && left.line === right.line) {
2006
- left.from += (left.character - left.from);
2007
- warning("Unexpected space after '{a}'.", left, left.value);
2008
- }
2009
- }
2010
- }
2011
-
2012
- function nobreak(left, right) {
2013
- left = left || token;
2014
- right = right || nexttoken;
2015
- if (option.white && (left.character !== right.from || left.line !== right.line)) {
2016
- warning("Unexpected space before '{a}'.", right, right.value);
2017
- }
2018
- }
2019
-
2020
- function nospace(left, right) {
2021
- left = left || token;
2022
- right = right || nexttoken;
2023
- if (option.white && !left.comment) {
2024
- if (left.line === right.line) {
2025
- adjacent(left, right);
2026
- }
2027
- }
2028
- }
2029
-
2030
- function nonadjacent(left, right) {
2031
- if (option.white) {
2032
- left = left || token;
2033
- right = right || nexttoken;
2034
- if (left.line === right.line && left.character === right.from) {
2035
- left.from += (left.character - left.from);
2036
- warning("Missing space after '{a}'.",
2037
- left, left.value);
2038
- }
2039
- }
2040
- }
2041
-
2042
- function nobreaknonadjacent(left, right) {
2043
- left = left || token;
2044
- right = right || nexttoken;
2045
- if (!option.laxbreak && left.line !== right.line) {
2046
- warning("Bad line breaking before '{a}'.", right, right.id);
2047
- } else if (option.white) {
2048
- left = left || token;
2049
- right = right || nexttoken;
2050
- if (left.character === right.from) {
2051
- left.from += (left.character - left.from);
2052
- warning("Missing space after '{a}'.",
2053
- left, left.value);
2054
- }
2055
- }
2056
- }
2057
-
2058
- function indentation(bias) {
2059
- var i;
2060
- if (option.white && nexttoken.id !== '(end)') {
2061
- i = indent + (bias || 0);
2062
- if (nexttoken.from !== i) {
2063
- warning(
2064
- "Expected '{a}' to have an indentation at {b} instead at {c}.",
2065
- nexttoken, nexttoken.value, i, nexttoken.from);
2066
- }
2067
- }
2068
- }
2069
-
2070
- function nolinebreak(t) {
2071
- t = t || token;
2072
- if (t.line !== nexttoken.line) {
2073
- warning("Line breaking error '{a}'.", t, t.value);
2074
- }
2075
- }
2076
-
2077
-
2078
- function comma() {
2079
- if (token.line !== nexttoken.line) {
2080
- if (!option.laxcomma) {
2081
- if (comma.first) {
2082
- warning("Comma warnings can be turned off with 'laxcomma'");
2083
- comma.first = false;
2084
- }
2085
- warning("Bad line breaking before '{a}'.", token, nexttoken.id);
2086
- }
2087
- } else if (!token.comment && token.character !== nexttoken.from && option.white) {
2088
- token.from += (token.character - token.from);
2089
- warning("Unexpected space after '{a}'.", token, token.value);
2090
- }
2091
- advance(',');
2092
- nonadjacent(token, nexttoken);
2093
- }
2094
-
2095
-
2096
- // Functional constructors for making the symbols that will be inherited by
2097
- // tokens.
2098
-
2099
- function symbol(s, p) {
2100
- var x = syntax[s];
2101
- if (!x || typeof x !== 'object') {
2102
- syntax[s] = x = {
2103
- id: s,
2104
- lbp: p,
2105
- value: s
2106
- };
2107
- }
2108
- return x;
2109
- }
2110
-
2111
-
2112
- function delim(s) {
2113
- return symbol(s, 0);
2114
- }
2115
-
2116
-
2117
- function stmt(s, f) {
2118
- var x = delim(s);
2119
- x.identifier = x.reserved = true;
2120
- x.fud = f;
2121
- return x;
2122
- }
2123
-
2124
-
2125
- function blockstmt(s, f) {
2126
- var x = stmt(s, f);
2127
- x.block = true;
2128
- return x;
2129
- }
2130
-
2131
-
2132
- function reserveName(x) {
2133
- var c = x.id.charAt(0);
2134
- if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
2135
- x.identifier = x.reserved = true;
2136
- }
2137
- return x;
2138
- }
2139
-
2140
-
2141
- function prefix(s, f) {
2142
- var x = symbol(s, 150);
2143
- reserveName(x);
2144
- x.nud = (typeof f === 'function') ? f : function () {
2145
- this.right = expression(150);
2146
- this.arity = 'unary';
2147
- if (this.id === '++' || this.id === '--') {
2148
- if (option.plusplus) {
2149
- warning("Unexpected use of '{a}'.", this, this.id);
2150
- } else if ((!this.right.identifier || this.right.reserved) &&
2151
- this.right.id !== '.' && this.right.id !== '[') {
2152
- warning("Bad operand.", this);
2153
- }
2154
- }
2155
- return this;
2156
- };
2157
- return x;
2158
- }
2159
-
2160
-
2161
- function type(s, f) {
2162
- var x = delim(s);
2163
- x.type = s;
2164
- x.nud = f;
2165
- return x;
2166
- }
2167
-
2168
-
2169
- function reserve(s, f) {
2170
- var x = type(s, f);
2171
- x.identifier = x.reserved = true;
2172
- return x;
2173
- }
2174
-
2175
-
2176
- function reservevar(s, v) {
2177
- return reserve(s, function () {
2178
- if (typeof v === 'function') {
2179
- v(this);
2180
- }
2181
- return this;
2182
- });
2183
- }
2184
-
2185
-
2186
- function infix(s, f, p, w) {
2187
- var x = symbol(s, p);
2188
- reserveName(x);
2189
- x.led = function (left) {
2190
- if (!w) {
2191
- nobreaknonadjacent(prevtoken, token);
2192
- nonadjacent(token, nexttoken);
2193
- }
2194
- if (s === "in" && left.id === "!") {
2195
- warning("Confusing use of '{a}'.", left, '!');
2196
- }
2197
- if (typeof f === 'function') {
2198
- return f(left, this);
2199
- } else {
2200
- this.left = left;
2201
- this.right = expression(p);
2202
- return this;
2203
- }
2204
- };
2205
- return x;
2206
- }
2207
-
2208
-
2209
- function relation(s, f) {
2210
- var x = symbol(s, 100);
2211
- x.led = function (left) {
2212
- nobreaknonadjacent(prevtoken, token);
2213
- nonadjacent(token, nexttoken);
2214
- var right = expression(100);
2215
- if ((left && left.id === 'NaN') || (right && right.id === 'NaN')) {
2216
- warning("Use the isNaN function to compare with NaN.", this);
2217
- } else if (f) {
2218
- f.apply(this, [left, right]);
2219
- }
2220
- if (left.id === '!') {
2221
- warning("Confusing use of '{a}'.", left, '!');
2222
- }
2223
- if (right.id === '!') {
2224
- warning("Confusing use of '{a}'.", right, '!');
2225
- }
2226
- this.left = left;
2227
- this.right = right;
2228
- return this;
2229
- };
2230
- return x;
2231
- }
2232
-
2233
-
2234
- function isPoorRelation(node) {
2235
- return node &&
2236
- ((node.type === '(number)' && +node.value === 0) ||
2237
- (node.type === '(string)' && node.value === '') ||
2238
- (node.type === 'null' && !option.eqnull) ||
2239
- node.type === 'true' ||
2240
- node.type === 'false' ||
2241
- node.type === 'undefined');
2242
- }
2243
-
2244
-
2245
- function assignop(s, f) {
2246
- symbol(s, 20).exps = true;
2247
- return infix(s, function (left, that) {
2248
- var l;
2249
- that.left = left;
2250
- if (predefined[left.value] === false &&
2251
- scope[left.value]['(global)'] === true) {
2252
- warning("Read only.", left);
2253
- } else if (left['function']) {
2254
- warning("'{a}' is a function.", left, left.value);
2255
- }
2256
- if (left) {
2257
- if (option.esnext && funct[left.value] === 'const') {
2258
- warning("Attempting to override '{a}' which is a constant", left, left.value);
2259
- }
2260
- if (left.id === '.' || left.id === '[') {
2261
- if (!left.left || left.left.value === 'arguments') {
2262
- warning('Bad assignment.', that);
2263
- }
2264
- that.right = expression(19);
2265
- return that;
2266
- } else if (left.identifier && !left.reserved) {
2267
- if (funct[left.value] === 'exception') {
2268
- warning("Do not assign to the exception parameter.", left);
2269
- }
2270
- that.right = expression(19);
2271
- return that;
2272
- }
2273
- if (left === syntax['function']) {
2274
- warning(
2275
- "Expected an identifier in an assignment and instead saw a function invocation.",
2276
- token);
2277
- }
2278
- }
2279
- error("Bad assignment.", that);
2280
- }, 20);
2281
- }
2282
-
2283
-
2284
- function bitwise(s, f, p) {
2285
- var x = symbol(s, p);
2286
- reserveName(x);
2287
- x.led = (typeof f === 'function') ? f : function (left) {
2288
- if (option.bitwise) {
2289
- warning("Unexpected use of '{a}'.", this, this.id);
2290
- }
2291
- this.left = left;
2292
- this.right = expression(p);
2293
- return this;
2294
- };
2295
- return x;
2296
- }
2297
-
2298
-
2299
- function bitwiseassignop(s) {
2300
- symbol(s, 20).exps = true;
2301
- return infix(s, function (left, that) {
2302
- if (option.bitwise) {
2303
- warning("Unexpected use of '{a}'.", that, that.id);
2304
- }
2305
- nonadjacent(prevtoken, token);
2306
- nonadjacent(token, nexttoken);
2307
- if (left) {
2308
- if (left.id === '.' || left.id === '[' ||
2309
- (left.identifier && !left.reserved)) {
2310
- expression(19);
2311
- return that;
2312
- }
2313
- if (left === syntax['function']) {
2314
- warning(
2315
- "Expected an identifier in an assignment, and instead saw a function invocation.",
2316
- token);
2317
- }
2318
- return that;
2319
- }
2320
- error("Bad assignment.", that);
2321
- }, 20);
2322
- }
2323
-
2324
-
2325
- function suffix(s, f) {
2326
- var x = symbol(s, 150);
2327
- x.led = function (left) {
2328
- if (option.plusplus) {
2329
- warning("Unexpected use of '{a}'.", this, this.id);
2330
- } else if ((!left.identifier || left.reserved) &&
2331
- left.id !== '.' && left.id !== '[') {
2332
- warning("Bad operand.", this);
2333
- }
2334
- this.left = left;
2335
- return this;
2336
- };
2337
- return x;
2338
- }
2339
-
2340
-
2341
- // fnparam means that this identifier is being defined as a function
2342
- // argument (see identifier())
2343
- function optionalidentifier(fnparam) {
2344
- if (nexttoken.identifier) {
2345
- advance();
2346
- if (token.reserved && !option.es5) {
2347
- // `undefined` as a function param is a common pattern to protect
2348
- // against the case when somebody does `undefined = true` and
2349
- // help with minification. More info: https://gist.github.com/315916
2350
- if (!fnparam || token.value !== 'undefined') {
2351
- warning("Expected an identifier and instead saw '{a}' (a reserved word).",
2352
- token, token.id);
2353
- }
2354
- }
2355
- return token.value;
2356
- }
2357
- }
2358
-
2359
- // fnparam means that this identifier is being defined as a function
2360
- // argument
2361
- function identifier(fnparam) {
2362
- var i = optionalidentifier(fnparam);
2363
- if (i) {
2364
- return i;
2365
- }
2366
- if (token.id === 'function' && nexttoken.id === '(') {
2367
- warning("Missing name in function declaration.");
2368
- } else {
2369
- error("Expected an identifier and instead saw '{a}'.",
2370
- nexttoken, nexttoken.value);
2371
- }
2372
- }
2373
-
2374
-
2375
- function reachable(s) {
2376
- var i = 0, t;
2377
- if (nexttoken.id !== ';' || noreach) {
2378
- return;
2379
- }
2380
- for (;;) {
2381
- t = peek(i);
2382
- if (t.reach) {
2383
- return;
2384
- }
2385
- if (t.id !== '(endline)') {
2386
- if (t.id === 'function') {
2387
- if (!option.latedef) {
2388
- break;
2389
- }
2390
- warning(
2391
- "Inner functions should be listed at the top of the outer function.", t);
2392
- break;
2393
- }
2394
- warning("Unreachable '{a}' after '{b}'.", t, t.value, s);
2395
- break;
2396
- }
2397
- i += 1;
2398
- }
2399
- }
2400
-
2401
-
2402
- function statement(noindent) {
2403
- var i = indent, r, s = scope, t = nexttoken;
2404
-
2405
- if (t.id === ";") {
2406
- advance(";");
2407
- return;
2408
- }
2409
-
2410
- // Is this a labelled statement?
2411
-
2412
- if (t.identifier && !t.reserved && peek().id === ':') {
2413
- advance();
2414
- advance(':');
2415
- scope = Object.create(s);
2416
- addlabel(t.value, 'label');
2417
- if (!nexttoken.labelled) {
2418
- warning("Label '{a}' on {b} statement.",
2419
- nexttoken, t.value, nexttoken.value);
2420
- }
2421
- if (jx.test(t.value + ':')) {
2422
- warning("Label '{a}' looks like a javascript url.",
2423
- t, t.value);
2424
- }
2425
- nexttoken.label = t.value;
2426
- t = nexttoken;
2427
- }
2428
-
2429
- // Parse the statement.
2430
-
2431
- if (!noindent) {
2432
- indentation();
2433
- }
2434
- r = expression(0, true);
2435
-
2436
- // Look for the final semicolon.
2437
- if (!t.block) {
2438
- if (!option.expr && (!r || !r.exps)) {
2439
- warning("Expected an assignment or function call and instead saw an expression.",
2440
- token);
2441
- } else if (option.nonew && r.id === '(' && r.left.id === 'new') {
2442
- warning("Do not use 'new' for side effects.");
2443
- }
2444
-
2445
- if (nexttoken.id === ',') {
2446
- return comma();
2447
- }
2448
-
2449
- if (nexttoken.id !== ';') {
2450
- if (!option.asi) {
2451
- // If this is the last statement in a block that ends on
2452
- // the same line *and* option lastsemic is on, ignore the warning.
2453
- // Otherwise, complain about missing semicolon.
2454
- if (!option.lastsemic || nexttoken.id !== '}' ||
2455
- nexttoken.line !== token.line) {
2456
- warningAt("Missing semicolon.", token.line, token.character);
2457
- }
2458
- }
2459
- } else {
2460
- adjacent(token, nexttoken);
2461
- advance(';');
2462
- nonadjacent(token, nexttoken);
2463
- }
2464
- }
2465
-
2466
- // Restore the indentation.
2467
-
2468
- indent = i;
2469
- scope = s;
2470
- return r;
2471
- }
2472
-
2473
-
2474
- function statements(startLine) {
2475
- var a = [], f, p;
2476
-
2477
- while (!nexttoken.reach && nexttoken.id !== '(end)') {
2478
- if (nexttoken.id === ';') {
2479
- p = peek();
2480
- if (!p || p.id !== "(") {
2481
- warning("Unnecessary semicolon.");
2482
- }
2483
- advance(';');
2484
- } else {
2485
- a.push(statement(startLine === nexttoken.line));
2486
- }
2487
- }
2488
- return a;
2489
- }
2490
-
2491
-
2492
- /*
2493
- * read all directives
2494
- * recognizes a simple form of asi, but always
2495
- * warns, if it is used
2496
- */
2497
- function directives() {
2498
- var i, p, pn;
2499
-
2500
- for (;;) {
2501
- if (nexttoken.id === "(string)") {
2502
- p = peek(0);
2503
- if (p.id === "(endline)") {
2504
- i = 1;
2505
- do {
2506
- pn = peek(i);
2507
- i = i + 1;
2508
- } while (pn.id === "(endline)");
2509
-
2510
- if (pn.id !== ";") {
2511
- if (pn.id !== "(string)" && pn.id !== "(number)" &&
2512
- pn.id !== "(regexp)" && pn.identifier !== true &&
2513
- pn.id !== "}") {
2514
- break;
2515
- }
2516
- warning("Missing semicolon.", nexttoken);
2517
- } else {
2518
- p = pn;
2519
- }
2520
- } else if (p.id === "}") {
2521
- // directive with no other statements, warn about missing semicolon
2522
- warning("Missing semicolon.", p);
2523
- } else if (p.id !== ";") {
2524
- break;
2525
- }
2526
-
2527
- indentation();
2528
- advance();
2529
- if (directive[token.value]) {
2530
- warning("Unnecessary directive \"{a}\".", token, token.value);
2531
- }
2532
-
2533
- if (token.value === "use strict") {
2534
- option.newcap = true;
2535
- option.undef = true;
2536
- }
2537
-
2538
- // there's no directive negation, so always set to true
2539
- directive[token.value] = true;
2540
-
2541
- if (p.id === ";") {
2542
- advance(";");
2543
- }
2544
- continue;
2545
- }
2546
- break;
2547
- }
2548
- }
2549
-
2550
-
2551
- /*
2552
- * Parses a single block. A block is a sequence of statements wrapped in
2553
- * braces.
2554
- *
2555
- * ordinary - true for everything but function bodies and try blocks.
2556
- * stmt - true if block can be a single statement (e.g. in if/for/while).
2557
- * isfunc - true if block is a function body
2558
- */
2559
- function block(ordinary, stmt, isfunc) {
2560
- var a,
2561
- b = inblock,
2562
- old_indent = indent,
2563
- m,
2564
- s = scope,
2565
- t,
2566
- line,
2567
- d;
2568
-
2569
- inblock = ordinary;
2570
- if (!ordinary || !option.funcscope) scope = Object.create(scope);
2571
- nonadjacent(token, nexttoken);
2572
- t = nexttoken;
2573
-
2574
- if (nexttoken.id === '{') {
2575
- advance('{');
2576
- line = token.line;
2577
- if (nexttoken.id !== '}') {
2578
- indent += option.indent;
2579
- while (!ordinary && nexttoken.from > indent) {
2580
- indent += option.indent;
2581
- }
2582
-
2583
- if (isfunc) {
2584
- m = {};
2585
- for (d in directive) {
2586
- if (is_own(directive, d)) {
2587
- m[d] = directive[d];
2588
- }
2589
- }
2590
- directives();
2591
-
2592
- if (option.strict && funct['(context)']['(global)']) {
2593
- if (!m["use strict"] && !directive["use strict"]) {
2594
- warning("Missing \"use strict\" statement.");
2595
- }
2596
- }
2597
- }
2598
-
2599
- a = statements(line);
2600
-
2601
- if (isfunc) {
2602
- directive = m;
2603
- }
2604
-
2605
- indent -= option.indent;
2606
- if (line !== nexttoken.line) {
2607
- indentation();
2608
- }
2609
- } else if (line !== nexttoken.line) {
2610
- indentation();
2611
- }
2612
- advance('}', t);
2613
- indent = old_indent;
2614
- } else if (!ordinary) {
2615
- error("Expected '{a}' and instead saw '{b}'.",
2616
- nexttoken, '{', nexttoken.value);
2617
- } else {
2618
- if (!stmt || option.curly)
2619
- warning("Expected '{a}' and instead saw '{b}'.",
2620
- nexttoken, '{', nexttoken.value);
2621
-
2622
- noreach = true;
2623
- indent += option.indent;
2624
- // test indentation only if statement is in new line
2625
- a = [statement(nexttoken.line === token.line)];
2626
- indent -= option.indent;
2627
- noreach = false;
2628
- }
2629
- funct['(verb)'] = null;
2630
- if (!ordinary || !option.funcscope) scope = s;
2631
- inblock = b;
2632
- if (ordinary && option.noempty && (!a || a.length === 0)) {
2633
- warning("Empty block.");
2634
- }
2635
- return a;
2636
- }
2637
-
2638
-
2639
- function countMember(m) {
2640
- if (membersOnly && typeof membersOnly[m] !== 'boolean') {
2641
- warning("Unexpected /*member '{a}'.", token, m);
2642
- }
2643
- if (typeof member[m] === 'number') {
2644
- member[m] += 1;
2645
- } else {
2646
- member[m] = 1;
2647
- }
2648
- }
2649
-
2650
-
2651
- function note_implied(token) {
2652
- var name = token.value, line = token.line, a = implied[name];
2653
- if (typeof a === 'function') {
2654
- a = false;
2655
- }
2656
-
2657
- if (!a) {
2658
- a = [line];
2659
- implied[name] = a;
2660
- } else if (a[a.length - 1] !== line) {
2661
- a.push(line);
2662
- }
2663
- }
2664
-
2665
-
2666
- // Build the syntax table by declaring the syntactic elements of the language.
2667
-
2668
- type('(number)', function () {
2669
- return this;
2670
- });
2671
-
2672
- type('(string)', function () {
2673
- return this;
2674
- });
2675
-
2676
- syntax['(identifier)'] = {
2677
- type: '(identifier)',
2678
- lbp: 0,
2679
- identifier: true,
2680
- nud: function () {
2681
- var v = this.value,
2682
- s = scope[v],
2683
- f;
2684
-
2685
- if (typeof s === 'function') {
2686
- // Protection against accidental inheritance.
2687
- s = undefined;
2688
- } else if (typeof s === 'boolean') {
2689
- f = funct;
2690
- funct = functions[0];
2691
- addlabel(v, 'var');
2692
- s = funct;
2693
- funct = f;
2694
- }
2695
-
2696
- // The name is in scope and defined in the current function.
2697
- if (funct === s) {
2698
- // Change 'unused' to 'var', and reject labels.
2699
- switch (funct[v]) {
2700
- case 'unused':
2701
- funct[v] = 'var';
2702
- break;
2703
- case 'unction':
2704
- funct[v] = 'function';
2705
- this['function'] = true;
2706
- break;
2707
- case 'function':
2708
- this['function'] = true;
2709
- break;
2710
- case 'label':
2711
- warning("'{a}' is a statement label.", token, v);
2712
- break;
2713
- }
2714
- } else if (funct['(global)']) {
2715
- // The name is not defined in the function. If we are in the global
2716
- // scope, then we have an undefined variable.
2717
- //
2718
- // Operators typeof and delete do not raise runtime errors even if
2719
- // the base object of a reference is null so no need to display warning
2720
- // if we're inside of typeof or delete.
2721
-
2722
- if (option.undef && typeof predefined[v] !== 'boolean') {
2723
- // Attempting to subscript a null reference will throw an
2724
- // error, even within the typeof and delete operators
2725
- if (!(anonname === 'typeof' || anonname === 'delete') ||
2726
- (nexttoken && (nexttoken.value === '.' || nexttoken.value === '['))) {
2727
-
2728
- isundef(funct, "'{a}' is not defined.", token, v);
2729
- }
2730
- }
2731
- note_implied(token);
2732
- } else {
2733
- // If the name is already defined in the current
2734
- // function, but not as outer, then there is a scope error.
2735
-
2736
- switch (funct[v]) {
2737
- case 'closure':
2738
- case 'function':
2739
- case 'var':
2740
- case 'unused':
2741
- warning("'{a}' used out of scope.", token, v);
2742
- break;
2743
- case 'label':
2744
- warning("'{a}' is a statement label.", token, v);
2745
- break;
2746
- case 'outer':
2747
- case 'global':
2748
- break;
2749
- default:
2750
- // If the name is defined in an outer function, make an outer entry,
2751
- // and if it was unused, make it var.
2752
- if (s === true) {
2753
- funct[v] = true;
2754
- } else if (s === null) {
2755
- warning("'{a}' is not allowed.", token, v);
2756
- note_implied(token);
2757
- } else if (typeof s !== 'object') {
2758
- // Operators typeof and delete do not raise runtime errors even
2759
- // if the base object of a reference is null so no need to
2760
- // display warning if we're inside of typeof or delete.
2761
- if (option.undef) {
2762
- // Attempting to subscript a null reference will throw an
2763
- // error, even within the typeof and delete operators
2764
- if (!(anonname === 'typeof' || anonname === 'delete') ||
2765
- (nexttoken &&
2766
- (nexttoken.value === '.' || nexttoken.value === '['))) {
2767
-
2768
- isundef(funct, "'{a}' is not defined.", token, v);
2769
- }
2770
- }
2771
- funct[v] = true;
2772
- note_implied(token);
2773
- } else {
2774
- switch (s[v]) {
2775
- case 'function':
2776
- case 'unction':
2777
- this['function'] = true;
2778
- s[v] = 'closure';
2779
- funct[v] = s['(global)'] ? 'global' : 'outer';
2780
- break;
2781
- case 'var':
2782
- case 'unused':
2783
- s[v] = 'closure';
2784
- funct[v] = s['(global)'] ? 'global' : 'outer';
2785
- break;
2786
- case 'closure':
2787
- case 'parameter':
2788
- funct[v] = s['(global)'] ? 'global' : 'outer';
2789
- break;
2790
- case 'label':
2791
- warning("'{a}' is a statement label.", token, v);
2792
- }
2793
- }
2794
- }
2795
- }
2796
- return this;
2797
- },
2798
- led: function () {
2799
- error("Expected an operator and instead saw '{a}'.",
2800
- nexttoken, nexttoken.value);
2801
- }
2802
- };
2803
-
2804
- type('(regexp)', function () {
2805
- return this;
2806
- });
2807
-
2808
-
2809
- // ECMAScript parser
2810
-
2811
- delim('(endline)');
2812
- delim('(begin)');
2813
- delim('(end)').reach = true;
2814
- delim('</').reach = true;
2815
- delim('<!');
2816
- delim('<!--');
2817
- delim('-->');
2818
- delim('(error)').reach = true;
2819
- delim('}').reach = true;
2820
- delim(')');
2821
- delim(']');
2822
- delim('"').reach = true;
2823
- delim("'").reach = true;
2824
- delim(';');
2825
- delim(':').reach = true;
2826
- delim(',');
2827
- delim('#');
2828
- delim('@');
2829
- reserve('else');
2830
- reserve('case').reach = true;
2831
- reserve('catch');
2832
- reserve('default').reach = true;
2833
- reserve('finally');
2834
- reservevar('arguments', function (x) {
2835
- if (directive['use strict'] && funct['(global)']) {
2836
- warning("Strict violation.", x);
2837
- }
2838
- });
2839
- reservevar('eval');
2840
- reservevar('false');
2841
- reservevar('Infinity');
2842
- reservevar('NaN');
2843
- reservevar('null');
2844
- reservevar('this', function (x) {
2845
- if (directive['use strict'] && !option.validthis && ((funct['(statement)'] &&
2846
- funct['(name)'].charAt(0) > 'Z') || funct['(global)'])) {
2847
- warning("Possible strict violation.", x);
2848
- }
2849
- });
2850
- reservevar('true');
2851
- reservevar('undefined');
2852
- assignop('=', 'assign', 20);
2853
- assignop('+=', 'assignadd', 20);
2854
- assignop('-=', 'assignsub', 20);
2855
- assignop('*=', 'assignmult', 20);
2856
- assignop('/=', 'assigndiv', 20).nud = function () {
2857
- error("A regular expression literal can be confused with '/='.");
2858
- };
2859
- assignop('%=', 'assignmod', 20);
2860
- bitwiseassignop('&=', 'assignbitand', 20);
2861
- bitwiseassignop('|=', 'assignbitor', 20);
2862
- bitwiseassignop('^=', 'assignbitxor', 20);
2863
- bitwiseassignop('<<=', 'assignshiftleft', 20);
2864
- bitwiseassignop('>>=', 'assignshiftright', 20);
2865
- bitwiseassignop('>>>=', 'assignshiftrightunsigned', 20);
2866
- infix('?', function (left, that) {
2867
- that.left = left;
2868
- that.right = expression(10);
2869
- advance(':');
2870
- that['else'] = expression(10);
2871
- return that;
2872
- }, 30);
2873
-
2874
- infix('||', 'or', 40);
2875
- infix('&&', 'and', 50);
2876
- bitwise('|', 'bitor', 70);
2877
- bitwise('^', 'bitxor', 80);
2878
- bitwise('&', 'bitand', 90);
2879
- relation('==', function (left, right) {
2880
- var eqnull = option.eqnull && (left.value === 'null' || right.value === 'null');
2881
-
2882
- if (!eqnull && option.eqeqeq)
2883
- warning("Expected '{a}' and instead saw '{b}'.", this, '===', '==');
2884
- else if (isPoorRelation(left))
2885
- warning("Use '{a}' to compare with '{b}'.", this, '===', left.value);
2886
- else if (isPoorRelation(right))
2887
- warning("Use '{a}' to compare with '{b}'.", this, '===', right.value);
2888
-
2889
- return this;
2890
- });
2891
- relation('===');
2892
- relation('!=', function (left, right) {
2893
- var eqnull = option.eqnull &&
2894
- (left.value === 'null' || right.value === 'null');
2895
-
2896
- if (!eqnull && option.eqeqeq) {
2897
- warning("Expected '{a}' and instead saw '{b}'.",
2898
- this, '!==', '!=');
2899
- } else if (isPoorRelation(left)) {
2900
- warning("Use '{a}' to compare with '{b}'.",
2901
- this, '!==', left.value);
2902
- } else if (isPoorRelation(right)) {
2903
- warning("Use '{a}' to compare with '{b}'.",
2904
- this, '!==', right.value);
2905
- }
2906
- return this;
2907
- });
2908
- relation('!==');
2909
- relation('<');
2910
- relation('>');
2911
- relation('<=');
2912
- relation('>=');
2913
- bitwise('<<', 'shiftleft', 120);
2914
- bitwise('>>', 'shiftright', 120);
2915
- bitwise('>>>', 'shiftrightunsigned', 120);
2916
- infix('in', 'in', 120);
2917
- infix('instanceof', 'instanceof', 120);
2918
- infix('+', function (left, that) {
2919
- var right = expression(130);
2920
- if (left && right && left.id === '(string)' && right.id === '(string)') {
2921
- left.value += right.value;
2922
- left.character = right.character;
2923
- if (!option.scripturl && jx.test(left.value)) {
2924
- warning("JavaScript URL.", left);
2925
- }
2926
- return left;
2927
- }
2928
- that.left = left;
2929
- that.right = right;
2930
- return that;
2931
- }, 130);
2932
- prefix('+', 'num');
2933
- prefix('+++', function () {
2934
- warning("Confusing pluses.");
2935
- this.right = expression(150);
2936
- this.arity = 'unary';
2937
- return this;
2938
- });
2939
- infix('+++', function (left) {
2940
- warning("Confusing pluses.");
2941
- this.left = left;
2942
- this.right = expression(130);
2943
- return this;
2944
- }, 130);
2945
- infix('-', 'sub', 130);
2946
- prefix('-', 'neg');
2947
- prefix('---', function () {
2948
- warning("Confusing minuses.");
2949
- this.right = expression(150);
2950
- this.arity = 'unary';
2951
- return this;
2952
- });
2953
- infix('---', function (left) {
2954
- warning("Confusing minuses.");
2955
- this.left = left;
2956
- this.right = expression(130);
2957
- return this;
2958
- }, 130);
2959
- infix('*', 'mult', 140);
2960
- infix('/', 'div', 140);
2961
- infix('%', 'mod', 140);
2962
-
2963
- suffix('++', 'postinc');
2964
- prefix('++', 'preinc');
2965
- syntax['++'].exps = true;
2966
-
2967
- suffix('--', 'postdec');
2968
- prefix('--', 'predec');
2969
- syntax['--'].exps = true;
2970
- prefix('delete', function () {
2971
- var p = expression(0);
2972
- if (!p || (p.id !== '.' && p.id !== '[')) {
2973
- warning("Variables should not be deleted.");
2974
- }
2975
- this.first = p;
2976
- return this;
2977
- }).exps = true;
2978
-
2979
- prefix('~', function () {
2980
- if (option.bitwise) {
2981
- warning("Unexpected '{a}'.", this, '~');
2982
- }
2983
- expression(150);
2984
- return this;
2985
- });
2986
-
2987
- prefix('!', function () {
2988
- this.right = expression(150);
2989
- this.arity = 'unary';
2990
- if (bang[this.right.id] === true) {
2991
- warning("Confusing use of '{a}'.", this, '!');
2992
- }
2993
- return this;
2994
- });
2995
- prefix('typeof', 'typeof');
2996
- prefix('new', function () {
2997
- var c = expression(155), i;
2998
- if (c && c.id !== 'function') {
2999
- if (c.identifier) {
3000
- c['new'] = true;
3001
- switch (c.value) {
3002
- case 'Number':
3003
- case 'String':
3004
- case 'Boolean':
3005
- case 'Math':
3006
- case 'JSON':
3007
- warning("Do not use {a} as a constructor.", token, c.value);
3008
- break;
3009
- case 'Function':
3010
- if (!option.evil) {
3011
- warning("The Function constructor is eval.");
3012
- }
3013
- break;
3014
- case 'Date':
3015
- case 'RegExp':
3016
- break;
3017
- default:
3018
- if (c.id !== 'function') {
3019
- i = c.value.substr(0, 1);
3020
- if (option.newcap && (i < 'A' || i > 'Z')) {
3021
- warning("A constructor name should start with an uppercase letter.",
3022
- token);
3023
- }
3024
- }
3025
- }
3026
- } else {
3027
- if (c.id !== '.' && c.id !== '[' && c.id !== '(') {
3028
- warning("Bad constructor.", token);
3029
- }
3030
- }
3031
- } else {
3032
- if (!option.supernew)
3033
- warning("Weird construction. Delete 'new'.", this);
3034
- }
3035
- adjacent(token, nexttoken);
3036
- if (nexttoken.id !== '(' && !option.supernew) {
3037
- warning("Missing '()' invoking a constructor.");
3038
- }
3039
- this.first = c;
3040
- return this;
3041
- });
3042
- syntax['new'].exps = true;
3043
-
3044
- prefix('void').exps = true;
3045
-
3046
- infix('.', function (left, that) {
3047
- adjacent(prevtoken, token);
3048
- nobreak();
3049
- var m = identifier();
3050
- if (typeof m === 'string') {
3051
- countMember(m);
3052
- }
3053
- that.left = left;
3054
- that.right = m;
3055
- if (left && left.value === 'arguments' && (m === 'callee' || m === 'caller')) {
3056
- if (option.noarg)
3057
- warning("Avoid arguments.{a}.", left, m);
3058
- else if (directive['use strict'])
3059
- error('Strict violation.');
3060
- } else if (!option.evil && left && left.value === 'document' &&
3061
- (m === 'write' || m === 'writeln')) {
3062
- warning("document.write can be a form of eval.", left);
3063
- }
3064
- if (!option.evil && (m === 'eval' || m === 'execScript')) {
3065
- warning('eval is evil.');
3066
- }
3067
- return that;
3068
- }, 160, true);
3069
-
3070
- infix('(', function (left, that) {
3071
- if (prevtoken.id !== '}' && prevtoken.id !== ')') {
3072
- nobreak(prevtoken, token);
3073
- }
3074
- nospace();
3075
- if (option.immed && !left.immed && left.id === 'function') {
3076
- warning("Wrap an immediate function invocation in parentheses " +
3077
- "to assist the reader in understanding that the expression " +
3078
- "is the result of a function, and not the function itself.");
3079
- }
3080
- var n = 0,
3081
- p = [];
3082
- if (left) {
3083
- if (left.type === '(identifier)') {
3084
- if (left.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)) {
3085
- if (left.value !== 'Number' && left.value !== 'String' &&
3086
- left.value !== 'Boolean' &&
3087
- left.value !== 'Date') {
3088
- if (left.value === 'Math') {
3089
- warning("Math is not a function.", left);
3090
- } else if (option.newcap) {
3091
- warning(
3092
- "Missing 'new' prefix when invoking a constructor.", left);
3093
- }
3094
- }
3095
- }
3096
- }
3097
- }
3098
- if (nexttoken.id !== ')') {
3099
- for (;;) {
3100
- p[p.length] = expression(10);
3101
- n += 1;
3102
- if (nexttoken.id !== ',') {
3103
- break;
3104
- }
3105
- comma();
3106
- }
3107
- }
3108
- advance(')');
3109
- nospace(prevtoken, token);
3110
- if (typeof left === 'object') {
3111
- if (left.value === 'parseInt' && n === 1) {
3112
- warning("Missing radix parameter.", left);
3113
- }
3114
- if (!option.evil) {
3115
- if (left.value === 'eval' || left.value === 'Function' ||
3116
- left.value === 'execScript') {
3117
- warning("eval is evil.", left);
3118
- } else if (p[0] && p[0].id === '(string)' &&
3119
- (left.value === 'setTimeout' ||
3120
- left.value === 'setInterval')) {
3121
- warning(
3122
- "Implied eval is evil. Pass a function instead of a string.", left);
3123
- }
3124
- }
3125
- if (!left.identifier && left.id !== '.' && left.id !== '[' &&
3126
- left.id !== '(' && left.id !== '&&' && left.id !== '||' &&
3127
- left.id !== '?') {
3128
- warning("Bad invocation.", left);
3129
- }
3130
- }
3131
- that.left = left;
3132
- return that;
3133
- }, 155, true).exps = true;
3134
-
3135
- prefix('(', function () {
3136
- nospace();
3137
- if (nexttoken.id === 'function') {
3138
- nexttoken.immed = true;
3139
- }
3140
- var v = expression(0);
3141
- advance(')', this);
3142
- nospace(prevtoken, token);
3143
- if (option.immed && v.id === 'function') {
3144
- if (nexttoken.id === '(' ||
3145
- (nexttoken.id === '.' && (peek().value === 'call' || peek().value === 'apply'))) {
3146
- warning(
3147
- "Move the invocation into the parens that contain the function.", nexttoken);
3148
- } else {
3149
- warning(
3150
- "Do not wrap function literals in parens unless they are to be immediately invoked.",
3151
- this);
3152
- }
3153
- }
3154
- return v;
3155
- });
3156
-
3157
- infix('[', function (left, that) {
3158
- nobreak(prevtoken, token);
3159
- nospace();
3160
- var e = expression(0), s;
3161
- if (e && e.type === '(string)') {
3162
- if (!option.evil && (e.value === 'eval' || e.value === 'execScript')) {
3163
- warning("eval is evil.", that);
3164
- }
3165
- countMember(e.value);
3166
- if (!option.sub && ix.test(e.value)) {
3167
- s = syntax[e.value];
3168
- if (!s || !s.reserved) {
3169
- warning("['{a}'] is better written in dot notation.",
3170
- e, e.value);
3171
- }
3172
- }
3173
- }
3174
- advance(']', that);
3175
- nospace(prevtoken, token);
3176
- that.left = left;
3177
- that.right = e;
3178
- return that;
3179
- }, 160, true);
3180
-
3181
- prefix('[', function () {
3182
- var b = token.line !== nexttoken.line;
3183
- this.first = [];
3184
- if (b) {
3185
- indent += option.indent;
3186
- if (nexttoken.from === indent + option.indent) {
3187
- indent += option.indent;
3188
- }
3189
- }
3190
- while (nexttoken.id !== '(end)') {
3191
- while (nexttoken.id === ',') {
3192
- warning("Extra comma.");
3193
- advance(',');
3194
- }
3195
- if (nexttoken.id === ']') {
3196
- break;
3197
- }
3198
- if (b && token.line !== nexttoken.line) {
3199
- indentation();
3200
- }
3201
- this.first.push(expression(10));
3202
- if (nexttoken.id === ',') {
3203
- comma();
3204
- if (nexttoken.id === ']' && !option.es5) {
3205
- warning("Extra comma.", token);
3206
- break;
3207
- }
3208
- } else {
3209
- break;
3210
- }
3211
- }
3212
- if (b) {
3213
- indent -= option.indent;
3214
- indentation();
3215
- }
3216
- advance(']', this);
3217
- return this;
3218
- }, 160);
3219
-
3220
-
3221
- function property_name() {
3222
- var id = optionalidentifier(true);
3223
- if (!id) {
3224
- if (nexttoken.id === '(string)') {
3225
- id = nexttoken.value;
3226
- advance();
3227
- } else if (nexttoken.id === '(number)') {
3228
- id = nexttoken.value.toString();
3229
- advance();
3230
- }
3231
- }
3232
- return id;
3233
- }
3234
-
3235
-
3236
- function functionparams() {
3237
- var i, t = nexttoken, p = [];
3238
- advance('(');
3239
- nospace();
3240
- if (nexttoken.id === ')') {
3241
- advance(')');
3242
- return;
3243
- }
3244
- for (;;) {
3245
- i = identifier(true);
3246
- p.push(i);
3247
- addlabel(i, 'parameter');
3248
- if (nexttoken.id === ',') {
3249
- comma();
3250
- } else {
3251
- advance(')', t);
3252
- nospace(prevtoken, token);
3253
- return p;
3254
- }
3255
- }
3256
- }
3257
-
3258
-
3259
- function doFunction(i, statement) {
3260
- var f,
3261
- oldOption = option,
3262
- oldScope = scope;
3263
-
3264
- option = Object.create(option);
3265
- scope = Object.create(scope);
3266
-
3267
- funct = {
3268
- '(name)' : i || '"' + anonname + '"',
3269
- '(line)' : nexttoken.line,
3270
- '(context)' : funct,
3271
- '(breakage)' : 0,
3272
- '(loopage)' : 0,
3273
- '(scope)' : scope,
3274
- '(statement)': statement
3275
- };
3276
- f = funct;
3277
- token.funct = funct;
3278
- functions.push(funct);
3279
- if (i) {
3280
- addlabel(i, 'function');
3281
- }
3282
- funct['(params)'] = functionparams();
3283
-
3284
- block(false, false, true);
3285
- scope = oldScope;
3286
- option = oldOption;
3287
- funct['(last)'] = token.line;
3288
- funct = funct['(context)'];
3289
- return f;
3290
- }
3291
-
3292
-
3293
- (function (x) {
3294
- x.nud = function () {
3295
- var b, f, i, j, p, t;
3296
- var props = {}; // All properties, including accessors
3297
-
3298
- function saveProperty(name, token) {
3299
- if (props[name] && is_own(props, name))
3300
- warning("Duplicate member '{a}'.", nexttoken, i);
3301
- else
3302
- props[name] = {};
3303
-
3304
- props[name].basic = true;
3305
- props[name].basicToken = token;
3306
- }
3307
-
3308
- function saveSetter(name, token) {
3309
- if (props[name] && is_own(props, name)) {
3310
- if (props[name].basic || props[name].setter)
3311
- warning("Duplicate member '{a}'.", nexttoken, i);
3312
- } else {
3313
- props[name] = {};
3314
- }
3315
-
3316
- props[name].setter = true;
3317
- props[name].setterToken = token;
3318
- }
3319
-
3320
- function saveGetter(name) {
3321
- if (props[name] && is_own(props, name)) {
3322
- if (props[name].basic || props[name].getter)
3323
- warning("Duplicate member '{a}'.", nexttoken, i);
3324
- } else {
3325
- props[name] = {};
3326
- }
3327
-
3328
- props[name].getter = true;
3329
- props[name].getterToken = token;
3330
- }
3331
-
3332
- b = token.line !== nexttoken.line;
3333
- if (b) {
3334
- indent += option.indent;
3335
- if (nexttoken.from === indent + option.indent) {
3336
- indent += option.indent;
3337
- }
3338
- }
3339
- for (;;) {
3340
- if (nexttoken.id === '}') {
3341
- break;
3342
- }
3343
- if (b) {
3344
- indentation();
3345
- }
3346
- if (nexttoken.value === 'get' && peek().id !== ':') {
3347
- advance('get');
3348
- if (!option.es5) {
3349
- error("get/set are ES5 features.");
3350
- }
3351
- i = property_name();
3352
- if (!i) {
3353
- error("Missing property name.");
3354
- }
3355
- saveGetter(i);
3356
- t = nexttoken;
3357
- adjacent(token, nexttoken);
3358
- f = doFunction();
3359
- p = f['(params)'];
3360
- if (p) {
3361
- warning("Unexpected parameter '{a}' in get {b} function.", t, p[0], i);
3362
- }
3363
- adjacent(token, nexttoken);
3364
- } else if (nexttoken.value === 'set' && peek().id !== ':') {
3365
- advance('set');
3366
- if (!option.es5) {
3367
- error("get/set are ES5 features.");
3368
- }
3369
- i = property_name();
3370
- if (!i) {
3371
- error("Missing property name.");
3372
- }
3373
- saveSetter(i, nexttoken);
3374
- t = nexttoken;
3375
- adjacent(token, nexttoken);
3376
- f = doFunction();
3377
- p = f['(params)'];
3378
- if (!p || p.length !== 1) {
3379
- warning("Expected a single parameter in set {a} function.", t, i);
3380
- }
3381
- } else {
3382
- i = property_name();
3383
- saveProperty(i, nexttoken);
3384
- if (typeof i !== 'string') {
3385
- break;
3386
- }
3387
- advance(':');
3388
- nonadjacent(token, nexttoken);
3389
- expression(10);
3390
- }
3391
-
3392
- countMember(i);
3393
- if (nexttoken.id === ',') {
3394
- comma();
3395
- if (nexttoken.id === ',') {
3396
- warning("Extra comma.", token);
3397
- } else if (nexttoken.id === '}' && !option.es5) {
3398
- warning("Extra comma.", token);
3399
- }
3400
- } else {
3401
- break;
3402
- }
3403
- }
3404
- if (b) {
3405
- indent -= option.indent;
3406
- indentation();
3407
- }
3408
- advance('}', this);
3409
-
3410
- // Check for lonely setters if in the ES5 mode.
3411
- if (option.es5) {
3412
- for (var name in props) {
3413
- if (is_own(props, name) && props[name].setter && !props[name].getter) {
3414
- warning("Setter is defined without getter.", props[name].setterToken);
3415
- }
3416
- }
3417
- }
3418
- return this;
3419
- };
3420
- x.fud = function () {
3421
- error("Expected to see a statement and instead saw a block.", token);
3422
- };
3423
- }(delim('{')));
3424
-
3425
- // This Function is called when esnext option is set to true
3426
- // it adds the `const` statement to JSHINT
3427
-
3428
- useESNextSyntax = function () {
3429
- var conststatement = stmt('const', function (prefix) {
3430
- var id, name, value;
3431
-
3432
- this.first = [];
3433
- for (;;) {
3434
- nonadjacent(token, nexttoken);
3435
- id = identifier();
3436
- if (funct[id] === "const") {
3437
- warning("const '" + id + "' has already been declared");
3438
- }
3439
- if (funct['(global)'] && predefined[id] === false) {
3440
- warning("Redefinition of '{a}'.", token, id);
3441
- }
3442
- addlabel(id, 'const');
3443
- if (prefix) {
3444
- break;
3445
- }
3446
- name = token;
3447
- this.first.push(token);
3448
-
3449
- if (nexttoken.id !== "=") {
3450
- warning("const " +
3451
- "'{a}' is initialized to 'undefined'.", token, id);
3452
- }
3453
-
3454
- if (nexttoken.id === '=') {
3455
- nonadjacent(token, nexttoken);
3456
- advance('=');
3457
- nonadjacent(token, nexttoken);
3458
- if (nexttoken.id === 'undefined') {
3459
- warning("It is not necessary to initialize " +
3460
- "'{a}' to 'undefined'.", token, id);
3461
- }
3462
- if (peek(0).id === '=' && nexttoken.identifier) {
3463
- error("Constant {a} was not declared correctly.",
3464
- nexttoken, nexttoken.value);
3465
- }
3466
- value = expression(0);
3467
- name.first = value;
3468
- }
3469
-
3470
- if (nexttoken.id !== ',') {
3471
- break;
3472
- }
3473
- comma();
3474
- }
3475
- return this;
3476
- });
3477
- conststatement.exps = true;
3478
- };
3479
-
3480
- var varstatement = stmt('var', function (prefix) {
3481
- // JavaScript does not have block scope. It only has function scope. So,
3482
- // declaring a variable in a block can have unexpected consequences.
3483
- var id, name, value;
3484
-
3485
- if (funct['(onevar)'] && option.onevar) {
3486
- warning("Too many var statements.");
3487
- } else if (!funct['(global)']) {
3488
- funct['(onevar)'] = true;
3489
- }
3490
- this.first = [];
3491
- for (;;) {
3492
- nonadjacent(token, nexttoken);
3493
- id = identifier();
3494
- if (option.esnext && funct[id] === "const") {
3495
- warning("const '" + id + "' has already been declared");
3496
- }
3497
- if (funct['(global)'] && predefined[id] === false) {
3498
- warning("Redefinition of '{a}'.", token, id);
3499
- }
3500
- addlabel(id, 'unused');
3501
- if (prefix) {
3502
- break;
3503
- }
3504
- name = token;
3505
- this.first.push(token);
3506
- if (nexttoken.id === '=') {
3507
- nonadjacent(token, nexttoken);
3508
- advance('=');
3509
- nonadjacent(token, nexttoken);
3510
- if (nexttoken.id === 'undefined') {
3511
- warning("It is not necessary to initialize '{a}' to 'undefined'.", token, id);
3512
- }
3513
- if (peek(0).id === '=' && nexttoken.identifier) {
3514
- error("Variable {a} was not declared correctly.",
3515
- nexttoken, nexttoken.value);
3516
- }
3517
- value = expression(0);
3518
- name.first = value;
3519
- }
3520
- if (nexttoken.id !== ',') {
3521
- break;
3522
- }
3523
- comma();
3524
- }
3525
- return this;
3526
- });
3527
- varstatement.exps = true;
3528
-
3529
- blockstmt('function', function () {
3530
- if (inblock) {
3531
- warning("Function declarations should not be placed in blocks. " +
3532
- "Use a function expression or move the statement to the top of " +
3533
- "the outer function.", token);
3534
-
3535
- }
3536
- var i = identifier();
3537
- if (option.esnext && funct[i] === "const") {
3538
- warning("const '" + i + "' has already been declared");
3539
- }
3540
- adjacent(token, nexttoken);
3541
- addlabel(i, 'unction');
3542
- doFunction(i, true);
3543
- if (nexttoken.id === '(' && nexttoken.line === token.line) {
3544
- error(
3545
- "Function declarations are not invocable. Wrap the whole function invocation in parens.");
3546
- }
3547
- return this;
3548
- });
3549
-
3550
- prefix('function', function () {
3551
- var i = optionalidentifier();
3552
- if (i) {
3553
- adjacent(token, nexttoken);
3554
- } else {
3555
- nonadjacent(token, nexttoken);
3556
- }
3557
- doFunction(i);
3558
- if (!option.loopfunc && funct['(loopage)']) {
3559
- warning("Don't make functions within a loop.");
3560
- }
3561
- return this;
3562
- });
3563
-
3564
- blockstmt('if', function () {
3565
- var t = nexttoken;
3566
- advance('(');
3567
- nonadjacent(this, t);
3568
- nospace();
3569
- expression(20);
3570
- if (nexttoken.id === '=') {
3571
- if (!option.boss)
3572
- warning("Expected a conditional expression and instead saw an assignment.");
3573
- advance('=');
3574
- expression(20);
3575
- }
3576
- advance(')', t);
3577
- nospace(prevtoken, token);
3578
- block(true, true);
3579
- if (nexttoken.id === 'else') {
3580
- nonadjacent(token, nexttoken);
3581
- advance('else');
3582
- if (nexttoken.id === 'if' || nexttoken.id === 'switch') {
3583
- statement(true);
3584
- } else {
3585
- block(true, true);
3586
- }
3587
- }
3588
- return this;
3589
- });
3590
-
3591
- blockstmt('try', function () {
3592
- var b, e, s;
3593
-
3594
- block(false);
3595
- if (nexttoken.id === 'catch') {
3596
- advance('catch');
3597
- nonadjacent(token, nexttoken);
3598
- advance('(');
3599
- s = scope;
3600
- scope = Object.create(s);
3601
- e = nexttoken.value;
3602
- if (nexttoken.type !== '(identifier)') {
3603
- warning("Expected an identifier and instead saw '{a}'.",
3604
- nexttoken, e);
3605
- } else {
3606
- addlabel(e, 'exception');
3607
- }
3608
- advance();
3609
- advance(')');
3610
- block(false);
3611
- b = true;
3612
- scope = s;
3613
- }
3614
- if (nexttoken.id === 'finally') {
3615
- advance('finally');
3616
- block(false);
3617
- return;
3618
- } else if (!b) {
3619
- error("Expected '{a}' and instead saw '{b}'.",
3620
- nexttoken, 'catch', nexttoken.value);
3621
- }
3622
- return this;
3623
- });
3624
-
3625
- blockstmt('while', function () {
3626
- var t = nexttoken;
3627
- funct['(breakage)'] += 1;
3628
- funct['(loopage)'] += 1;
3629
- advance('(');
3630
- nonadjacent(this, t);
3631
- nospace();
3632
- expression(20);
3633
- if (nexttoken.id === '=') {
3634
- if (!option.boss)
3635
- warning("Expected a conditional expression and instead saw an assignment.");
3636
- advance('=');
3637
- expression(20);
3638
- }
3639
- advance(')', t);
3640
- nospace(prevtoken, token);
3641
- block(true, true);
3642
- funct['(breakage)'] -= 1;
3643
- funct['(loopage)'] -= 1;
3644
- return this;
3645
- }).labelled = true;
3646
-
3647
- blockstmt('with', function () {
3648
- var t = nexttoken;
3649
- if (directive['use strict']) {
3650
- error("'with' is not allowed in strict mode.", token);
3651
- } else if (!option.withstmt) {
3652
- warning("Don't use 'with'.", token);
3653
- }
3654
-
3655
- advance('(');
3656
- nonadjacent(this, t);
3657
- nospace();
3658
- expression(0);
3659
- advance(')', t);
3660
- nospace(prevtoken, token);
3661
- block(true, true);
3662
-
3663
- return this;
3664
- });
3665
-
3666
- blockstmt('switch', function () {
3667
- var t = nexttoken,
3668
- g = false;
3669
- funct['(breakage)'] += 1;
3670
- advance('(');
3671
- nonadjacent(this, t);
3672
- nospace();
3673
- this.condition = expression(20);
3674
- advance(')', t);
3675
- nospace(prevtoken, token);
3676
- nonadjacent(token, nexttoken);
3677
- t = nexttoken;
3678
- advance('{');
3679
- nonadjacent(token, nexttoken);
3680
- indent += option.indent;
3681
- this.cases = [];
3682
- for (;;) {
3683
- switch (nexttoken.id) {
3684
- case 'case':
3685
- switch (funct['(verb)']) {
3686
- case 'break':
3687
- case 'case':
3688
- case 'continue':
3689
- case 'return':
3690
- case 'switch':
3691
- case 'throw':
3692
- break;
3693
- default:
3694
- // You can tell JSHint that you don't use break intentionally by
3695
- // adding a comment /* falls through */ on a line just before
3696
- // the next `case`.
3697
- if (!ft.test(lines[nexttoken.line - 2])) {
3698
- warning(
3699
- "Expected a 'break' statement before 'case'.",
3700
- token);
3701
- }
3702
- }
3703
- indentation(-option.indent);
3704
- advance('case');
3705
- this.cases.push(expression(20));
3706
- g = true;
3707
- advance(':');
3708
- funct['(verb)'] = 'case';
3709
- break;
3710
- case 'default':
3711
- switch (funct['(verb)']) {
3712
- case 'break':
3713
- case 'continue':
3714
- case 'return':
3715
- case 'throw':
3716
- break;
3717
- default:
3718
- if (!ft.test(lines[nexttoken.line - 2])) {
3719
- warning(
3720
- "Expected a 'break' statement before 'default'.",
3721
- token);
3722
- }
3723
- }
3724
- indentation(-option.indent);
3725
- advance('default');
3726
- g = true;
3727
- advance(':');
3728
- break;
3729
- case '}':
3730
- indent -= option.indent;
3731
- indentation();
3732
- advance('}', t);
3733
- if (this.cases.length === 1 || this.condition.id === 'true' ||
3734
- this.condition.id === 'false') {
3735
- if (!option.onecase)
3736
- warning("This 'switch' should be an 'if'.", this);
3737
- }
3738
- funct['(breakage)'] -= 1;
3739
- funct['(verb)'] = undefined;
3740
- return;
3741
- case '(end)':
3742
- error("Missing '{a}'.", nexttoken, '}');
3743
- return;
3744
- default:
3745
- if (g) {
3746
- switch (token.id) {
3747
- case ',':
3748
- error("Each value should have its own case label.");
3749
- return;
3750
- case ':':
3751
- g = false;
3752
- statements();
3753
- break;
3754
- default:
3755
- error("Missing ':' on a case clause.", token);
3756
- return;
3757
- }
3758
- } else {
3759
- if (token.id === ':') {
3760
- advance(':');
3761
- error("Unexpected '{a}'.", token, ':');
3762
- statements();
3763
- } else {
3764
- error("Expected '{a}' and instead saw '{b}'.",
3765
- nexttoken, 'case', nexttoken.value);
3766
- return;
3767
- }
3768
- }
3769
- }
3770
- }
3771
- }).labelled = true;
3772
-
3773
- stmt('debugger', function () {
3774
- if (!option.debug) {
3775
- warning("All 'debugger' statements should be removed.");
3776
- }
3777
- return this;
3778
- }).exps = true;
3779
-
3780
- (function () {
3781
- var x = stmt('do', function () {
3782
- funct['(breakage)'] += 1;
3783
- funct['(loopage)'] += 1;
3784
- this.first = block(true);
3785
- advance('while');
3786
- var t = nexttoken;
3787
- nonadjacent(token, t);
3788
- advance('(');
3789
- nospace();
3790
- expression(20);
3791
- if (nexttoken.id === '=') {
3792
- if (!option.boss)
3793
- warning("Expected a conditional expression and instead saw an assignment.");
3794
- advance('=');
3795
- expression(20);
3796
- }
3797
- advance(')', t);
3798
- nospace(prevtoken, token);
3799
- funct['(breakage)'] -= 1;
3800
- funct['(loopage)'] -= 1;
3801
- return this;
3802
- });
3803
- x.labelled = true;
3804
- x.exps = true;
3805
- }());
3806
-
3807
- blockstmt('for', function () {
3808
- var s, t = nexttoken;
3809
- funct['(breakage)'] += 1;
3810
- funct['(loopage)'] += 1;
3811
- advance('(');
3812
- nonadjacent(this, t);
3813
- nospace();
3814
- if (peek(nexttoken.id === 'var' ? 1 : 0).id === 'in') {
3815
- if (nexttoken.id === 'var') {
3816
- advance('var');
3817
- varstatement.fud.call(varstatement, true);
3818
- } else {
3819
- switch (funct[nexttoken.value]) {
3820
- case 'unused':
3821
- funct[nexttoken.value] = 'var';
3822
- break;
3823
- case 'var':
3824
- break;
3825
- default:
3826
- warning("Bad for in variable '{a}'.",
3827
- nexttoken, nexttoken.value);
3828
- }
3829
- advance();
3830
- }
3831
- advance('in');
3832
- expression(20);
3833
- advance(')', t);
3834
- s = block(true, true);
3835
- if (option.forin && s && (s.length > 1 || typeof s[0] !== 'object' ||
3836
- s[0].value !== 'if')) {
3837
- warning("The body of a for in should be wrapped in an if statement to filter " +
3838
- "unwanted properties from the prototype.", this);
3839
- }
3840
- funct['(breakage)'] -= 1;
3841
- funct['(loopage)'] -= 1;
3842
- return this;
3843
- } else {
3844
- if (nexttoken.id !== ';') {
3845
- if (nexttoken.id === 'var') {
3846
- advance('var');
3847
- varstatement.fud.call(varstatement);
3848
- } else {
3849
- for (;;) {
3850
- expression(0, 'for');
3851
- if (nexttoken.id !== ',') {
3852
- break;
3853
- }
3854
- comma();
3855
- }
3856
- }
3857
- }
3858
- nolinebreak(token);
3859
- advance(';');
3860
- if (nexttoken.id !== ';') {
3861
- expression(20);
3862
- if (nexttoken.id === '=') {
3863
- if (!option.boss)
3864
- warning("Expected a conditional expression and instead saw an assignment.");
3865
- advance('=');
3866
- expression(20);
3867
- }
3868
- }
3869
- nolinebreak(token);
3870
- advance(';');
3871
- if (nexttoken.id === ';') {
3872
- error("Expected '{a}' and instead saw '{b}'.",
3873
- nexttoken, ')', ';');
3874
- }
3875
- if (nexttoken.id !== ')') {
3876
- for (;;) {
3877
- expression(0, 'for');
3878
- if (nexttoken.id !== ',') {
3879
- break;
3880
- }
3881
- comma();
3882
- }
3883
- }
3884
- advance(')', t);
3885
- nospace(prevtoken, token);
3886
- block(true, true);
3887
- funct['(breakage)'] -= 1;
3888
- funct['(loopage)'] -= 1;
3889
- return this;
3890
- }
3891
- }).labelled = true;
3892
-
3893
-
3894
- stmt('break', function () {
3895
- var v = nexttoken.value;
3896
-
3897
- if (funct['(breakage)'] === 0)
3898
- warning("Unexpected '{a}'.", nexttoken, this.value);
3899
-
3900
- if (!option.asi)
3901
- nolinebreak(this);
3902
-
3903
- if (nexttoken.id !== ';') {
3904
- if (token.line === nexttoken.line) {
3905
- if (funct[v] !== 'label') {
3906
- warning("'{a}' is not a statement label.", nexttoken, v);
3907
- } else if (scope[v] !== funct) {
3908
- warning("'{a}' is out of scope.", nexttoken, v);
3909
- }
3910
- this.first = nexttoken;
3911
- advance();
3912
- }
3913
- }
3914
- reachable('break');
3915
- return this;
3916
- }).exps = true;
3917
-
3918
-
3919
- stmt('continue', function () {
3920
- var v = nexttoken.value;
3921
-
3922
- if (funct['(breakage)'] === 0)
3923
- warning("Unexpected '{a}'.", nexttoken, this.value);
3924
-
3925
- if (!option.asi)
3926
- nolinebreak(this);
3927
-
3928
- if (nexttoken.id !== ';') {
3929
- if (token.line === nexttoken.line) {
3930
- if (funct[v] !== 'label') {
3931
- warning("'{a}' is not a statement label.", nexttoken, v);
3932
- } else if (scope[v] !== funct) {
3933
- warning("'{a}' is out of scope.", nexttoken, v);
3934
- }
3935
- this.first = nexttoken;
3936
- advance();
3937
- }
3938
- } else if (!funct['(loopage)']) {
3939
- warning("Unexpected '{a}'.", nexttoken, this.value);
3940
- }
3941
- reachable('continue');
3942
- return this;
3943
- }).exps = true;
3944
-
3945
-
3946
- stmt('return', function () {
3947
- if (this.line === nexttoken.line) {
3948
- if (nexttoken.id === '(regexp)')
3949
- warning("Wrap the /regexp/ literal in parens to disambiguate the slash operator.");
3950
-
3951
- if (nexttoken.id !== ';' && !nexttoken.reach) {
3952
- nonadjacent(token, nexttoken);
3953
- if (peek().value === "=" && !option.boss) {
3954
- warningAt("Did you mean to return a conditional instead of an assignment?",
3955
- token.line, token.character + 1);
3956
- }
3957
- this.first = expression(0);
3958
- }
3959
- } else if (!option.asi) {
3960
- nolinebreak(this); // always warn (Line breaking error)
3961
- }
3962
- reachable('return');
3963
- return this;
3964
- }).exps = true;
3965
-
3966
-
3967
- stmt('throw', function () {
3968
- nolinebreak(this);
3969
- nonadjacent(token, nexttoken);
3970
- this.first = expression(20);
3971
- reachable('throw');
3972
- return this;
3973
- }).exps = true;
3974
-
3975
- // Superfluous reserved words
3976
-
3977
- reserve('class');
3978
- reserve('const');
3979
- reserve('enum');
3980
- reserve('export');
3981
- reserve('extends');
3982
- reserve('import');
3983
- reserve('super');
3984
-
3985
- reserve('let');
3986
- reserve('yield');
3987
- reserve('implements');
3988
- reserve('interface');
3989
- reserve('package');
3990
- reserve('private');
3991
- reserve('protected');
3992
- reserve('public');
3993
- reserve('static');
3994
-
3995
-
3996
- // Parse JSON
3997
-
3998
- function jsonValue() {
3999
-
4000
- function jsonObject() {
4001
- var o = {}, t = nexttoken;
4002
- advance('{');
4003
- if (nexttoken.id !== '}') {
4004
- for (;;) {
4005
- if (nexttoken.id === '(end)') {
4006
- error("Missing '}' to match '{' from line {a}.",
4007
- nexttoken, t.line);
4008
- } else if (nexttoken.id === '}') {
4009
- warning("Unexpected comma.", token);
4010
- break;
4011
- } else if (nexttoken.id === ',') {
4012
- error("Unexpected comma.", nexttoken);
4013
- } else if (nexttoken.id !== '(string)') {
4014
- warning("Expected a string and instead saw {a}.",
4015
- nexttoken, nexttoken.value);
4016
- }
4017
- if (o[nexttoken.value] === true) {
4018
- warning("Duplicate key '{a}'.",
4019
- nexttoken, nexttoken.value);
4020
- } else if ((nexttoken.value === '__proto__' &&
4021
- !option.proto) || (nexttoken.value === '__iterator__' &&
4022
- !option.iterator)) {
4023
- warning("The '{a}' key may produce unexpected results.",
4024
- nexttoken, nexttoken.value);
4025
- } else {
4026
- o[nexttoken.value] = true;
4027
- }
4028
- advance();
4029
- advance(':');
4030
- jsonValue();
4031
- if (nexttoken.id !== ',') {
4032
- break;
4033
- }
4034
- advance(',');
4035
- }
4036
- }
4037
- advance('}');
4038
- }
4039
-
4040
- function jsonArray() {
4041
- var t = nexttoken;
4042
- advance('[');
4043
- if (nexttoken.id !== ']') {
4044
- for (;;) {
4045
- if (nexttoken.id === '(end)') {
4046
- error("Missing ']' to match '[' from line {a}.",
4047
- nexttoken, t.line);
4048
- } else if (nexttoken.id === ']') {
4049
- warning("Unexpected comma.", token);
4050
- break;
4051
- } else if (nexttoken.id === ',') {
4052
- error("Unexpected comma.", nexttoken);
4053
- }
4054
- jsonValue();
4055
- if (nexttoken.id !== ',') {
4056
- break;
4057
- }
4058
- advance(',');
4059
- }
4060
- }
4061
- advance(']');
4062
- }
4063
-
4064
- switch (nexttoken.id) {
4065
- case '{':
4066
- jsonObject();
4067
- break;
4068
- case '[':
4069
- jsonArray();
4070
- break;
4071
- case 'true':
4072
- case 'false':
4073
- case 'null':
4074
- case '(number)':
4075
- case '(string)':
4076
- advance();
4077
- break;
4078
- case '-':
4079
- advance('-');
4080
- if (token.character !== nexttoken.from) {
4081
- warning("Unexpected space after '-'.", token);
4082
- }
4083
- adjacent(token, nexttoken);
4084
- advance('(number)');
4085
- break;
4086
- default:
4087
- error("Expected a JSON value.", nexttoken);
4088
- }
4089
- }
4090
-
4091
-
4092
- // The actual JSHINT function itself.
4093
-
4094
- var itself = function (s, o, g) {
4095
- var a, i, k;
4096
- JSHINT.errors = [];
4097
- JSHINT.undefs = [];
4098
- predefined = Object.create(standard);
4099
- combine(predefined, g || {});
4100
- if (o) {
4101
- a = o.predef;
4102
- if (a) {
4103
- if (Array.isArray(a)) {
4104
- for (i = 0; i < a.length; i += 1) {
4105
- predefined[a[i]] = true;
4106
- }
4107
- } else if (typeof a === 'object') {
4108
- k = Object.keys(a);
4109
- for (i = 0; i < k.length; i += 1) {
4110
- predefined[k[i]] = !!a[k[i]];
4111
- }
4112
- }
4113
- }
4114
- option = o;
4115
- } else {
4116
- option = {};
4117
- }
4118
- option.indent = option.indent || 4;
4119
- option.maxerr = option.maxerr || 50;
4120
-
4121
- tab = '';
4122
- for (i = 0; i < option.indent; i += 1) {
4123
- tab += ' ';
4124
- }
4125
- indent = 1;
4126
- global = Object.create(predefined);
4127
- scope = global;
4128
- funct = {
4129
- '(global)': true,
4130
- '(name)': '(global)',
4131
- '(scope)': scope,
4132
- '(breakage)': 0,
4133
- '(loopage)': 0
4134
- };
4135
- functions = [funct];
4136
- urls = [];
4137
- stack = null;
4138
- member = {};
4139
- membersOnly = null;
4140
- implied = {};
4141
- inblock = false;
4142
- lookahead = [];
4143
- jsonmode = false;
4144
- warnings = 0;
4145
- lex.init(s);
4146
- prereg = true;
4147
- directive = {};
4148
-
4149
- prevtoken = token = nexttoken = syntax['(begin)'];
4150
-
4151
- // Check options
4152
- for (var name in o) {
4153
- if (is_own(o, name)) {
4154
- checkOption(name, token);
4155
- }
4156
- }
4157
-
4158
- assume();
4159
-
4160
- // combine the passed globals after we've assumed all our options
4161
- combine(predefined, g || {});
4162
-
4163
- //reset values
4164
- comma.first = true;
4165
-
4166
- try {
4167
- advance();
4168
- switch (nexttoken.id) {
4169
- case '{':
4170
- case '[':
4171
- option.laxbreak = true;
4172
- jsonmode = true;
4173
- jsonValue();
4174
- break;
4175
- default:
4176
- directives();
4177
- if (directive["use strict"] && !option.globalstrict) {
4178
- warning("Use the function form of \"use strict\".", prevtoken);
4179
- }
4180
-
4181
- statements();
4182
- }
4183
- advance('(end)');
4184
-
4185
- var markDefined = function (name, context) {
4186
- do {
4187
- if (typeof context[name] === 'string') {
4188
- // JSHINT marks unused variables as 'unused' and
4189
- // unused function declaration as 'unction'. This
4190
- // code changes such instances back 'var' and
4191
- // 'closure' so that the code in JSHINT.data()
4192
- // doesn't think they're unused.
4193
-
4194
- if (context[name] === 'unused')
4195
- context[name] = 'var';
4196
- else if (context[name] === 'unction')
4197
- context[name] = 'closure';
4198
-
4199
- return true;
4200
- }
4201
-
4202
- context = context['(context)'];
4203
- } while (context);
4204
-
4205
- return false;
4206
- };
4207
-
4208
- var clearImplied = function (name, line) {
4209
- if (!implied[name])
4210
- return;
4211
-
4212
- var newImplied = [];
4213
- for (var i = 0; i < implied[name].length; i += 1) {
4214
- if (implied[name][i] !== line)
4215
- newImplied.push(implied[name][i]);
4216
- }
4217
-
4218
- if (newImplied.length === 0)
4219
- delete implied[name];
4220
- else
4221
- implied[name] = newImplied;
4222
- };
4223
-
4224
- // Check queued 'x is not defined' instances to see if they're still undefined.
4225
- for (i = 0; i < JSHINT.undefs.length; i += 1) {
4226
- k = JSHINT.undefs[i].slice(0);
4227
-
4228
- if (markDefined(k[2].value, k[0])) {
4229
- clearImplied(k[2].value, k[2].line);
4230
- } else {
4231
- warning.apply(warning, k.slice(1));
4232
- }
4233
- }
4234
- } catch (e) {
4235
- if (e) {
4236
- var nt = nexttoken || {};
4237
- JSHINT.errors.push({
4238
- raw : e.raw,
4239
- reason : e.message,
4240
- line : e.line || nt.line,
4241
- character : e.character || nt.from
4242
- }, null);
4243
- }
4244
- }
4245
-
4246
- return JSHINT.errors.length === 0;
4247
- };
4248
-
4249
- // Data summary.
4250
- itself.data = function () {
4251
-
4252
- var data = { functions: [], options: option }, fu, globals, implieds = [], f, i, j,
4253
- members = [], n, unused = [], v;
4254
- if (itself.errors.length) {
4255
- data.errors = itself.errors;
4256
- }
4257
-
4258
- if (jsonmode) {
4259
- data.json = true;
4260
- }
4261
-
4262
- for (n in implied) {
4263
- if (is_own(implied, n)) {
4264
- implieds.push({
4265
- name: n,
4266
- line: implied[n]
4267
- });
4268
- }
4269
- }
4270
- if (implieds.length > 0) {
4271
- data.implieds = implieds;
4272
- }
4273
-
4274
- if (urls.length > 0) {
4275
- data.urls = urls;
4276
- }
4277
-
4278
- globals = Object.keys(scope);
4279
- if (globals.length > 0) {
4280
- data.globals = globals;
4281
- }
4282
- for (i = 1; i < functions.length; i += 1) {
4283
- f = functions[i];
4284
- fu = {};
4285
- for (j = 0; j < functionicity.length; j += 1) {
4286
- fu[functionicity[j]] = [];
4287
- }
4288
- for (n in f) {
4289
- if (is_own(f, n) && n.charAt(0) !== '(') {
4290
- v = f[n];
4291
- if (v === 'unction') {
4292
- v = 'unused';
4293
- }
4294
- if (Array.isArray(fu[v])) {
4295
- fu[v].push(n);
4296
- if (v === 'unused') {
4297
- unused.push({
4298
- name: n,
4299
- line: f['(line)'],
4300
- 'function': f['(name)']
4301
- });
4302
- }
4303
- }
4304
- }
4305
- }
4306
- for (j = 0; j < functionicity.length; j += 1) {
4307
- if (fu[functionicity[j]].length === 0) {
4308
- delete fu[functionicity[j]];
4309
- }
4310
- }
4311
- fu.name = f['(name)'];
4312
- fu.param = f['(params)'];
4313
- fu.line = f['(line)'];
4314
- fu.last = f['(last)'];
4315
- data.functions.push(fu);
4316
- }
4317
-
4318
- if (unused.length > 0) {
4319
- data.unused = unused;
4320
- }
4321
-
4322
- members = [];
4323
- for (n in member) {
4324
- if (typeof member[n] === 'number') {
4325
- data.member = member;
4326
- break;
4327
- }
4328
- }
4329
-
4330
- return data;
4331
- };
4332
-
4333
- itself.report = function (option) {
4334
- var data = itself.data();
4335
-
4336
- var a = [], c, e, err, f, i, k, l, m = '', n, o = [], s;
4337
-
4338
- function detail(h, array) {
4339
- var b, i, singularity;
4340
- if (array) {
4341
- o.push('<div><i>' + h + '</i> ');
4342
- array = array.sort();
4343
- for (i = 0; i < array.length; i += 1) {
4344
- if (array[i] !== singularity) {
4345
- singularity = array[i];
4346
- o.push((b ? ', ' : '') + singularity);
4347
- b = true;
4348
- }
4349
- }
4350
- o.push('</div>');
4351
- }
4352
- }
4353
-
4354
-
4355
- if (data.errors || data.implieds || data.unused) {
4356
- err = true;
4357
- o.push('<div id=errors><i>Error:</i>');
4358
- if (data.errors) {
4359
- for (i = 0; i < data.errors.length; i += 1) {
4360
- c = data.errors[i];
4361
- if (c) {
4362
- e = c.evidence || '';
4363
- o.push('<p>Problem' + (isFinite(c.line) ? ' at line ' +
4364
- c.line + ' character ' + c.character : '') +
4365
- ': ' + c.reason.entityify() +
4366
- '</p><p class=evidence>' +
4367
- (e && (e.length > 80 ? e.slice(0, 77) + '...' :
4368
- e).entityify()) + '</p>');
4369
- }
4370
- }
4371
- }
4372
-
4373
- if (data.implieds) {
4374
- s = [];
4375
- for (i = 0; i < data.implieds.length; i += 1) {
4376
- s[i] = '<code>' + data.implieds[i].name + '</code>&nbsp;<i>' +
4377
- data.implieds[i].line + '</i>';
4378
- }
4379
- o.push('<p><i>Implied global:</i> ' + s.join(', ') + '</p>');
4380
- }
4381
-
4382
- if (data.unused) {
4383
- s = [];
4384
- for (i = 0; i < data.unused.length; i += 1) {
4385
- s[i] = '<code><u>' + data.unused[i].name + '</u></code>&nbsp;<i>' +
4386
- data.unused[i].line + '</i> <code>' +
4387
- data.unused[i]['function'] + '</code>';
4388
- }
4389
- o.push('<p><i>Unused variable:</i> ' + s.join(', ') + '</p>');
4390
- }
4391
- if (data.json) {
4392
- o.push('<p>JSON: bad.</p>');
4393
- }
4394
- o.push('</div>');
4395
- }
4396
-
4397
- if (!option) {
4398
-
4399
- o.push('<br><div id=functions>');
4400
-
4401
- if (data.urls) {
4402
- detail("URLs<br>", data.urls, '<br>');
4403
- }
4404
-
4405
- if (data.json && !err) {
4406
- o.push('<p>JSON: good.</p>');
4407
- } else if (data.globals) {
4408
- o.push('<div><i>Global</i> ' +
4409
- data.globals.sort().join(', ') + '</div>');
4410
- } else {
4411
- o.push('<div><i>No new global variables introduced.</i></div>');
4412
- }
4413
-
4414
- for (i = 0; i < data.functions.length; i += 1) {
4415
- f = data.functions[i];
4416
-
4417
- o.push('<br><div class=function><i>' + f.line + '-' +
4418
- f.last + '</i> ' + (f.name || '') + '(' +
4419
- (f.param ? f.param.join(', ') : '') + ')</div>');
4420
- detail('<big><b>Unused</b></big>', f.unused);
4421
- detail('Closure', f.closure);
4422
- detail('Variable', f['var']);
4423
- detail('Exception', f.exception);
4424
- detail('Outer', f.outer);
4425
- detail('Global', f.global);
4426
- detail('Label', f.label);
4427
- }
4428
-
4429
- if (data.member) {
4430
- a = Object.keys(data.member);
4431
- if (a.length) {
4432
- a = a.sort();
4433
- m = '<br><pre id=members>/*members ';
4434
- l = 10;
4435
- for (i = 0; i < a.length; i += 1) {
4436
- k = a[i];
4437
- n = k.name();
4438
- if (l + n.length > 72) {
4439
- o.push(m + '<br>');
4440
- m = ' ';
4441
- l = 1;
4442
- }
4443
- l += n.length + 2;
4444
- if (data.member[k] === 1) {
4445
- n = '<i>' + n + '</i>';
4446
- }
4447
- if (i < a.length - 1) {
4448
- n += ', ';
4449
- }
4450
- m += n;
4451
- }
4452
- o.push(m + '<br>*/</pre>');
4453
- }
4454
- o.push('</div>');
4455
- }
4456
- }
4457
- return o.join('');
4458
- };
4459
-
4460
- itself.jshint = itself;
4461
-
4462
- return itself;
4463
- }());
4464
-
4465
- // Make JSHINT a Node module, if possible.
4466
- if (typeof exports === 'object' && exports)
4467
- exports.JSHINT = JSHINT;
4468
-
4469
- });