exercism-analysis 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (579) hide show
  1. checksums.yaml +7 -0
  2. data/exercism-analysis.gemspec +30 -0
  3. data/lib/exercism-analysis.rb +38 -0
  4. data/lib/exercism-analysis/adapters/adapter.rb +23 -0
  5. data/lib/exercism-analysis/adapters/clojure.rb +13 -0
  6. data/lib/exercism-analysis/adapters/go.rb +19 -0
  7. data/lib/exercism-analysis/adapters/javascript.rb +13 -0
  8. data/lib/exercism-analysis/adapters/python.rb +13 -0
  9. data/lib/exercism-analysis/adapters/ruby.rb +19 -0
  10. data/lib/exercism-analysis/analysis.rb +18 -0
  11. data/lib/exercism-analysis/analyzers/analyzer.rb +54 -0
  12. data/lib/exercism-analysis/analyzers/clojure/kibit.rb +25 -0
  13. data/lib/exercism-analysis/analyzers/go/golint.rb +23 -0
  14. data/lib/exercism-analysis/analyzers/javascript/jslint.rb +24 -0
  15. data/lib/exercism-analysis/analyzers/python/pylint.rb +24 -0
  16. data/lib/exercism-analysis/analyzers/ruby/control_flow.rb +21 -0
  17. data/lib/exercism-analysis/analyzers/ruby/enumerable_condition.rb +21 -0
  18. data/lib/exercism-analysis/analyzers/ruby/for_loop.rb +29 -0
  19. data/lib/exercism-analysis/analyzers/ruby/indentation.rb +21 -0
  20. data/lib/exercism-analysis/analyzers/ruby/iter_mutation.rb +37 -0
  21. data/lib/exercism-analysis/analyzers/ruby/output.rb +20 -0
  22. data/lib/exercism-analysis/analyzers/ruby/range.rb +28 -0
  23. data/lib/exercism-analysis/analyzers/ruby/roodi.rb +19 -0
  24. data/lib/exercism-analysis/analyzers/ruby/send.rb +25 -0
  25. data/lib/exercism-analysis/analyzers/ruby/shebang.rb +23 -0
  26. data/lib/exercism-analysis/analyzers/ruby/tab.rb +38 -0
  27. data/lib/exercism-analysis/processors/call_processor.rb +39 -0
  28. data/lib/exercism-analysis/processors/control_flow_processor.rb +27 -0
  29. data/lib/exercism-analysis/processors/enumerable_condition_processor.rb +31 -0
  30. data/lib/exercism-analysis/processors/for_loop_processor.rb +21 -0
  31. data/lib/exercism-analysis/processors/indentation_processor.rb +69 -0
  32. data/lib/exercism-analysis/processors/iter_mutation_processor.rb +50 -0
  33. data/lib/exercism-analysis/processors/processor.rb +34 -0
  34. data/lib/exercism-analysis/processors/range_processor.rb +23 -0
  35. data/lib/exercism-analysis/processors/send_processor.rb +23 -0
  36. data/lib/exercism-analysis/templates/each_to_map.rb +29 -0
  37. data/lib/exercism-analysis/templates/each_to_select.rb +31 -0
  38. data/lib/exercism-analysis/templates/range_exclusive.rb +19 -0
  39. data/lib/exercism-analysis/templates/template.rb +29 -0
  40. data/vendor/clojure/kibit-runner/LICENSE +214 -0
  41. data/vendor/clojure/kibit-runner/project.clj +10 -0
  42. data/vendor/clojure/kibit-runner/src/kibit_runner/core.clj +17 -0
  43. data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT-standalone.jar +0 -0
  44. data/vendor/clojure/kibit-runner/target/kibit-runner-0.1.0-SNAPSHOT.jar +0 -0
  45. data/vendor/clojure/kibit-runner/target/stale/extract-native.dependencies +1 -0
  46. data/vendor/go/src/github.com/golang/lint/LICENSE +27 -0
  47. data/vendor/go/src/github.com/golang/lint/README +59 -0
  48. data/vendor/go/src/github.com/golang/lint/golint/golint.go +67 -0
  49. data/vendor/go/src/github.com/golang/lint/lint.go +1061 -0
  50. data/vendor/go/src/runner/golint_runner.go +23 -0
  51. data/vendor/javascript/jshint_runner.js +6 -0
  52. data/vendor/javascript/node_modules/jshint/README.md +47 -0
  53. data/vendor/javascript/node_modules/jshint/bin/apply +6 -0
  54. data/vendor/javascript/node_modules/jshint/bin/build +36 -0
  55. data/vendor/javascript/node_modules/jshint/bin/changelog +36 -0
  56. data/vendor/javascript/node_modules/jshint/bin/jshint +3 -0
  57. data/vendor/javascript/node_modules/jshint/bin/land +34 -0
  58. data/vendor/javascript/node_modules/jshint/data/ascii-identifier-data.js +22 -0
  59. data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-part-only.js +1570 -0
  60. data/vendor/javascript/node_modules/jshint/data/non-ascii-identifier-start.js +48477 -0
  61. data/vendor/javascript/node_modules/jshint/dist/jshint-rhino.js +60642 -0
  62. data/vendor/javascript/node_modules/jshint/dist/jshint.js +60525 -0
  63. data/vendor/javascript/node_modules/jshint/node_modules/cli/README.md +196 -0
  64. data/vendor/javascript/node_modules/jshint/node_modules/cli/cli.js +1139 -0
  65. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/cat.js +17 -0
  66. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/command.js +16 -0
  67. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/echo.js +54 -0
  68. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/glob.js +6 -0
  69. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/long_desc.js +20 -0
  70. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/progress.js +11 -0
  71. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/sort.js +18 -0
  72. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/spinner.js +9 -0
  73. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.coffee +27 -0
  74. data/vendor/javascript/node_modules/jshint/node_modules/cli/examples/static.js +25 -0
  75. data/vendor/javascript/node_modules/jshint/node_modules/cli/index.js +1 -0
  76. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/LICENSE +27 -0
  77. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/README.md +250 -0
  78. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/g.js +9 -0
  79. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/examples/usr-local.js +9 -0
  80. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/glob.js +728 -0
  81. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  82. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/README.md +42 -0
  83. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  84. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  85. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/package.json +51 -0
  86. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/node_modules/inherits/test.js +25 -0
  87. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/package.json +58 -0
  88. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/00-setup.js +176 -0
  89. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-comparison.js +63 -0
  90. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/bash-results.json +351 -0
  91. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/cwd-test.js +55 -0
  92. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/globstar-match.js +19 -0
  93. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/mark.js +118 -0
  94. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/new-glob-optional-options.js +10 -0
  95. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/nocase-nomagic.js +113 -0
  96. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/pause-resume.js +73 -0
  97. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/readme-issue.js +36 -0
  98. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root-nomount.js +39 -0
  99. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/root.js +46 -0
  100. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/stat.js +32 -0
  101. data/vendor/javascript/node_modules/jshint/node_modules/cli/node_modules/glob/test/zz-cleanup.js +11 -0
  102. data/vendor/javascript/node_modules/jshint/node_modules/cli/package.json +70 -0
  103. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/LICENCE +19 -0
  104. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/README.md +33 -0
  105. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/index.js +86 -0
  106. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/LICENCE +19 -0
  107. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/README.md +45 -0
  108. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/index.js +5 -0
  109. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/package.json +89 -0
  110. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/seed.js +16 -0
  111. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/index.js +28 -0
  112. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/node_modules/date-now/test/static/index.html +10 -0
  113. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/package.json +88 -0
  114. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/index.js +67 -0
  115. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/index.html +12 -0
  116. data/vendor/javascript/node_modules/jshint/node_modules/console-browserify/test/static/test-adapter.js +53 -0
  117. data/vendor/javascript/node_modules/jshint/node_modules/exit/Gruntfile.js +48 -0
  118. data/vendor/javascript/node_modules/jshint/node_modules/exit/LICENSE-MIT +22 -0
  119. data/vendor/javascript/node_modules/jshint/node_modules/exit/README.md +75 -0
  120. data/vendor/javascript/node_modules/jshint/node_modules/exit/lib/exit.js +41 -0
  121. data/vendor/javascript/node_modules/jshint/node_modules/exit/package.json +69 -0
  122. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/exit_test.js +121 -0
  123. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stderr.txt +10 -0
  124. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout-stderr.txt +20 -0
  125. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/10-stdout.txt +10 -0
  126. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stderr.txt +100 -0
  127. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout-stderr.txt +200 -0
  128. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/100-stdout.txt +100 -0
  129. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stderr.txt +1000 -0
  130. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout-stderr.txt +2000 -0
  131. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/1000-stdout.txt +1000 -0
  132. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/create-files.sh +8 -0
  133. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log-broken.js +23 -0
  134. data/vendor/javascript/node_modules/jshint/node_modules/exit/test/fixtures/log.js +25 -0
  135. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/LICENSE +18 -0
  136. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/README.md +83 -0
  137. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/CollectingHandler.js +55 -0
  138. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/FeedHandler.js +95 -0
  139. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Parser.js +337 -0
  140. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/ProxyHandler.js +27 -0
  141. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Stream.js +35 -0
  142. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/Tokenizer.js +891 -0
  143. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/WritableStream.js +21 -0
  144. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/lib/index.js +68 -0
  145. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/LICENSE +11 -0
  146. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/index.js +14 -0
  147. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/package.json +40 -0
  148. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domelementtype/readme.md +1 -0
  149. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/LICENSE +11 -0
  150. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/index.js +211 -0
  151. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/package.json +68 -0
  152. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/readme.md +102 -0
  153. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/01-basic.json +57 -0
  154. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/02-single_tag_1.json +21 -0
  155. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/03-single_tag_2.json +21 -0
  156. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/04-unescaped_in_script.json +27 -0
  157. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/05-tags_in_comment.json +18 -0
  158. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/06-comment_in_script.json +18 -0
  159. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/07-unescaped_in_style.json +20 -0
  160. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/08-extra_spaces_in_tag.json +20 -0
  161. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/09-unquoted_attrib.json +20 -0
  162. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/10-singular_attribute.json +15 -0
  163. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/11-text_outside_tags.json +40 -0
  164. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/12-text_only.json +11 -0
  165. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/13-comment_in_text.json +19 -0
  166. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/14-comment_in_text_in_script.json +18 -0
  167. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/15-non-verbose.json +22 -0
  168. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/16-normalize_whitespace.json +47 -0
  169. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/17-xml_namespace.json +18 -0
  170. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/18-enforce_empty_tags.json +16 -0
  171. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/19-ignore_empty_tags.json +20 -0
  172. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/20-template_script_tags.json +20 -0
  173. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/21-conditional_comments.json +15 -0
  174. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/22-lowercase_tags.json +41 -0
  175. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/cases/23-dom-lvl1.json +121 -0
  176. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domhandler/test/tests.js +58 -0
  177. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/LICENSE +11 -0
  178. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/index.js +14 -0
  179. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/helpers.js +141 -0
  180. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/legacy.js +87 -0
  181. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/manipulation.js +77 -0
  182. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/querying.js +94 -0
  183. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/stringify.js +93 -0
  184. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/lib/traversal.js +24 -0
  185. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/package.json +71 -0
  186. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/readme.md +1 -0
  187. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/fixture.js +6 -0
  188. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/helpers.js +89 -0
  189. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/tests/legacy.js +119 -0
  190. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/domutils/test/utils.js +9 -0
  191. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/LICENSE +11 -0
  192. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/index.js +31 -0
  193. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode.js +72 -0
  194. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/decode_codepoint.js +26 -0
  195. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/lib/encode.js +48 -0
  196. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/decode.json +1 -0
  197. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/entities.json +1 -0
  198. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/legacy.json +1 -0
  199. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/maps/xml.json +1 -0
  200. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/package.json +79 -0
  201. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/readme.md +31 -0
  202. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/mocha.opts +2 -0
  203. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/entities/test/test.js +150 -0
  204. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/LICENSE +18 -0
  205. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/README.md +15 -0
  206. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/duplex.js +1 -0
  207. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/float.patch +923 -0
  208. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_duplex.js +89 -0
  209. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_passthrough.js +46 -0
  210. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_readable.js +944 -0
  211. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_transform.js +209 -0
  212. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/lib/_stream_writable.js +472 -0
  213. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/README.md +3 -0
  214. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/float.patch +604 -0
  215. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +107 -0
  216. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/package.json +53 -0
  217. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/core-util-is/util.js +106 -0
  218. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/LICENSE +16 -0
  219. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/README.md +42 -0
  220. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits.js +1 -0
  221. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +23 -0
  222. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/package.json +51 -0
  223. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/inherits/test.js +25 -0
  224. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/README.md +54 -0
  225. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/build/build.js +209 -0
  226. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/component.json +19 -0
  227. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/index.js +3 -0
  228. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/isarray/package.json +54 -0
  229. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/LICENSE +20 -0
  230. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/README.md +7 -0
  231. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/index.js +200 -0
  232. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/node_modules/string_decoder/package.json +53 -0
  233. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/package.json +68 -0
  234. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/passthrough.js +1 -0
  235. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/readable.js +7 -0
  236. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/transform.js +1 -0
  237. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/node_modules/readable-stream/writable.js +1 -0
  238. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/package.json +90 -0
  239. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/01-events.js +9 -0
  240. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/02-stream.js +23 -0
  241. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/03-feed.js +19 -0
  242. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Atom_Example.xml +25 -0
  243. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Attributes.html +16 -0
  244. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/Basic.html +1 -0
  245. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RDF_Example.xml +63 -0
  246. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Documents/RSS_Example.xml +48 -0
  247. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/01-simple.json +44 -0
  248. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/02-template.json +63 -0
  249. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/03-lowercase_tags.json +46 -0
  250. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/04-cdata.json +50 -0
  251. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/05-cdata-special.json +35 -0
  252. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/06-leading-lt.json +16 -0
  253. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/07-self-closing.json +67 -0
  254. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/08-implicit-close-tags.json +59 -0
  255. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/09-attributes.json +68 -0
  256. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/10-crazy-attrib.json +52 -0
  257. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/11-script_in_script.json +54 -0
  258. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/12-long-comment-end.json +20 -0
  259. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/13-long-cdata-end.json +22 -0
  260. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/14-implicit-open-tags.json +27 -0
  261. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/15-lt-whitespace.json +16 -0
  262. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/16-double_attribs.json +45 -0
  263. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/17-numeric_entities.json +16 -0
  264. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/18-legacy_entities.json +16 -0
  265. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/19-named_entities.json +16 -0
  266. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/20-xml_entities.json +16 -0
  267. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/21-entity_in_attribute.json +38 -0
  268. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/22-double_brackets.json +41 -0
  269. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/23-legacy_entity_fail.json +16 -0
  270. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/24-special_special.json +133 -0
  271. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/25-empty_tag_name.json +13 -0
  272. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/26-not-quite-closed.json +35 -0
  273. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/27-entities_in_attributes.json +62 -0
  274. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/28-cdata_in_html.json +9 -0
  275. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/29-comment_edge-cases.json +18 -0
  276. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Events/30-cdata_edge-cases.json +22 -0
  277. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/01-rss.js +34 -0
  278. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/02-atom.js +18 -0
  279. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Feeds/03-rdf.js +20 -0
  280. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/01-basic.json +83 -0
  281. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/02-RSS.json +1093 -0
  282. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/03-Atom.json +644 -0
  283. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/04-RDF.json +1399 -0
  284. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/Stream/05-Attributes.json +354 -0
  285. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/api.js +63 -0
  286. data/vendor/javascript/node_modules/jshint/node_modules/htmlparser2/test/test-helper.js +83 -0
  287. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/LICENSE +23 -0
  288. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/README.md +218 -0
  289. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/minimatch.js +1061 -0
  290. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
  291. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  292. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
  293. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
  294. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/package.json +50 -0
  295. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
  296. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
  297. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
  298. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  299. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  300. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  301. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/package.json +58 -0
  302. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  303. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
  304. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/package.json +57 -0
  305. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/basic.js +399 -0
  306. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/brace-expand.js +33 -0
  307. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/caching.js +14 -0
  308. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/defaults.js +274 -0
  309. data/vendor/javascript/node_modules/jshint/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  310. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/LICENSE +26 -0
  311. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/README.md +569 -0
  312. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/bin/shjs +51 -0
  313. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/global.js +3 -0
  314. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/make.js +47 -0
  315. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/package.json +61 -0
  316. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/generate-docs.js +21 -0
  317. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/scripts/run-tests.js +50 -0
  318. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/shell.js +157 -0
  319. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cat.js +43 -0
  320. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cd.js +19 -0
  321. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/chmod.js +208 -0
  322. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/common.js +203 -0
  323. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/cp.js +201 -0
  324. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/dirs.js +191 -0
  325. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/echo.js +20 -0
  326. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/error.js +10 -0
  327. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/exec.js +181 -0
  328. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/find.js +51 -0
  329. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/grep.js +52 -0
  330. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ln.js +53 -0
  331. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/ls.js +126 -0
  332. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mkdir.js +68 -0
  333. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/mv.js +80 -0
  334. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/popd.js +1 -0
  335. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pushd.js +1 -0
  336. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/pwd.js +11 -0
  337. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/rm.js +145 -0
  338. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/sed.js +43 -0
  339. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/tempdir.js +56 -0
  340. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/test.js +85 -0
  341. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/to.js +29 -0
  342. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/toEnd.js +29 -0
  343. data/vendor/javascript/node_modules/jshint/node_modules/shelljs/src/which.js +83 -0
  344. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/cli.js +41 -0
  345. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/package.json +76 -0
  346. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/readme.md +74 -0
  347. data/vendor/javascript/node_modules/jshint/node_modules/strip-json-comments/strip-json-comments.js +64 -0
  348. data/vendor/javascript/node_modules/jshint/node_modules/underscore/LICENSE +23 -0
  349. data/vendor/javascript/node_modules/jshint/node_modules/underscore/README.md +22 -0
  350. data/vendor/javascript/node_modules/jshint/node_modules/underscore/package.json +66 -0
  351. data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore-min.js +6 -0
  352. data/vendor/javascript/node_modules/jshint/node_modules/underscore/underscore.js +1343 -0
  353. data/vendor/javascript/node_modules/jshint/package.json +80 -0
  354. data/vendor/javascript/node_modules/jshint/src/cli.js +731 -0
  355. data/vendor/javascript/node_modules/jshint/src/jshint.js +5023 -0
  356. data/vendor/javascript/node_modules/jshint/src/lex.js +1650 -0
  357. data/vendor/javascript/node_modules/jshint/src/messages.js +223 -0
  358. data/vendor/javascript/node_modules/jshint/src/platforms/rhino.js +115 -0
  359. data/vendor/javascript/node_modules/jshint/src/reg.js +38 -0
  360. data/vendor/javascript/node_modules/jshint/src/reporters/checkstyle.js +81 -0
  361. data/vendor/javascript/node_modules/jshint/src/reporters/default.js +34 -0
  362. data/vendor/javascript/node_modules/jshint/src/reporters/jslint_xml.js +57 -0
  363. data/vendor/javascript/node_modules/jshint/src/reporters/non_error.js +52 -0
  364. data/vendor/javascript/node_modules/jshint/src/state.js +28 -0
  365. data/vendor/javascript/node_modules/jshint/src/style.js +143 -0
  366. data/vendor/javascript/node_modules/jshint/src/vars.js +658 -0
  367. data/vendor/python/astroid/COPYING +339 -0
  368. data/vendor/python/astroid/COPYING.LESSER +510 -0
  369. data/vendor/python/astroid/ChangeLog +574 -0
  370. data/vendor/python/astroid/MANIFEST.in +9 -0
  371. data/vendor/python/astroid/README +56 -0
  372. data/vendor/python/astroid/README.Python3 +26 -0
  373. data/vendor/python/astroid/__init__.py +118 -0
  374. data/vendor/python/astroid/__init__.pyc +0 -0
  375. data/vendor/python/astroid/__pkginfo__.py +48 -0
  376. data/vendor/python/astroid/__pkginfo__.pyc +0 -0
  377. data/vendor/python/astroid/announce.txt +23 -0
  378. data/vendor/python/astroid/as_string.py +496 -0
  379. data/vendor/python/astroid/as_string.pyc +0 -0
  380. data/vendor/python/astroid/bases.py +618 -0
  381. data/vendor/python/astroid/bases.pyc +0 -0
  382. data/vendor/python/astroid/brain/py2gi.py +159 -0
  383. data/vendor/python/astroid/brain/py2gi.pyc +0 -0
  384. data/vendor/python/astroid/brain/py2mechanize.py +20 -0
  385. data/vendor/python/astroid/brain/py2mechanize.pyc +0 -0
  386. data/vendor/python/astroid/brain/py2qt4.py +25 -0
  387. data/vendor/python/astroid/brain/py2qt4.pyc +0 -0
  388. data/vendor/python/astroid/brain/py2stdlib.py +252 -0
  389. data/vendor/python/astroid/brain/py2stdlib.pyc +0 -0
  390. data/vendor/python/astroid/builder.py +238 -0
  391. data/vendor/python/astroid/builder.pyc +0 -0
  392. data/vendor/python/astroid/exceptions.py +51 -0
  393. data/vendor/python/astroid/exceptions.pyc +0 -0
  394. data/vendor/python/astroid/inference.py +393 -0
  395. data/vendor/python/astroid/inference.pyc +0 -0
  396. data/vendor/python/astroid/inspector.py +275 -0
  397. data/vendor/python/astroid/manager.py +336 -0
  398. data/vendor/python/astroid/manager.pyc +0 -0
  399. data/vendor/python/astroid/mixins.py +122 -0
  400. data/vendor/python/astroid/mixins.pyc +0 -0
  401. data/vendor/python/astroid/node_classes.py +928 -0
  402. data/vendor/python/astroid/node_classes.pyc +0 -0
  403. data/vendor/python/astroid/nodes.py +73 -0
  404. data/vendor/python/astroid/nodes.pyc +0 -0
  405. data/vendor/python/astroid/protocols.py +322 -0
  406. data/vendor/python/astroid/protocols.pyc +0 -0
  407. data/vendor/python/astroid/raw_building.py +361 -0
  408. data/vendor/python/astroid/raw_building.pyc +0 -0
  409. data/vendor/python/astroid/rebuilder.py +954 -0
  410. data/vendor/python/astroid/rebuilder.pyc +0 -0
  411. data/vendor/python/astroid/scoped_nodes.py +1118 -0
  412. data/vendor/python/astroid/scoped_nodes.pyc +0 -0
  413. data/vendor/python/astroid/setup.py +184 -0
  414. data/vendor/python/astroid/tox.ini +10 -0
  415. data/vendor/python/astroid/utils.py +236 -0
  416. data/vendor/python/astroid/utils.pyc +0 -0
  417. data/vendor/python/logilab/__init__.py +0 -0
  418. data/vendor/python/logilab/__init__.pyc +0 -0
  419. data/vendor/python/logilab/common/COPYING +339 -0
  420. data/vendor/python/logilab/common/COPYING.LESSER +510 -0
  421. data/vendor/python/logilab/common/ChangeLog +1517 -0
  422. data/vendor/python/logilab/common/MANIFEST.in +13 -0
  423. data/vendor/python/logilab/common/README +185 -0
  424. data/vendor/python/logilab/common/README.Python3 +29 -0
  425. data/vendor/python/logilab/common/__init__.py +171 -0
  426. data/vendor/python/logilab/common/__init__.pyc +0 -0
  427. data/vendor/python/logilab/common/__pkginfo__.py +53 -0
  428. data/vendor/python/logilab/common/__pkginfo__.pyc +0 -0
  429. data/vendor/python/logilab/common/announce.txt +25 -0
  430. data/vendor/python/logilab/common/bin/pytest +7 -0
  431. data/vendor/python/logilab/common/bin/pytest.bat +17 -0
  432. data/vendor/python/logilab/common/cache.py +114 -0
  433. data/vendor/python/logilab/common/changelog.py +236 -0
  434. data/vendor/python/logilab/common/changelog.pyc +0 -0
  435. data/vendor/python/logilab/common/clcommands.py +332 -0
  436. data/vendor/python/logilab/common/cli.py +208 -0
  437. data/vendor/python/logilab/common/compat.py +243 -0
  438. data/vendor/python/logilab/common/compat.pyc +0 -0
  439. data/vendor/python/logilab/common/configuration.py +1094 -0
  440. data/vendor/python/logilab/common/configuration.pyc +0 -0
  441. data/vendor/python/logilab/common/contexts.py +5 -0
  442. data/vendor/python/logilab/common/corbautils.py +117 -0
  443. data/vendor/python/logilab/common/daemon.py +100 -0
  444. data/vendor/python/logilab/common/date.py +333 -0
  445. data/vendor/python/logilab/common/dbf.py +229 -0
  446. data/vendor/python/logilab/common/debugger.py +210 -0
  447. data/vendor/python/logilab/common/decorators.py +281 -0
  448. data/vendor/python/logilab/common/decorators.pyc +0 -0
  449. data/vendor/python/logilab/common/deprecation.py +188 -0
  450. data/vendor/python/logilab/common/deprecation.pyc +0 -0
  451. data/vendor/python/logilab/common/fileutils.py +402 -0
  452. data/vendor/python/logilab/common/graph.py +276 -0
  453. data/vendor/python/logilab/common/graph.pyc +0 -0
  454. data/vendor/python/logilab/common/hg.py +130 -0
  455. data/vendor/python/logilab/common/interface.py +71 -0
  456. data/vendor/python/logilab/common/interface.pyc +0 -0
  457. data/vendor/python/logilab/common/logging_ext.py +193 -0
  458. data/vendor/python/logilab/common/modutils.py +695 -0
  459. data/vendor/python/logilab/common/modutils.pyc +0 -0
  460. data/vendor/python/logilab/common/optik_ext.py +391 -0
  461. data/vendor/python/logilab/common/optik_ext.pyc +0 -0
  462. data/vendor/python/logilab/common/optparser.py +90 -0
  463. data/vendor/python/logilab/common/proc.py +277 -0
  464. data/vendor/python/logilab/common/pyro_ext.py +180 -0
  465. data/vendor/python/logilab/common/pytest.py +1177 -0
  466. data/vendor/python/logilab/common/python-logilab-common.spec +184 -0
  467. data/vendor/python/logilab/common/registry.py +1113 -0
  468. data/vendor/python/logilab/common/setup.cfg +3 -0
  469. data/vendor/python/logilab/common/setup.py +189 -0
  470. data/vendor/python/logilab/common/shellutils.py +455 -0
  471. data/vendor/python/logilab/common/sphinx_ext.py +87 -0
  472. data/vendor/python/logilab/common/sphinxutils.py +122 -0
  473. data/vendor/python/logilab/common/table.py +925 -0
  474. data/vendor/python/logilab/common/tasksqueue.py +100 -0
  475. data/vendor/python/logilab/common/textutils.py +534 -0
  476. data/vendor/python/logilab/common/textutils.pyc +0 -0
  477. data/vendor/python/logilab/common/tree.py +369 -0
  478. data/vendor/python/logilab/common/tree.pyc +0 -0
  479. data/vendor/python/logilab/common/umessage.py +190 -0
  480. data/vendor/python/logilab/common/ureports/__init__.py +174 -0
  481. data/vendor/python/logilab/common/ureports/__init__.pyc +0 -0
  482. data/vendor/python/logilab/common/ureports/docbook_writer.py +139 -0
  483. data/vendor/python/logilab/common/ureports/html_writer.py +131 -0
  484. data/vendor/python/logilab/common/ureports/html_writer.pyc +0 -0
  485. data/vendor/python/logilab/common/ureports/nodes.py +201 -0
  486. data/vendor/python/logilab/common/ureports/nodes.pyc +0 -0
  487. data/vendor/python/logilab/common/ureports/text_writer.py +140 -0
  488. data/vendor/python/logilab/common/ureports/text_writer.pyc +0 -0
  489. data/vendor/python/logilab/common/urllib2ext.py +87 -0
  490. data/vendor/python/logilab/common/vcgutils.py +216 -0
  491. data/vendor/python/logilab/common/visitor.py +107 -0
  492. data/vendor/python/logilab/common/visitor.pyc +0 -0
  493. data/vendor/python/logilab/common/xmlrpcutils.py +131 -0
  494. data/vendor/python/logilab/common/xmlutils.py +61 -0
  495. data/vendor/python/pylint/CONTRIBUTORS.txt +38 -0
  496. data/vendor/python/pylint/COPYING +340 -0
  497. data/vendor/python/pylint/ChangeLog +1437 -0
  498. data/vendor/python/pylint/DEPENDS +3 -0
  499. data/vendor/python/pylint/MANIFEST.in +14 -0
  500. data/vendor/python/pylint/README +50 -0
  501. data/vendor/python/pylint/README.Python3 +37 -0
  502. data/vendor/python/pylint/__init__.py +44 -0
  503. data/vendor/python/pylint/__init__.pyc +0 -0
  504. data/vendor/python/pylint/__main__.py +3 -0
  505. data/vendor/python/pylint/__pkginfo__.py +74 -0
  506. data/vendor/python/pylint/__pkginfo__.pyc +0 -0
  507. data/vendor/python/pylint/bin/epylint +3 -0
  508. data/vendor/python/pylint/bin/epylint.bat +5 -0
  509. data/vendor/python/pylint/bin/pylint +3 -0
  510. data/vendor/python/pylint/bin/pylint-gui +3 -0
  511. data/vendor/python/pylint/bin/pylint-gui.bat +5 -0
  512. data/vendor/python/pylint/bin/pylint.bat +5 -0
  513. data/vendor/python/pylint/bin/pyreverse +3 -0
  514. data/vendor/python/pylint/bin/pyreverse.bat +5 -0
  515. data/vendor/python/pylint/bin/symilar +3 -0
  516. data/vendor/python/pylint/bin/symilar.bat +5 -0
  517. data/vendor/python/pylint/checkers/__init__.py +145 -0
  518. data/vendor/python/pylint/checkers/__init__.pyc +0 -0
  519. data/vendor/python/pylint/checkers/base.py +1141 -0
  520. data/vendor/python/pylint/checkers/base.pyc +0 -0
  521. data/vendor/python/pylint/checkers/classes.py +792 -0
  522. data/vendor/python/pylint/checkers/classes.pyc +0 -0
  523. data/vendor/python/pylint/checkers/design_analysis.py +367 -0
  524. data/vendor/python/pylint/checkers/design_analysis.pyc +0 -0
  525. data/vendor/python/pylint/checkers/exceptions.py +306 -0
  526. data/vendor/python/pylint/checkers/exceptions.pyc +0 -0
  527. data/vendor/python/pylint/checkers/format.py +943 -0
  528. data/vendor/python/pylint/checkers/format.pyc +0 -0
  529. data/vendor/python/pylint/checkers/imports.py +394 -0
  530. data/vendor/python/pylint/checkers/imports.pyc +0 -0
  531. data/vendor/python/pylint/checkers/logging.py +213 -0
  532. data/vendor/python/pylint/checkers/logging.pyc +0 -0
  533. data/vendor/python/pylint/checkers/misc.py +90 -0
  534. data/vendor/python/pylint/checkers/misc.pyc +0 -0
  535. data/vendor/python/pylint/checkers/newstyle.py +151 -0
  536. data/vendor/python/pylint/checkers/newstyle.pyc +0 -0
  537. data/vendor/python/pylint/checkers/raw_metrics.py +129 -0
  538. data/vendor/python/pylint/checkers/raw_metrics.pyc +0 -0
  539. data/vendor/python/pylint/checkers/similar.py +365 -0
  540. data/vendor/python/pylint/checkers/similar.pyc +0 -0
  541. data/vendor/python/pylint/checkers/stdlib.py +69 -0
  542. data/vendor/python/pylint/checkers/stdlib.pyc +0 -0
  543. data/vendor/python/pylint/checkers/strings.py +304 -0
  544. data/vendor/python/pylint/checkers/strings.pyc +0 -0
  545. data/vendor/python/pylint/checkers/typecheck.py +451 -0
  546. data/vendor/python/pylint/checkers/typecheck.pyc +0 -0
  547. data/vendor/python/pylint/checkers/utils.py +416 -0
  548. data/vendor/python/pylint/checkers/utils.pyc +0 -0
  549. data/vendor/python/pylint/checkers/variables.py +741 -0
  550. data/vendor/python/pylint/checkers/variables.pyc +0 -0
  551. data/vendor/python/pylint/config.py +156 -0
  552. data/vendor/python/pylint/config.pyc +0 -0
  553. data/vendor/python/pylint/epylint.py +175 -0
  554. data/vendor/python/pylint/gui.py +508 -0
  555. data/vendor/python/pylint/interfaces.py +72 -0
  556. data/vendor/python/pylint/interfaces.pyc +0 -0
  557. data/vendor/python/pylint/lint.py +1106 -0
  558. data/vendor/python/pylint/lint.pyc +0 -0
  559. data/vendor/python/pylint/pyreverse/__init__.py +5 -0
  560. data/vendor/python/pylint/pyreverse/diadefslib.py +233 -0
  561. data/vendor/python/pylint/pyreverse/diagrams.py +247 -0
  562. data/vendor/python/pylint/pyreverse/main.py +124 -0
  563. data/vendor/python/pylint/pyreverse/utils.py +131 -0
  564. data/vendor/python/pylint/pyreverse/writer.py +199 -0
  565. data/vendor/python/pylint/reporters/__init__.py +138 -0
  566. data/vendor/python/pylint/reporters/__init__.pyc +0 -0
  567. data/vendor/python/pylint/reporters/guireporter.py +28 -0
  568. data/vendor/python/pylint/reporters/guireporter.pyc +0 -0
  569. data/vendor/python/pylint/reporters/html.py +70 -0
  570. data/vendor/python/pylint/reporters/html.pyc +0 -0
  571. data/vendor/python/pylint/reporters/text.py +143 -0
  572. data/vendor/python/pylint/reporters/text.pyc +0 -0
  573. data/vendor/python/pylint/setup.cfg +3 -0
  574. data/vendor/python/pylint/setup.py +203 -0
  575. data/vendor/python/pylint/tox.ini +10 -0
  576. data/vendor/python/pylint/utils.py +744 -0
  577. data/vendor/python/pylint/utils.pyc +0 -0
  578. data/vendor/python/pylint_runner.py +22 -0
  579. metadata +675 -0
@@ -0,0 +1,1650 @@
1
+ /*
2
+ * Lexical analysis and token construction.
3
+ */
4
+
5
+ "use strict";
6
+
7
+ var _ = require("underscore");
8
+ var events = require("events");
9
+ var reg = require("./reg.js");
10
+ var state = require("./state.js").state;
11
+
12
+ var unicodeData = require("../data/ascii-identifier-data.js");
13
+ var asciiIdentifierStartTable = unicodeData.asciiIdentifierStartTable;
14
+ var asciiIdentifierPartTable = unicodeData.asciiIdentifierPartTable;
15
+ var nonAsciiIdentifierStartTable = require("../data/non-ascii-identifier-start.js");
16
+ var nonAsciiIdentifierPartTable = require("../data/non-ascii-identifier-part-only.js");
17
+
18
+ // Some of these token types are from JavaScript Parser API
19
+ // while others are specific to JSHint parser.
20
+ // JS Parser API: https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API
21
+
22
+ var Token = {
23
+ Identifier: 1,
24
+ Punctuator: 2,
25
+ NumericLiteral: 3,
26
+ StringLiteral: 4,
27
+ Comment: 5,
28
+ Keyword: 6,
29
+ NullLiteral: 7,
30
+ BooleanLiteral: 8,
31
+ RegExp: 9,
32
+ TemplateLiteral: 10
33
+ };
34
+
35
+ // Object that handles postponed lexing verifications that checks the parsed
36
+ // environment state.
37
+
38
+ function asyncTrigger() {
39
+ var _checks = [];
40
+
41
+ return {
42
+ push: function (fn) {
43
+ _checks.push(fn);
44
+ },
45
+
46
+ check: function () {
47
+ for (var check = 0; check < _checks.length; ++check) {
48
+ _checks[check]();
49
+ }
50
+
51
+ _checks.splice(0, _checks.length);
52
+ }
53
+ };
54
+ }
55
+
56
+ /*
57
+ * Lexer for JSHint.
58
+ *
59
+ * This object does a char-by-char scan of the provided source code
60
+ * and produces a sequence of tokens.
61
+ *
62
+ * var lex = new Lexer("var i = 0;");
63
+ * lex.start();
64
+ * lex.token(); // returns the next token
65
+ *
66
+ * You have to use the token() method to move the lexer forward
67
+ * but you don't have to use its return value to get tokens. In addition
68
+ * to token() method returning the next token, the Lexer object also
69
+ * emits events.
70
+ *
71
+ * lex.on("Identifier", function (data) {
72
+ * if (data.name.indexOf("_") >= 0) {
73
+ * // Produce a warning.
74
+ * }
75
+ * });
76
+ *
77
+ * Note that the token() method returns tokens in a JSLint-compatible
78
+ * format while the event emitter uses a slightly modified version of
79
+ * Mozilla's JavaScript Parser API. Eventually, we will move away from
80
+ * JSLint format.
81
+ */
82
+ function Lexer(source) {
83
+ var lines = source;
84
+
85
+ if (typeof lines === "string") {
86
+ lines = lines
87
+ .replace(/\r\n/g, "\n")
88
+ .replace(/\r/g, "\n")
89
+ .split("\n");
90
+ }
91
+
92
+ // If the first line is a shebang (#!), make it a blank and move on.
93
+ // Shebangs are used by Node scripts.
94
+
95
+ if (lines[0] && lines[0].substr(0, 2) === "#!") {
96
+ if (lines[0].indexOf("node") !== -1) {
97
+ state.option.node = true;
98
+ }
99
+ lines[0] = "";
100
+ }
101
+
102
+ this.emitter = new events.EventEmitter();
103
+ this.source = source;
104
+ this.setLines(lines);
105
+ this.prereg = true;
106
+
107
+ this.line = 0;
108
+ this.char = 1;
109
+ this.from = 1;
110
+ this.input = "";
111
+ this.inComment = false;
112
+
113
+ for (var i = 0; i < state.option.indent; i += 1) {
114
+ state.tab += " ";
115
+ }
116
+ }
117
+
118
+ Lexer.prototype = {
119
+ _lines: [],
120
+
121
+ getLines: function () {
122
+ this._lines = state.lines;
123
+ return this._lines;
124
+ },
125
+
126
+ setLines: function (val) {
127
+ this._lines = val;
128
+ state.lines = this._lines;
129
+ },
130
+
131
+ /*
132
+ * Return the next i character without actually moving the
133
+ * char pointer.
134
+ */
135
+ peek: function (i) {
136
+ return this.input.charAt(i || 0);
137
+ },
138
+
139
+ /*
140
+ * Move the char pointer forward i times.
141
+ */
142
+ skip: function (i) {
143
+ i = i || 1;
144
+ this.char += i;
145
+ this.input = this.input.slice(i);
146
+ },
147
+
148
+ /*
149
+ * Subscribe to a token event. The API for this method is similar
150
+ * Underscore.js i.e. you can subscribe to multiple events with
151
+ * one call:
152
+ *
153
+ * lex.on("Identifier Number", function (data) {
154
+ * // ...
155
+ * });
156
+ */
157
+ on: function (names, listener) {
158
+ names.split(" ").forEach(function (name) {
159
+ this.emitter.on(name, listener);
160
+ }.bind(this));
161
+ },
162
+
163
+ /*
164
+ * Trigger a token event. All arguments will be passed to each
165
+ * listener.
166
+ */
167
+ trigger: function () {
168
+ this.emitter.emit.apply(this.emitter, Array.prototype.slice.call(arguments));
169
+ },
170
+
171
+ /*
172
+ * Postpone a token event. the checking condition is set as
173
+ * last parameter, and the trigger function is called in a
174
+ * stored callback. To be later called using the check() function
175
+ * by the parser. This avoids parser's peek() to give the lexer
176
+ * a false context.
177
+ */
178
+ triggerAsync: function (type, args, checks, fn) {
179
+ checks.push(function () {
180
+ if (fn()) {
181
+ this.trigger(type, args);
182
+ }
183
+ }.bind(this));
184
+ },
185
+
186
+ /*
187
+ * Extract a punctuator out of the next sequence of characters
188
+ * or return 'null' if its not possible.
189
+ *
190
+ * This method's implementation was heavily influenced by the
191
+ * scanPunctuator function in the Esprima parser's source code.
192
+ */
193
+ scanPunctuator: function () {
194
+ var ch1 = this.peek();
195
+ var ch2, ch3, ch4;
196
+
197
+ switch (ch1) {
198
+ // Most common single-character punctuators
199
+ case ".":
200
+ if ((/^[0-9]$/).test(this.peek(1))) {
201
+ return null;
202
+ }
203
+ if (this.peek(1) === "." && this.peek(2) === ".") {
204
+ return {
205
+ type: Token.Punctuator,
206
+ value: "..."
207
+ };
208
+ }
209
+ /* falls through */
210
+ case "(":
211
+ case ")":
212
+ case ";":
213
+ case ",":
214
+ case "{":
215
+ case "}":
216
+ case "[":
217
+ case "]":
218
+ case ":":
219
+ case "~":
220
+ case "?":
221
+ return {
222
+ type: Token.Punctuator,
223
+ value: ch1
224
+ };
225
+
226
+ // A pound sign (for Node shebangs)
227
+ case "#":
228
+ return {
229
+ type: Token.Punctuator,
230
+ value: ch1
231
+ };
232
+
233
+ // We're at the end of input
234
+ case "":
235
+ return null;
236
+ }
237
+
238
+ // Peek more characters
239
+
240
+ ch2 = this.peek(1);
241
+ ch3 = this.peek(2);
242
+ ch4 = this.peek(3);
243
+
244
+ // 4-character punctuator: >>>=
245
+
246
+ if (ch1 === ">" && ch2 === ">" && ch3 === ">" && ch4 === "=") {
247
+ return {
248
+ type: Token.Punctuator,
249
+ value: ">>>="
250
+ };
251
+ }
252
+
253
+ // 3-character punctuators: === !== >>> <<= >>=
254
+
255
+ if (ch1 === "=" && ch2 === "=" && ch3 === "=") {
256
+ return {
257
+ type: Token.Punctuator,
258
+ value: "==="
259
+ };
260
+ }
261
+
262
+ if (ch1 === "!" && ch2 === "=" && ch3 === "=") {
263
+ return {
264
+ type: Token.Punctuator,
265
+ value: "!=="
266
+ };
267
+ }
268
+
269
+ if (ch1 === ">" && ch2 === ">" && ch3 === ">") {
270
+ return {
271
+ type: Token.Punctuator,
272
+ value: ">>>"
273
+ };
274
+ }
275
+
276
+ if (ch1 === "<" && ch2 === "<" && ch3 === "=") {
277
+ return {
278
+ type: Token.Punctuator,
279
+ value: "<<="
280
+ };
281
+ }
282
+
283
+ if (ch1 === ">" && ch2 === ">" && ch3 === "=") {
284
+ return {
285
+ type: Token.Punctuator,
286
+ value: ">>="
287
+ };
288
+ }
289
+
290
+ // Fat arrow punctuator
291
+ if (ch1 === "=" && ch2 === ">") {
292
+ return {
293
+ type: Token.Punctuator,
294
+ value: ch1 + ch2
295
+ };
296
+ }
297
+
298
+ // 2-character punctuators: <= >= == != ++ -- << >> && ||
299
+ // += -= *= %= &= |= ^= (but not /=, see below)
300
+ if (ch1 === ch2 && ("+-<>&|".indexOf(ch1) >= 0)) {
301
+ return {
302
+ type: Token.Punctuator,
303
+ value: ch1 + ch2
304
+ };
305
+ }
306
+
307
+ if ("<>=!+-*%&|^".indexOf(ch1) >= 0) {
308
+ if (ch2 === "=") {
309
+ return {
310
+ type: Token.Punctuator,
311
+ value: ch1 + ch2
312
+ };
313
+ }
314
+
315
+ return {
316
+ type: Token.Punctuator,
317
+ value: ch1
318
+ };
319
+ }
320
+
321
+ // Special case: /=. We need to make sure that this is an
322
+ // operator and not a regular expression.
323
+
324
+ if (ch1 === "/") {
325
+ if (ch2 === "=" && /\/=(?!(\S*\/[gim]?))/.test(this.input)) {
326
+ // /= is not a part of a regular expression, return it as a
327
+ // punctuator.
328
+ return {
329
+ type: Token.Punctuator,
330
+ value: "/="
331
+ };
332
+ }
333
+
334
+ return {
335
+ type: Token.Punctuator,
336
+ value: "/"
337
+ };
338
+ }
339
+
340
+ return null;
341
+ },
342
+
343
+ /*
344
+ * Extract a comment out of the next sequence of characters and/or
345
+ * lines or return 'null' if its not possible. Since comments can
346
+ * span across multiple lines this method has to move the char
347
+ * pointer.
348
+ *
349
+ * In addition to normal JavaScript comments (// and /*) this method
350
+ * also recognizes JSHint- and JSLint-specific comments such as
351
+ * /*jshint, /*jslint, /*globals and so on.
352
+ */
353
+ scanComments: function () {
354
+ var ch1 = this.peek();
355
+ var ch2 = this.peek(1);
356
+ var rest = this.input.substr(2);
357
+ var startLine = this.line;
358
+ var startChar = this.char;
359
+
360
+ // Create a comment token object and make sure it
361
+ // has all the data JSHint needs to work with special
362
+ // comments.
363
+
364
+ function commentToken(label, body, opt) {
365
+ var special = ["jshint", "jslint", "members", "member", "globals", "global", "exported"];
366
+ var isSpecial = false;
367
+ var value = label + body;
368
+ var commentType = "plain";
369
+ opt = opt || {};
370
+
371
+ if (opt.isMultiline) {
372
+ value += "*/";
373
+ }
374
+
375
+ special.forEach(function (str) {
376
+ if (isSpecial) {
377
+ return;
378
+ }
379
+
380
+ // Don't recognize any special comments other than jshint for single-line
381
+ // comments. This introduced many problems with legit comments.
382
+ if (label === "//" && str !== "jshint") {
383
+ return;
384
+ }
385
+
386
+ if (body.substr(0, str.length) === str) {
387
+ isSpecial = true;
388
+ label = label + str;
389
+ body = body.substr(str.length);
390
+ }
391
+
392
+ if (!isSpecial && body.charAt(0) === " " && body.substr(1, str.length) === str) {
393
+ isSpecial = true;
394
+ label = label + " " + str;
395
+ body = body.substr(str.length + 1);
396
+ }
397
+
398
+ if (!isSpecial) {
399
+ return;
400
+ }
401
+
402
+ switch (str) {
403
+ case "member":
404
+ commentType = "members";
405
+ break;
406
+ case "global":
407
+ commentType = "globals";
408
+ break;
409
+ default:
410
+ commentType = str;
411
+ }
412
+ });
413
+
414
+ return {
415
+ type: Token.Comment,
416
+ commentType: commentType,
417
+ value: value,
418
+ body: body,
419
+ isSpecial: isSpecial,
420
+ isMultiline: opt.isMultiline || false,
421
+ isMalformed: opt.isMalformed || false
422
+ };
423
+ }
424
+
425
+ // End of unbegun comment. Raise an error and skip that input.
426
+ if (ch1 === "*" && ch2 === "/") {
427
+ this.trigger("error", {
428
+ code: "E018",
429
+ line: startLine,
430
+ character: startChar
431
+ });
432
+
433
+ this.skip(2);
434
+ return null;
435
+ }
436
+
437
+ // Comments must start either with // or /*
438
+ if (ch1 !== "/" || (ch2 !== "*" && ch2 !== "/")) {
439
+ return null;
440
+ }
441
+
442
+ // One-line comment
443
+ if (ch2 === "/") {
444
+ this.skip(this.input.length); // Skip to the EOL.
445
+ return commentToken("//", rest);
446
+ }
447
+
448
+ var body = "";
449
+
450
+ /* Multi-line comment */
451
+ if (ch2 === "*") {
452
+ this.inComment = true;
453
+ this.skip(2);
454
+
455
+ while (this.peek() !== "*" || this.peek(1) !== "/") {
456
+ if (this.peek() === "") { // End of Line
457
+ body += "\n";
458
+
459
+ // If we hit EOF and our comment is still unclosed,
460
+ // trigger an error and end the comment implicitly.
461
+ if (!this.nextLine()) {
462
+ this.trigger("error", {
463
+ code: "E017",
464
+ line: startLine,
465
+ character: startChar
466
+ });
467
+
468
+ this.inComment = false;
469
+ return commentToken("/*", body, {
470
+ isMultiline: true,
471
+ isMalformed: true
472
+ });
473
+ }
474
+ } else {
475
+ body += this.peek();
476
+ this.skip();
477
+ }
478
+ }
479
+
480
+ this.skip(2);
481
+ this.inComment = false;
482
+ return commentToken("/*", body, { isMultiline: true });
483
+ }
484
+ },
485
+
486
+ /*
487
+ * Extract a keyword out of the next sequence of characters or
488
+ * return 'null' if its not possible.
489
+ */
490
+ scanKeyword: function () {
491
+ var result = /^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input);
492
+ var keywords = [
493
+ "if", "in", "do", "var", "for", "new",
494
+ "try", "let", "this", "else", "case",
495
+ "void", "with", "enum", "while", "break",
496
+ "catch", "throw", "const", "yield", "class",
497
+ "super", "return", "typeof", "delete",
498
+ "switch", "export", "import", "default",
499
+ "finally", "extends", "function", "continue",
500
+ "debugger", "instanceof"
501
+ ];
502
+
503
+ if (result && keywords.indexOf(result[0]) >= 0) {
504
+ return {
505
+ type: Token.Keyword,
506
+ value: result[0]
507
+ };
508
+ }
509
+
510
+ return null;
511
+ },
512
+
513
+ /*
514
+ * Extract a JavaScript identifier out of the next sequence of
515
+ * characters or return 'null' if its not possible. In addition,
516
+ * to Identifier this method can also produce BooleanLiteral
517
+ * (true/false) and NullLiteral (null).
518
+ */
519
+ scanIdentifier: function () {
520
+ var id = "";
521
+ var index = 0;
522
+ var type, char;
523
+
524
+ function isNonAsciiIdentifierStart(code) {
525
+ return nonAsciiIdentifierStartTable.indexOf(code) > -1;
526
+ }
527
+
528
+ function isNonAsciiIdentifierPart(code) {
529
+ return isNonAsciiIdentifierStart(code) || nonAsciiIdentifierPartTable.indexOf(code) > -1;
530
+ }
531
+
532
+ function isHexDigit(str) {
533
+ return (/^[0-9a-fA-F]$/).test(str);
534
+ }
535
+
536
+ var readUnicodeEscapeSequence = function () {
537
+ /*jshint validthis:true */
538
+ index += 1;
539
+
540
+ if (this.peek(index) !== "u") {
541
+ return null;
542
+ }
543
+
544
+ var ch1 = this.peek(index + 1);
545
+ var ch2 = this.peek(index + 2);
546
+ var ch3 = this.peek(index + 3);
547
+ var ch4 = this.peek(index + 4);
548
+ var code;
549
+
550
+ if (isHexDigit(ch1) && isHexDigit(ch2) && isHexDigit(ch3) && isHexDigit(ch4)) {
551
+ code = parseInt(ch1 + ch2 + ch3 + ch4, 16);
552
+
553
+ if (asciiIdentifierPartTable[code] || isNonAsciiIdentifierPart(code)) {
554
+ index += 5;
555
+ return "\\u" + ch1 + ch2 + ch3 + ch4;
556
+ }
557
+
558
+ return null;
559
+ }
560
+
561
+ return null;
562
+ }.bind(this);
563
+
564
+ var getIdentifierStart = function () {
565
+ /*jshint validthis:true */
566
+ var chr = this.peek(index);
567
+ var code = chr.charCodeAt(0);
568
+
569
+ if (code === 92) {
570
+ return readUnicodeEscapeSequence();
571
+ }
572
+
573
+ if (code < 128) {
574
+ if (asciiIdentifierStartTable[code]) {
575
+ index += 1;
576
+ return chr;
577
+ }
578
+
579
+ return null;
580
+ }
581
+
582
+ if (isNonAsciiIdentifierStart(code)) {
583
+ index += 1;
584
+ return chr;
585
+ }
586
+
587
+ return null;
588
+ }.bind(this);
589
+
590
+ var getIdentifierPart = function () {
591
+ /*jshint validthis:true */
592
+ var chr = this.peek(index);
593
+ var code = chr.charCodeAt(0);
594
+
595
+ if (code === 92) {
596
+ return readUnicodeEscapeSequence();
597
+ }
598
+
599
+ if (code < 128) {
600
+ if (asciiIdentifierPartTable[code]) {
601
+ index += 1;
602
+ return chr;
603
+ }
604
+
605
+ return null;
606
+ }
607
+
608
+ if (isNonAsciiIdentifierPart(code)) {
609
+ index += 1;
610
+ return chr;
611
+ }
612
+
613
+ return null;
614
+ }.bind(this);
615
+
616
+ char = getIdentifierStart();
617
+ if (char === null) {
618
+ return null;
619
+ }
620
+
621
+ id = char;
622
+ for (;;) {
623
+ char = getIdentifierPart();
624
+
625
+ if (char === null) {
626
+ break;
627
+ }
628
+
629
+ id += char;
630
+ }
631
+
632
+ switch (id) {
633
+ case "true":
634
+ case "false":
635
+ type = Token.BooleanLiteral;
636
+ break;
637
+ case "null":
638
+ type = Token.NullLiteral;
639
+ break;
640
+ default:
641
+ type = Token.Identifier;
642
+ }
643
+
644
+ return {
645
+ type: type,
646
+ value: id
647
+ };
648
+ },
649
+
650
+ /*
651
+ * Extract a numeric literal out of the next sequence of
652
+ * characters or return 'null' if its not possible. This method
653
+ * supports all numeric literals described in section 7.8.3
654
+ * of the EcmaScript 5 specification.
655
+ *
656
+ * This method's implementation was heavily influenced by the
657
+ * scanNumericLiteral function in the Esprima parser's source code.
658
+ */
659
+ scanNumericLiteral: function () {
660
+ var index = 0;
661
+ var value = "";
662
+ var length = this.input.length;
663
+ var char = this.peek(index);
664
+ var bad;
665
+
666
+ function isDecimalDigit(str) {
667
+ return (/^[0-9]$/).test(str);
668
+ }
669
+
670
+ function isOctalDigit(str) {
671
+ return (/^[0-7]$/).test(str);
672
+ }
673
+
674
+ function isHexDigit(str) {
675
+ return (/^[0-9a-fA-F]$/).test(str);
676
+ }
677
+
678
+ function isIdentifierStart(ch) {
679
+ return (ch === "$") || (ch === "_") || (ch === "\\") ||
680
+ (ch >= "a" && ch <= "z") || (ch >= "A" && ch <= "Z");
681
+ }
682
+
683
+ // Numbers must start either with a decimal digit or a point.
684
+
685
+ if (char !== "." && !isDecimalDigit(char)) {
686
+ return null;
687
+ }
688
+
689
+ if (char !== ".") {
690
+ value = this.peek(index);
691
+ index += 1;
692
+ char = this.peek(index);
693
+
694
+ if (value === "0") {
695
+ // Base-16 numbers.
696
+ if (char === "x" || char === "X") {
697
+ index += 1;
698
+ value += char;
699
+
700
+ while (index < length) {
701
+ char = this.peek(index);
702
+ if (!isHexDigit(char)) {
703
+ break;
704
+ }
705
+ value += char;
706
+ index += 1;
707
+ }
708
+
709
+ if (value.length <= 2) { // 0x
710
+ return {
711
+ type: Token.NumericLiteral,
712
+ value: value,
713
+ isMalformed: true
714
+ };
715
+ }
716
+
717
+ if (index < length) {
718
+ char = this.peek(index);
719
+ if (isIdentifierStart(char)) {
720
+ return null;
721
+ }
722
+ }
723
+
724
+ return {
725
+ type: Token.NumericLiteral,
726
+ value: value,
727
+ base: 16,
728
+ isMalformed: false
729
+ };
730
+ }
731
+
732
+ // Base-8 numbers.
733
+ if (isOctalDigit(char)) {
734
+ index += 1;
735
+ value += char;
736
+ bad = false;
737
+
738
+ while (index < length) {
739
+ char = this.peek(index);
740
+
741
+ // Numbers like '019' (note the 9) are not valid octals
742
+ // but we still parse them and mark as malformed.
743
+
744
+ if (isDecimalDigit(char)) {
745
+ bad = true;
746
+ } else if (!isOctalDigit(char)) {
747
+ break;
748
+ }
749
+ value += char;
750
+ index += 1;
751
+ }
752
+
753
+ if (index < length) {
754
+ char = this.peek(index);
755
+ if (isIdentifierStart(char)) {
756
+ return null;
757
+ }
758
+ }
759
+
760
+ return {
761
+ type: Token.NumericLiteral,
762
+ value: value,
763
+ base: 8,
764
+ isMalformed: false
765
+ };
766
+ }
767
+
768
+ // Decimal numbers that start with '0' such as '09' are illegal
769
+ // but we still parse them and return as malformed.
770
+
771
+ if (isDecimalDigit(char)) {
772
+ index += 1;
773
+ value += char;
774
+ }
775
+ }
776
+
777
+ while (index < length) {
778
+ char = this.peek(index);
779
+ if (!isDecimalDigit(char)) {
780
+ break;
781
+ }
782
+ value += char;
783
+ index += 1;
784
+ }
785
+ }
786
+
787
+ // Decimal digits.
788
+
789
+ if (char === ".") {
790
+ value += char;
791
+ index += 1;
792
+
793
+ while (index < length) {
794
+ char = this.peek(index);
795
+ if (!isDecimalDigit(char)) {
796
+ break;
797
+ }
798
+ value += char;
799
+ index += 1;
800
+ }
801
+ }
802
+
803
+ // Exponent part.
804
+
805
+ if (char === "e" || char === "E") {
806
+ value += char;
807
+ index += 1;
808
+ char = this.peek(index);
809
+
810
+ if (char === "+" || char === "-") {
811
+ value += this.peek(index);
812
+ index += 1;
813
+ }
814
+
815
+ char = this.peek(index);
816
+ if (isDecimalDigit(char)) {
817
+ value += char;
818
+ index += 1;
819
+
820
+ while (index < length) {
821
+ char = this.peek(index);
822
+ if (!isDecimalDigit(char)) {
823
+ break;
824
+ }
825
+ value += char;
826
+ index += 1;
827
+ }
828
+ } else {
829
+ return null;
830
+ }
831
+ }
832
+
833
+ if (index < length) {
834
+ char = this.peek(index);
835
+ if (isIdentifierStart(char)) {
836
+ return null;
837
+ }
838
+ }
839
+
840
+ return {
841
+ type: Token.NumericLiteral,
842
+ value: value,
843
+ base: 10,
844
+ isMalformed: !isFinite(value)
845
+ };
846
+ },
847
+
848
+ /*
849
+ * Extract a template literal out of the next sequence of characters
850
+ * and/or lines or return 'null' if its not possible. Since template
851
+ * literals can span across multiple lines, this method has to move
852
+ * the char pointer.
853
+ */
854
+ scanTemplateLiteral: function () {
855
+ // String must start with a backtick.
856
+ if (!state.option.esnext || this.peek() !== "`") {
857
+ return null;
858
+ }
859
+
860
+ var startLine = this.line;
861
+ var startChar = this.char;
862
+ var jump = 1;
863
+ var value = "";
864
+
865
+ // For now, do not perform any linting of the content of the template
866
+ // string. Just skip until the next backtick is found.
867
+ this.skip();
868
+
869
+ while (this.peek() !== "`") {
870
+ while (this.peek() === "") {
871
+ // End of line --- For template literals in ES6, no backslash is
872
+ // required to precede newlines.
873
+ if (!this.nextLine()) {
874
+ this.trigger("error", {
875
+ code: "E052",
876
+ line: startLine,
877
+ character: startChar
878
+ });
879
+
880
+ return {
881
+ type: Token.TemplateLiteral,
882
+ value: value,
883
+ isUnclosed: true
884
+ };
885
+ }
886
+ value += "\n";
887
+ }
888
+
889
+ // TODO: do more interesting linting here, similar to string literal
890
+ // linting.
891
+ var char = this.peek();
892
+ this.skip(jump);
893
+ value += char;
894
+ }
895
+
896
+ this.skip();
897
+ return {
898
+ type: Token.TemplateLiteral,
899
+ value: value,
900
+ isUnclosed: false
901
+ };
902
+ },
903
+
904
+ /*
905
+ * Extract a string out of the next sequence of characters and/or
906
+ * lines or return 'null' if its not possible. Since strings can
907
+ * span across multiple lines this method has to move the char
908
+ * pointer.
909
+ *
910
+ * This method recognizes pseudo-multiline JavaScript strings:
911
+ *
912
+ * var str = "hello\
913
+ * world";
914
+ */
915
+ scanStringLiteral: function (checks) {
916
+ /*jshint loopfunc:true */
917
+ var quote = this.peek();
918
+
919
+ // String must start with a quote.
920
+ if (quote !== "\"" && quote !== "'") {
921
+ return null;
922
+ }
923
+
924
+ // In JSON strings must always use double quotes.
925
+ this.triggerAsync("warning", {
926
+ code: "W108",
927
+ line: this.line,
928
+ character: this.char // +1?
929
+ }, checks, function () { return state.jsonMode && quote !== "\""; });
930
+
931
+ var value = "";
932
+ var startLine = this.line;
933
+ var startChar = this.char;
934
+ var allowNewLine = false;
935
+
936
+ this.skip();
937
+
938
+ while (this.peek() !== quote) {
939
+ while (this.peek() === "") { // End Of Line
940
+
941
+ // If an EOL is not preceded by a backslash, show a warning
942
+ // and proceed like it was a legit multi-line string where
943
+ // author simply forgot to escape the newline symbol.
944
+ //
945
+ // Another approach is to implicitly close a string on EOL
946
+ // but it generates too many false positives.
947
+
948
+ if (!allowNewLine) {
949
+ this.trigger("warning", {
950
+ code: "W112",
951
+ line: this.line,
952
+ character: this.char
953
+ });
954
+ } else {
955
+ allowNewLine = false;
956
+
957
+ // Otherwise show a warning if multistr option was not set.
958
+ // For JSON, show warning no matter what.
959
+
960
+ this.triggerAsync("warning", {
961
+ code: "W043",
962
+ line: this.line,
963
+ character: this.char
964
+ }, checks, function () { return !state.option.multistr; });
965
+
966
+ this.triggerAsync("warning", {
967
+ code: "W042",
968
+ line: this.line,
969
+ character: this.char
970
+ }, checks, function () { return state.jsonMode && state.option.multistr; });
971
+ }
972
+
973
+ // If we get an EOF inside of an unclosed string, show an
974
+ // error and implicitly close it at the EOF point.
975
+
976
+ if (!this.nextLine()) {
977
+ this.trigger("error", {
978
+ code: "E029",
979
+ line: startLine,
980
+ character: startChar
981
+ });
982
+
983
+ return {
984
+ type: Token.StringLiteral,
985
+ value: value,
986
+ isUnclosed: true,
987
+ quote: quote
988
+ };
989
+ }
990
+ }
991
+
992
+ allowNewLine = false;
993
+ var char = this.peek();
994
+ var jump = 1; // A length of a jump, after we're done
995
+ // parsing this character.
996
+
997
+ if (char < " ") {
998
+ // Warn about a control character in a string.
999
+ this.trigger("warning", {
1000
+ code: "W113",
1001
+ line: this.line,
1002
+ character: this.char,
1003
+ data: [ "<non-printable>" ]
1004
+ });
1005
+ }
1006
+
1007
+ // Special treatment for some escaped characters.
1008
+
1009
+ if (char === "\\") {
1010
+ this.skip();
1011
+ char = this.peek();
1012
+
1013
+ switch (char) {
1014
+ case "'":
1015
+ this.triggerAsync("warning", {
1016
+ code: "W114",
1017
+ line: this.line,
1018
+ character: this.char,
1019
+ data: [ "\\'" ]
1020
+ }, checks, function () {return state.jsonMode; });
1021
+ break;
1022
+ case "b":
1023
+ char = "\\b";
1024
+ break;
1025
+ case "f":
1026
+ char = "\\f";
1027
+ break;
1028
+ case "n":
1029
+ char = "\\n";
1030
+ break;
1031
+ case "r":
1032
+ char = "\\r";
1033
+ break;
1034
+ case "t":
1035
+ char = "\\t";
1036
+ break;
1037
+ case "0":
1038
+ char = "\\0";
1039
+
1040
+ // Octal literals fail in strict mode.
1041
+ // Check if the number is between 00 and 07.
1042
+ var n = parseInt(this.peek(1), 10);
1043
+ this.triggerAsync("warning", {
1044
+ code: "W115",
1045
+ line: this.line,
1046
+ character: this.char
1047
+ }, checks,
1048
+ function () { return n >= 0 && n <= 7 && state.directive["use strict"]; });
1049
+ break;
1050
+ case "u":
1051
+ char = String.fromCharCode(parseInt(this.input.substr(1, 4), 16));
1052
+ jump = 5;
1053
+ break;
1054
+ case "v":
1055
+ this.triggerAsync("warning", {
1056
+ code: "W114",
1057
+ line: this.line,
1058
+ character: this.char,
1059
+ data: [ "\\v" ]
1060
+ }, checks, function () { return state.jsonMode; });
1061
+
1062
+ char = "\v";
1063
+ break;
1064
+ case "x":
1065
+ var x = parseInt(this.input.substr(1, 2), 16);
1066
+
1067
+ this.triggerAsync("warning", {
1068
+ code: "W114",
1069
+ line: this.line,
1070
+ character: this.char,
1071
+ data: [ "\\x-" ]
1072
+ }, checks, function () { return state.jsonMode; });
1073
+
1074
+ char = String.fromCharCode(x);
1075
+ jump = 3;
1076
+ break;
1077
+ case "\\":
1078
+ char = "\\\\";
1079
+ break;
1080
+ case "\"":
1081
+ char = "\\\"";
1082
+ break;
1083
+ case "/":
1084
+ break;
1085
+ case "":
1086
+ allowNewLine = true;
1087
+ char = "";
1088
+ break;
1089
+ case "!":
1090
+ if (value.slice(value.length - 2) === "<") {
1091
+ break;
1092
+ }
1093
+
1094
+ /*falls through */
1095
+ default:
1096
+ // Weird escaping.
1097
+ this.trigger("warning", {
1098
+ code: "W044",
1099
+ line: this.line,
1100
+ character: this.char
1101
+ });
1102
+ }
1103
+ }
1104
+
1105
+ value += char;
1106
+ this.skip(jump);
1107
+ }
1108
+
1109
+ this.skip();
1110
+ return {
1111
+ type: Token.StringLiteral,
1112
+ value: value,
1113
+ isUnclosed: false,
1114
+ quote: quote
1115
+ };
1116
+ },
1117
+
1118
+ /*
1119
+ * Extract a regular expression out of the next sequence of
1120
+ * characters and/or lines or return 'null' if its not possible.
1121
+ *
1122
+ * This method is platform dependent: it accepts almost any
1123
+ * regular expression values but then tries to compile and run
1124
+ * them using system's RegExp object. This means that there are
1125
+ * rare edge cases where one JavaScript engine complains about
1126
+ * your regular expression while others don't.
1127
+ */
1128
+ scanRegExp: function () {
1129
+ var index = 0;
1130
+ var length = this.input.length;
1131
+ var char = this.peek();
1132
+ var value = char;
1133
+ var body = "";
1134
+ var flags = [];
1135
+ var malformed = false;
1136
+ var isCharSet = false;
1137
+ var terminated;
1138
+
1139
+ var scanUnexpectedChars = function () {
1140
+ // Unexpected control character
1141
+ if (char < " ") {
1142
+ malformed = true;
1143
+ this.trigger("warning", {
1144
+ code: "W048",
1145
+ line: this.line,
1146
+ character: this.char
1147
+ });
1148
+ }
1149
+
1150
+ // Unexpected escaped character
1151
+ if (char === "<") {
1152
+ malformed = true;
1153
+ this.trigger("warning", {
1154
+ code: "W049",
1155
+ line: this.line,
1156
+ character: this.char,
1157
+ data: [ char ]
1158
+ });
1159
+ }
1160
+ }.bind(this);
1161
+
1162
+ // Regular expressions must start with '/'
1163
+ if (!this.prereg || char !== "/") {
1164
+ return null;
1165
+ }
1166
+
1167
+ index += 1;
1168
+ terminated = false;
1169
+
1170
+ // Try to get everything in between slashes. A couple of
1171
+ // cases aside (see scanUnexpectedChars) we don't really
1172
+ // care whether the resulting expression is valid or not.
1173
+ // We will check that later using the RegExp object.
1174
+
1175
+ while (index < length) {
1176
+ char = this.peek(index);
1177
+ value += char;
1178
+ body += char;
1179
+
1180
+ if (isCharSet) {
1181
+ if (char === "]") {
1182
+ if (this.peek(index - 1) !== "\\" || this.peek(index - 2) === "\\") {
1183
+ isCharSet = false;
1184
+ }
1185
+ }
1186
+
1187
+ if (char === "\\") {
1188
+ index += 1;
1189
+ char = this.peek(index);
1190
+ body += char;
1191
+ value += char;
1192
+
1193
+ scanUnexpectedChars();
1194
+ }
1195
+
1196
+ index += 1;
1197
+ continue;
1198
+ }
1199
+
1200
+ if (char === "\\") {
1201
+ index += 1;
1202
+ char = this.peek(index);
1203
+ body += char;
1204
+ value += char;
1205
+
1206
+ scanUnexpectedChars();
1207
+
1208
+ if (char === "/") {
1209
+ index += 1;
1210
+ continue;
1211
+ }
1212
+
1213
+ if (char === "[") {
1214
+ index += 1;
1215
+ continue;
1216
+ }
1217
+ }
1218
+
1219
+ if (char === "[") {
1220
+ isCharSet = true;
1221
+ index += 1;
1222
+ continue;
1223
+ }
1224
+
1225
+ if (char === "/") {
1226
+ body = body.substr(0, body.length - 1);
1227
+ terminated = true;
1228
+ index += 1;
1229
+ break;
1230
+ }
1231
+
1232
+ index += 1;
1233
+ }
1234
+
1235
+ // A regular expression that was never closed is an
1236
+ // error from which we cannot recover.
1237
+
1238
+ if (!terminated) {
1239
+ this.trigger("error", {
1240
+ code: "E015",
1241
+ line: this.line,
1242
+ character: this.from
1243
+ });
1244
+
1245
+ return void this.trigger("fatal", {
1246
+ line: this.line,
1247
+ from: this.from
1248
+ });
1249
+ }
1250
+
1251
+ // Parse flags (if any).
1252
+
1253
+ while (index < length) {
1254
+ char = this.peek(index);
1255
+ if (!/[gim]/.test(char)) {
1256
+ break;
1257
+ }
1258
+ flags.push(char);
1259
+ value += char;
1260
+ index += 1;
1261
+ }
1262
+
1263
+ // Check regular expression for correctness.
1264
+
1265
+ try {
1266
+ new RegExp(body, flags.join(""));
1267
+ } catch (err) {
1268
+ malformed = true;
1269
+ this.trigger("error", {
1270
+ code: "E016",
1271
+ line: this.line,
1272
+ character: this.char,
1273
+ data: [ err.message ] // Platform dependent!
1274
+ });
1275
+ }
1276
+
1277
+ return {
1278
+ type: Token.RegExp,
1279
+ value: value,
1280
+ flags: flags,
1281
+ isMalformed: malformed
1282
+ };
1283
+ },
1284
+
1285
+ /*
1286
+ * Scan for any occurence of non-breaking spaces. Non-breaking spaces
1287
+ * can be mistakenly typed on OS X with option-space. Non UTF-8 web
1288
+ * pages with non-breaking pages produce syntax errors.
1289
+ */
1290
+ scanNonBreakingSpaces: function () {
1291
+ return state.option.nonbsp ?
1292
+ this.input.search(/(\u00A0)/) : -1;
1293
+ },
1294
+
1295
+ /*
1296
+ * Scan for characters that get silently deleted by one or more browsers.
1297
+ */
1298
+ scanUnsafeChars: function () {
1299
+ return this.input.search(reg.unsafeChars);
1300
+ },
1301
+
1302
+ /*
1303
+ * Produce the next raw token or return 'null' if no tokens can be matched.
1304
+ * This method skips over all space characters.
1305
+ */
1306
+ next: function (checks) {
1307
+ this.from = this.char;
1308
+
1309
+ // Move to the next non-space character.
1310
+ var start;
1311
+ if (/\s/.test(this.peek())) {
1312
+ start = this.char;
1313
+
1314
+ while (/\s/.test(this.peek())) {
1315
+ this.from += 1;
1316
+ this.skip();
1317
+ }
1318
+ }
1319
+
1320
+ // Methods that work with multi-line structures and move the
1321
+ // character pointer.
1322
+
1323
+ var match = this.scanComments() ||
1324
+ this.scanStringLiteral(checks) ||
1325
+ this.scanTemplateLiteral();
1326
+
1327
+ if (match) {
1328
+ return match;
1329
+ }
1330
+
1331
+ // Methods that don't move the character pointer.
1332
+
1333
+ match =
1334
+ this.scanRegExp() ||
1335
+ this.scanPunctuator() ||
1336
+ this.scanKeyword() ||
1337
+ this.scanIdentifier() ||
1338
+ this.scanNumericLiteral();
1339
+
1340
+ if (match) {
1341
+ this.skip(match.value.length);
1342
+ return match;
1343
+ }
1344
+
1345
+ // No token could be matched, give up.
1346
+
1347
+ return null;
1348
+ },
1349
+
1350
+ /*
1351
+ * Switch to the next line and reset all char pointers. Once
1352
+ * switched, this method also checks for other minor warnings.
1353
+ */
1354
+ nextLine: function () {
1355
+ var char;
1356
+
1357
+ if (this.line >= this.getLines().length) {
1358
+ return false;
1359
+ }
1360
+
1361
+ this.input = this.getLines()[this.line];
1362
+ this.line += 1;
1363
+ this.char = 1;
1364
+ this.from = 1;
1365
+
1366
+ var inputTrimmed = this.input.trim();
1367
+
1368
+ var startsWith = function () {
1369
+ return _.some(arguments, function (prefix) {
1370
+ return inputTrimmed.indexOf(prefix) === 0;
1371
+ });
1372
+ };
1373
+
1374
+ var endsWith = function () {
1375
+ return _.some(arguments, function (suffix) {
1376
+ return inputTrimmed.indexOf(suffix, inputTrimmed.length - suffix.length) !== -1;
1377
+ });
1378
+ };
1379
+
1380
+ // If we are ignoring linter errors, replace the input with empty string
1381
+ // if it doesn't already at least start or end a multi-line comment
1382
+ if (state.ignoreLinterErrors === true) {
1383
+ if (!startsWith("/*", "//") && !endsWith("*/")) {
1384
+ this.input = "";
1385
+ }
1386
+ }
1387
+
1388
+ char = this.scanNonBreakingSpaces();
1389
+ if (char >= 0) {
1390
+ this.trigger("warning", { code: "W125", line: this.line, character: char + 1 });
1391
+ }
1392
+
1393
+ this.input = this.input.replace(/\t/g, state.tab);
1394
+ char = this.scanUnsafeChars();
1395
+
1396
+ if (char >= 0) {
1397
+ this.trigger("warning", { code: "W100", line: this.line, character: char });
1398
+ }
1399
+
1400
+ // If there is a limit on line length, warn when lines get too
1401
+ // long.
1402
+
1403
+ if (state.option.maxlen && state.option.maxlen < this.input.length) {
1404
+ var inComment = this.inComment ||
1405
+ startsWith.call(inputTrimmed, "//") ||
1406
+ startsWith.call(inputTrimmed, "/*");
1407
+
1408
+ var shouldTriggerError = !inComment || !reg.maxlenException.test(inputTrimmed);
1409
+
1410
+ if (shouldTriggerError) {
1411
+ this.trigger("warning", { code: "W101", line: this.line, character: this.input.length });
1412
+ }
1413
+ }
1414
+
1415
+ return true;
1416
+ },
1417
+
1418
+ /*
1419
+ * This is simply a synonym for nextLine() method with a friendlier
1420
+ * public name.
1421
+ */
1422
+ start: function () {
1423
+ this.nextLine();
1424
+ },
1425
+
1426
+ /*
1427
+ * Produce the next token. This function is called by advance() to get
1428
+ * the next token. It retuns a token in a JSLint-compatible format.
1429
+ */
1430
+ token: function () {
1431
+ /*jshint loopfunc:true */
1432
+ var checks = asyncTrigger();
1433
+ var token;
1434
+
1435
+
1436
+ function isReserved(token, isProperty) {
1437
+ if (!token.reserved) {
1438
+ return false;
1439
+ }
1440
+ var meta = token.meta;
1441
+
1442
+ if (meta && meta.isFutureReservedWord && state.option.inES5()) {
1443
+ // ES3 FutureReservedWord in an ES5 environment.
1444
+ if (!meta.es5) {
1445
+ return false;
1446
+ }
1447
+
1448
+ // Some ES5 FutureReservedWord identifiers are active only
1449
+ // within a strict mode environment.
1450
+ if (meta.strictOnly) {
1451
+ if (!state.option.strict && !state.directive["use strict"]) {
1452
+ return false;
1453
+ }
1454
+ }
1455
+
1456
+ if (isProperty) {
1457
+ return false;
1458
+ }
1459
+ }
1460
+
1461
+ return true;
1462
+ }
1463
+
1464
+ // Produce a token object.
1465
+ var create = function (type, value, isProperty) {
1466
+ /*jshint validthis:true */
1467
+ var obj;
1468
+
1469
+ if (type !== "(endline)" && type !== "(end)") {
1470
+ this.prereg = false;
1471
+ }
1472
+
1473
+ if (type === "(punctuator)") {
1474
+ switch (value) {
1475
+ case ".":
1476
+ case ")":
1477
+ case "~":
1478
+ case "#":
1479
+ case "]":
1480
+ this.prereg = false;
1481
+ break;
1482
+ default:
1483
+ this.prereg = true;
1484
+ }
1485
+
1486
+ obj = Object.create(state.syntax[value] || state.syntax["(error)"]);
1487
+ }
1488
+
1489
+ if (type === "(identifier)") {
1490
+ if (value === "return" || value === "case" || value === "typeof") {
1491
+ this.prereg = true;
1492
+ }
1493
+
1494
+ if (_.has(state.syntax, value)) {
1495
+ obj = Object.create(state.syntax[value] || state.syntax["(error)"]);
1496
+
1497
+ // If this can't be a reserved keyword, reset the object.
1498
+ if (!isReserved(obj, isProperty && type === "(identifier)")) {
1499
+ obj = null;
1500
+ }
1501
+ }
1502
+ }
1503
+
1504
+ if (!obj) {
1505
+ obj = Object.create(state.syntax[type]);
1506
+ }
1507
+
1508
+ obj.identifier = (type === "(identifier)");
1509
+ obj.type = obj.type || type;
1510
+ obj.value = value;
1511
+ obj.line = this.line;
1512
+ obj.character = this.char;
1513
+ obj.from = this.from;
1514
+
1515
+ if (isProperty && obj.identifier) {
1516
+ obj.isProperty = isProperty;
1517
+ }
1518
+
1519
+ obj.check = checks.check;
1520
+
1521
+ return obj;
1522
+ }.bind(this);
1523
+
1524
+ for (;;) {
1525
+ if (!this.input.length) {
1526
+ return create(this.nextLine() ? "(endline)" : "(end)", "");
1527
+ }
1528
+
1529
+ token = this.next(checks);
1530
+
1531
+ if (!token) {
1532
+ if (this.input.length) {
1533
+ // Unexpected character.
1534
+ this.trigger("error", {
1535
+ code: "E024",
1536
+ line: this.line,
1537
+ character: this.char,
1538
+ data: [ this.peek() ]
1539
+ });
1540
+
1541
+ this.input = "";
1542
+ }
1543
+
1544
+ continue;
1545
+ }
1546
+
1547
+ switch (token.type) {
1548
+ case Token.StringLiteral:
1549
+ this.triggerAsync("String", {
1550
+ line: this.line,
1551
+ char: this.char,
1552
+ from: this.from,
1553
+ value: token.value,
1554
+ quote: token.quote
1555
+ }, checks, function () { return true; });
1556
+
1557
+ return create("(string)", token.value);
1558
+
1559
+ case Token.TemplateLiteral:
1560
+ this.trigger("Template", {
1561
+ line: this.line,
1562
+ char: this.char,
1563
+ from: this.from,
1564
+ value: token.value
1565
+ });
1566
+ return create("(template)", token.value);
1567
+
1568
+ case Token.Identifier:
1569
+ this.trigger("Identifier", {
1570
+ line: this.line,
1571
+ char: this.char,
1572
+ from: this.form,
1573
+ name: token.value,
1574
+ isProperty: state.tokens.curr.id === "."
1575
+ });
1576
+
1577
+ /* falls through */
1578
+ case Token.Keyword:
1579
+ case Token.NullLiteral:
1580
+ case Token.BooleanLiteral:
1581
+ return create("(identifier)", token.value, state.tokens.curr.id === ".");
1582
+
1583
+ case Token.NumericLiteral:
1584
+ if (token.isMalformed) {
1585
+ this.trigger("warning", {
1586
+ code: "W045",
1587
+ line: this.line,
1588
+ character: this.char,
1589
+ data: [ token.value ]
1590
+ });
1591
+ }
1592
+
1593
+ this.triggerAsync("warning", {
1594
+ code: "W114",
1595
+ line: this.line,
1596
+ character: this.char,
1597
+ data: [ "0x-" ]
1598
+ }, checks, function () { return token.base === 16 && state.jsonMode; });
1599
+
1600
+ this.triggerAsync("warning", {
1601
+ code: "W115",
1602
+ line: this.line,
1603
+ character: this.char
1604
+ }, checks, function () {
1605
+ return state.directive["use strict"] && token.base === 8;
1606
+ });
1607
+
1608
+ this.trigger("Number", {
1609
+ line: this.line,
1610
+ char: this.char,
1611
+ from: this.from,
1612
+ value: token.value,
1613
+ base: token.base,
1614
+ isMalformed: token.malformed
1615
+ });
1616
+
1617
+ return create("(number)", token.value);
1618
+
1619
+ case Token.RegExp:
1620
+ return create("(regexp)", token.value);
1621
+
1622
+ case Token.Comment:
1623
+ state.tokens.curr.comment = true;
1624
+
1625
+ if (token.isSpecial) {
1626
+ return {
1627
+ id: '(comment)',
1628
+ value: token.value,
1629
+ body: token.body,
1630
+ type: token.commentType,
1631
+ isSpecial: token.isSpecial,
1632
+ line: this.line,
1633
+ character: this.char,
1634
+ from: this.from
1635
+ };
1636
+ }
1637
+
1638
+ break;
1639
+
1640
+ case "":
1641
+ break;
1642
+
1643
+ default:
1644
+ return create("(punctuator)", token.value);
1645
+ }
1646
+ }
1647
+ }
1648
+ };
1649
+
1650
+ exports.Lexer = Lexer;