spider-src 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (168) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/Gemfile +7 -0
  4. data/LICENSE.txt +74 -0
  5. data/README.md +37 -0
  6. data/Rakefile +25 -0
  7. data/lib/spider-src/support/spider/.eslintrc +17 -0
  8. data/lib/spider-src/support/spider/.npmignore +9 -0
  9. data/lib/spider-src/support/spider/.travis.yml +7 -0
  10. data/lib/spider-src/support/spider/.yo-rc.json +3 -0
  11. data/lib/spider-src/support/spider/CHANGELOG.md +64 -0
  12. data/lib/spider-src/support/spider/Gruntfile.js +97 -0
  13. data/lib/spider-src/support/spider/Gruntfile.spider +93 -0
  14. data/lib/spider-src/support/spider/LICENSE +201 -0
  15. data/lib/spider-src/support/spider/README.md +50 -0
  16. data/lib/spider-src/support/spider/cli.js +119 -0
  17. data/lib/spider-src/support/spider/lib/ast/CaseClause.js +179 -0
  18. data/lib/spider-src/support/spider/lib/ast/CatchClause.js +26 -0
  19. data/lib/spider-src/support/spider/lib/ast/ExportBatchSpecifier.js +19 -0
  20. data/lib/spider-src/support/spider/lib/ast/ExportSpecifier.js +33 -0
  21. data/lib/spider-src/support/spider/lib/ast/ImportDefaultSpecifier.js +23 -0
  22. data/lib/spider-src/support/spider/lib/ast/ImportNamespaceSpecifier.js +23 -0
  23. data/lib/spider-src/support/spider/lib/ast/ImportSpecifier.js +40 -0
  24. data/lib/spider-src/support/spider/lib/ast/Node.js +93 -0
  25. data/lib/spider-src/support/spider/lib/ast/Parameter.js +229 -0
  26. data/lib/spider-src/support/spider/lib/ast/Program.js +58 -0
  27. data/lib/spider-src/support/spider/lib/ast/Property.js +32 -0
  28. data/lib/spider-src/support/spider/lib/ast/Range.js +257 -0
  29. data/lib/spider-src/support/spider/lib/ast/VariableDeclarator.js +29 -0
  30. data/lib/spider-src/support/spider/lib/ast/expressions/ArrayExpression.js +41 -0
  31. data/lib/spider-src/support/spider/lib/ast/expressions/ArrayPattern.js +45 -0
  32. data/lib/spider-src/support/spider/lib/ast/expressions/AssignmentExpression.js +29 -0
  33. data/lib/spider-src/support/spider/lib/ast/expressions/BinaryExpression.js +104 -0
  34. data/lib/spider-src/support/spider/lib/ast/expressions/CallExpression.js +139 -0
  35. data/lib/spider-src/support/spider/lib/ast/expressions/ConditionalExpression.js +31 -0
  36. data/lib/spider-src/support/spider/lib/ast/expressions/CurryCallExpression.js +102 -0
  37. data/lib/spider-src/support/spider/lib/ast/expressions/ExistentialExpression.js +83 -0
  38. data/lib/spider-src/support/spider/lib/ast/expressions/ForInExpression.js +116 -0
  39. data/lib/spider-src/support/spider/lib/ast/expressions/FunctionExpression.js +157 -0
  40. data/lib/spider-src/support/spider/lib/ast/expressions/InExpression.js +99 -0
  41. data/lib/spider-src/support/spider/lib/ast/expressions/LogicalExpression.js +50 -0
  42. data/lib/spider-src/support/spider/lib/ast/expressions/MemberExpression.js +43 -0
  43. data/lib/spider-src/support/spider/lib/ast/expressions/NewExpression.js +46 -0
  44. data/lib/spider-src/support/spider/lib/ast/expressions/NullCheckCallExpression.js +132 -0
  45. data/lib/spider-src/support/spider/lib/ast/expressions/NullCoalescingExpression.js +114 -0
  46. data/lib/spider-src/support/spider/lib/ast/expressions/NullPropagatingExpression.js +161 -0
  47. data/lib/spider-src/support/spider/lib/ast/expressions/ObjectExpression.js +39 -0
  48. data/lib/spider-src/support/spider/lib/ast/expressions/ObjectPattern.js +49 -0
  49. data/lib/spider-src/support/spider/lib/ast/expressions/RangeMemberExpression.js +157 -0
  50. data/lib/spider-src/support/spider/lib/ast/expressions/SplatExpression.js +48 -0
  51. data/lib/spider-src/support/spider/lib/ast/expressions/SuperExpression.js +170 -0
  52. data/lib/spider-src/support/spider/lib/ast/expressions/ThisExpression.js +22 -0
  53. data/lib/spider-src/support/spider/lib/ast/expressions/UnaryExpression.js +147 -0
  54. data/lib/spider-src/support/spider/lib/ast/expressions/UpdateExpression.js +26 -0
  55. data/lib/spider-src/support/spider/lib/ast/literals/BooleanLiteral.js +24 -0
  56. data/lib/spider-src/support/spider/lib/ast/literals/Identifier.js +60 -0
  57. data/lib/spider-src/support/spider/lib/ast/literals/NullLiteral.js +24 -0
  58. data/lib/spider-src/support/spider/lib/ast/literals/NumberLiteral.js +24 -0
  59. data/lib/spider-src/support/spider/lib/ast/literals/RegularExpressionLiteral.js +25 -0
  60. data/lib/spider-src/support/spider/lib/ast/literals/StringLiteral.js +90 -0
  61. data/lib/spider-src/support/spider/lib/ast/literals/UndefinedLiteral.js +30 -0
  62. data/lib/spider-src/support/spider/lib/ast/statements/BlockStatement.js +47 -0
  63. data/lib/spider-src/support/spider/lib/ast/statements/BreakStatement.js +19 -0
  64. data/lib/spider-src/support/spider/lib/ast/statements/ContinueStatement.js +19 -0
  65. data/lib/spider-src/support/spider/lib/ast/statements/DebuggerStatement.js +19 -0
  66. data/lib/spider-src/support/spider/lib/ast/statements/DoWhileStatement.js +25 -0
  67. data/lib/spider-src/support/spider/lib/ast/statements/ExportDeclarationStatement.js +51 -0
  68. data/lib/spider-src/support/spider/lib/ast/statements/ExpressionStatement.js +22 -0
  69. data/lib/spider-src/support/spider/lib/ast/statements/FallthroughStatement.js +74 -0
  70. data/lib/spider-src/support/spider/lib/ast/statements/ForInStatement.js +79 -0
  71. data/lib/spider-src/support/spider/lib/ast/statements/ForOfStatement.js +98 -0
  72. data/lib/spider-src/support/spider/lib/ast/statements/ForStatement.js +43 -0
  73. data/lib/spider-src/support/spider/lib/ast/statements/FunctionDeclarationStatement.js +104 -0
  74. data/lib/spider-src/support/spider/lib/ast/statements/GoStatement.js +41 -0
  75. data/lib/spider-src/support/spider/lib/ast/statements/IfStatement.js +32 -0
  76. data/lib/spider-src/support/spider/lib/ast/statements/ImportDeclarationStatement.js +40 -0
  77. data/lib/spider-src/support/spider/lib/ast/statements/PushStatement.js +37 -0
  78. data/lib/spider-src/support/spider/lib/ast/statements/ReturnStatement.js +26 -0
  79. data/lib/spider-src/support/spider/lib/ast/statements/SwitchStatement.js +159 -0
  80. data/lib/spider-src/support/spider/lib/ast/statements/ThrowStatement.js +22 -0
  81. data/lib/spider-src/support/spider/lib/ast/statements/TryStatement.js +36 -0
  82. data/lib/spider-src/support/spider/lib/ast/statements/UntilStatement.js +31 -0
  83. data/lib/spider-src/support/spider/lib/ast/statements/UseStatement.js +49 -0
  84. data/lib/spider-src/support/spider/lib/ast/statements/VariableDeclarationStatement.js +36 -0
  85. data/lib/spider-src/support/spider/lib/ast/statements/WhileStatement.js +25 -0
  86. data/lib/spider-src/support/spider/lib/ast.js +16 -0
  87. data/lib/spider-src/support/spider/lib/parser.js +14878 -0
  88. data/lib/spider-src/support/spider/lib/spider.js +217 -0
  89. data/lib/spider-src/support/spider/package.json +61 -0
  90. data/lib/spider-src/support/spider/spider-script.js +6 -0
  91. data/lib/spider-src/support/spider/src/ast/CaseClause.spider +179 -0
  92. data/lib/spider-src/support/spider/src/ast/CatchClause.spider +30 -0
  93. data/lib/spider-src/support/spider/src/ast/ExportBatchSpecifier.spider +19 -0
  94. data/lib/spider-src/support/spider/src/ast/ExportSpecifier.spider +37 -0
  95. data/lib/spider-src/support/spider/src/ast/ImportDefaultSpecifier.spider +25 -0
  96. data/lib/spider-src/support/spider/src/ast/ImportNamespaceSpecifier.spider +25 -0
  97. data/lib/spider-src/support/spider/src/ast/ImportSpecifier.spider +44 -0
  98. data/lib/spider-src/support/spider/src/ast/Node.spider +104 -0
  99. data/lib/spider-src/support/spider/src/ast/Parameter.spider +233 -0
  100. data/lib/spider-src/support/spider/src/ast/Program.spider +109 -0
  101. data/lib/spider-src/support/spider/src/ast/Property.spider +36 -0
  102. data/lib/spider-src/support/spider/src/ast/Range.spider +291 -0
  103. data/lib/spider-src/support/spider/src/ast/VariableDeclarator.spider +33 -0
  104. data/lib/spider-src/support/spider/src/ast/expressions/ArrayExpression.spider +32 -0
  105. data/lib/spider-src/support/spider/src/ast/expressions/ArrayPattern.spider +37 -0
  106. data/lib/spider-src/support/spider/src/ast/expressions/AssignmentExpression.spider +34 -0
  107. data/lib/spider-src/support/spider/src/ast/expressions/BinaryExpression.spider +125 -0
  108. data/lib/spider-src/support/spider/src/ast/expressions/CallExpression.spider +149 -0
  109. data/lib/spider-src/support/spider/src/ast/expressions/ConditionalExpression.spider +34 -0
  110. data/lib/spider-src/support/spider/src/ast/expressions/CurryCallExpression.spider +109 -0
  111. data/lib/spider-src/support/spider/src/ast/expressions/ExistentialExpression.spider +102 -0
  112. data/lib/spider-src/support/spider/src/ast/expressions/ForInExpression.spider +140 -0
  113. data/lib/spider-src/support/spider/src/ast/expressions/FunctionExpression.spider +183 -0
  114. data/lib/spider-src/support/spider/src/ast/expressions/InExpression.spider +114 -0
  115. data/lib/spider-src/support/spider/src/ast/expressions/LogicalExpression.spider +62 -0
  116. data/lib/spider-src/support/spider/src/ast/expressions/MemberExpression.spider +57 -0
  117. data/lib/spider-src/support/spider/src/ast/expressions/NewExpression.spider +40 -0
  118. data/lib/spider-src/support/spider/src/ast/expressions/NullCheckCallExpression.spider +151 -0
  119. data/lib/spider-src/support/spider/src/ast/expressions/NullCoalescingExpression.spider +151 -0
  120. data/lib/spider-src/support/spider/src/ast/expressions/NullPropagatingExpression.spider +190 -0
  121. data/lib/spider-src/support/spider/src/ast/expressions/ObjectExpression.spider +30 -0
  122. data/lib/spider-src/support/spider/src/ast/expressions/ObjectPattern.spider +42 -0
  123. data/lib/spider-src/support/spider/src/ast/expressions/RangeMemberExpression.spider +179 -0
  124. data/lib/spider-src/support/spider/src/ast/expressions/SplatExpression.spider +49 -0
  125. data/lib/spider-src/support/spider/src/ast/expressions/SuperExpression.spider +235 -0
  126. data/lib/spider-src/support/spider/src/ast/expressions/ThisExpression.spider +21 -0
  127. data/lib/spider-src/support/spider/src/ast/expressions/UnaryExpression.spider +158 -0
  128. data/lib/spider-src/support/spider/src/ast/expressions/UpdateExpression.spider +28 -0
  129. data/lib/spider-src/support/spider/src/ast/literals/BooleanLiteral.spider +23 -0
  130. data/lib/spider-src/support/spider/src/ast/literals/Identifier.spider +68 -0
  131. data/lib/spider-src/support/spider/src/ast/literals/NullLiteral.spider +23 -0
  132. data/lib/spider-src/support/spider/src/ast/literals/NumberLiteral.spider +23 -0
  133. data/lib/spider-src/support/spider/src/ast/literals/RegularExpressionLiteral.spider +24 -0
  134. data/lib/spider-src/support/spider/src/ast/literals/StringLiteral.spider +91 -0
  135. data/lib/spider-src/support/spider/src/ast/literals/UndefinedLiteral.spider +30 -0
  136. data/lib/spider-src/support/spider/src/ast/statements/BlockStatement.spider +45 -0
  137. data/lib/spider-src/support/spider/src/ast/statements/BreakStatement.spider +19 -0
  138. data/lib/spider-src/support/spider/src/ast/statements/ContinueStatement.spider +19 -0
  139. data/lib/spider-src/support/spider/src/ast/statements/DebuggerStatement.spider +19 -0
  140. data/lib/spider-src/support/spider/src/ast/statements/DoWhileStatement.spider +28 -0
  141. data/lib/spider-src/support/spider/src/ast/statements/ExportDeclarationStatement.spider +46 -0
  142. data/lib/spider-src/support/spider/src/ast/statements/ExpressionStatement.spider +22 -0
  143. data/lib/spider-src/support/spider/src/ast/statements/FallthroughStatement.spider +85 -0
  144. data/lib/spider-src/support/spider/src/ast/statements/ForInStatement.spider +92 -0
  145. data/lib/spider-src/support/spider/src/ast/statements/ForOfStatement.spider +117 -0
  146. data/lib/spider-src/support/spider/src/ast/statements/ForStatement.spider +51 -0
  147. data/lib/spider-src/support/spider/src/ast/statements/FunctionDeclarationStatement.spider +115 -0
  148. data/lib/spider-src/support/spider/src/ast/statements/GoStatement.spider +44 -0
  149. data/lib/spider-src/support/spider/src/ast/statements/IfStatement.spider +38 -0
  150. data/lib/spider-src/support/spider/src/ast/statements/ImportDeclarationStatement.spider +33 -0
  151. data/lib/spider-src/support/spider/src/ast/statements/PushStatement.spider +40 -0
  152. data/lib/spider-src/support/spider/src/ast/statements/ReturnStatement.spider +28 -0
  153. data/lib/spider-src/support/spider/src/ast/statements/SwitchStatement.spider +161 -0
  154. data/lib/spider-src/support/spider/src/ast/statements/ThrowStatement.spider +23 -0
  155. data/lib/spider-src/support/spider/src/ast/statements/TryStatement.spider +42 -0
  156. data/lib/spider-src/support/spider/src/ast/statements/UntilStatement.spider +36 -0
  157. data/lib/spider-src/support/spider/src/ast/statements/UseStatement.spider +62 -0
  158. data/lib/spider-src/support/spider/src/ast/statements/VariableDeclarationStatement.spider +34 -0
  159. data/lib/spider-src/support/spider/src/ast/statements/WhileStatement.spider +28 -0
  160. data/lib/spider-src/support/spider/src/ast.spider +80 -0
  161. data/lib/spider-src/support/spider/src/spider.pegjs +1434 -0
  162. data/lib/spider-src/support/spider/src/spider.spider +276 -0
  163. data/lib/spider-src/support/spider/test/spider_test.js +1787 -0
  164. data/lib/spider-src/version.rb +5 -0
  165. data/lib/spider-src.rb +37 -0
  166. data/spider-src.gemspec +24 -0
  167. data/test/test_spider_src.rb +33 -0
  168. metadata +225 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 381583024bec0108a2d637b843b26c112645bab3
4
+ data.tar.gz: 97c9e170b1e8adfbacf82e027bb9004be5911844
5
+ SHA512:
6
+ metadata.gz: 906e13875fdfbfb4b3a0928422b116fe7f09e5c25f503b7ed9c5dc9ce497d875ddfb7b2cff977153cdf38d3b83e8d800ad0120b54b37ef7c7af0173e0fb76a97
7
+ data.tar.gz: 951da77af49560d9fee19b91d36a190e65b09dfd6daf062a3bdd8d48151626d37db8e12c77e709f9889100a53d8cfc7020e0d1842701eacb3552d88a8d0fed6a
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.DS_Store
2
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :test do
6
+ gem 'test-unit', '~> 3.0.0'
7
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,74 @@
1
+ Copyright (c) 2014 Alin Iacob
2
+
3
+ Artistic License 2.0
4
+
5
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
6
+ Preamble
7
+
8
+ This license establishes the terms under which a given free software Package may be copied, modified, distributed, and/or redistributed. The intent is that the Copyright Holder maintains some artistic control over the development of that Package while still keeping the Package available as open source and free software.
9
+
10
+ You are always permitted to make arrangements wholly outside of this license directly with the Copyright Holder of a given Package. If the terms of this license do not permit the full use that you propose to make of the Package, you should contact the Copyright Holder and seek a different licensing arrangement.
11
+ Definitions
12
+
13
+ "Copyright Holder" means the individual(s) or organization(s) named in the copyright notice for the entire Package.
14
+
15
+ "Contributor" means any party that has contributed code or other material to the Package, in accordance with the Copyright Holder's procedures.
16
+
17
+ "You" and "your" means any person who would like to copy, distribute, or modify the Package.
18
+
19
+ "Package" means the collection of files distributed by the Copyright Holder, and derivatives of that collection and/or of those files. A given Package may consist of either the Standard Version, or a Modified Version.
20
+
21
+ "Distribute" means providing a copy of the Package or making it accessible to anyone else, or in the case of a company or organization, to others outside of your company or organization.
22
+
23
+ "Distributor Fee" means any fee that you charge for Distributing this Package or providing support for this Package to another party. It does not mean licensing fees.
24
+
25
+ "Standard Version" refers to the Package if it has not been modified, or has been modified only in ways explicitly requested by the Copyright Holder.
26
+
27
+ "Modified Version" means the Package, if it has been changed, and such changes were not explicitly requested by the Copyright Holder.
28
+
29
+ "Original License" means this Artistic License as Distributed with the Standard Version of the Package, in its current version or as it may be modified by The Perl Foundation in the future.
30
+
31
+ "Source" form means the source code, documentation source, and configuration files for the Package.
32
+
33
+ "Compiled" form means the compiled bytecode, object code, binary, or any other form resulting from mechanical transformation or translation of the Source form.
34
+ Permission for Use and Modification Without Distribution
35
+
36
+ (1) You are permitted to use the Standard Version and create and use Modified Versions for any purpose without restriction, provided that you do not Distribute the Modified Version.
37
+ Permissions for Redistribution of the Standard Version
38
+
39
+ (2) You may Distribute verbatim copies of the Source form of the Standard Version of this Package in any medium without restriction, either gratis or for a Distributor Fee, provided that you duplicate all of the original copyright notices and associated disclaimers. At your discretion, such verbatim copies may or may not include a Compiled form of the Package.
40
+
41
+ (3) You may apply any bug fixes, portability changes, and other modifications made available from the Copyright Holder. The resulting Package will still be considered the Standard Version, and as such will be subject to the Original License.
42
+ Distribution of Modified Versions of the Package as Source
43
+
44
+ (4) You may Distribute your Modified Version as Source (either gratis or for a Distributor Fee, and with or without a Compiled form of the Modified Version) provided that you clearly document how it differs from the Standard Version, including, but not limited to, documenting any non-standard features, executables, or modules, and provided that you do at least ONE of the following:
45
+
46
+ (a) make the Modified Version available to the Copyright Holder of the Standard Version, under the Original License, so that the Copyright Holder may include your modifications in the Standard Version.
47
+ (b) ensure that installation of your Modified Version does not prevent the user installing or running the Standard Version. In addition, the Modified Version must bear a name that is different from the name of the Standard Version.
48
+ (c) allow anyone who receives a copy of the Modified Version to make the Source form of the Modified Version available to others under
49
+ (i) the Original License or
50
+ (ii) a license that permits the licensee to freely copy, modify and redistribute the Modified Version using the same licensing terms that apply to the copy that the licensee received, and requires that the Source form of the Modified Version, and of any works derived from it, be made freely available in that license fees are prohibited but Distributor Fees are allowed.
51
+ Distribution of Compiled Forms of the Standard Version or Modified Versions without the Source
52
+
53
+ (5) You may Distribute Compiled forms of the Standard Version without the Source, provided that you include complete instructions on how to get the Source of the Standard Version. Such instructions must be valid at the time of your distribution. If these instructions, at any time while you are carrying out such distribution, become invalid, you must provide new instructions on demand or cease further distribution. If you provide valid instructions or cease distribution within thirty days after you become aware that the instructions are invalid, then you do not forfeit any of your rights under this license.
54
+
55
+ (6) You may Distribute a Modified Version in Compiled form without the Source, provided that you comply with Section 4 with respect to the Source of the Modified Version.
56
+ Aggregating or Linking the Package
57
+
58
+ (7) You may aggregate the Package (either the Standard Version or Modified Version) with other packages and Distribute the resulting aggregation provided that you do not charge a licensing fee for the Package. Distributor Fees are permitted, and licensing fees for other components in the aggregation are permitted. The terms of this license apply to the use and Distribution of the Standard or Modified Versions as included in the aggregation.
59
+
60
+ (8) You are permitted to link Modified and Standard Versions with other works, to embed the Package in a larger work of your own, or to build stand-alone binary or bytecode versions of applications that include the Package, and Distribute the result without restriction, provided the result does not expose a direct interface to the Package.
61
+ Items That are Not Considered Part of a Modified Version
62
+
63
+ (9) Works (including, but not limited to, modules and scripts) that merely extend or make use of the Package, do not, by themselves, cause the Package to be a Modified Version. In addition, such works are not considered parts of the Package itself, and are not subject to the terms of this license.
64
+ General Provisions
65
+
66
+ (10) Any use, modification, and distribution of the Standard or Modified Versions is governed by this Artistic License. By using, modifying or distributing the Package, you accept this license. Do not use, modify, or distribute the Package, if you do not accept this license.
67
+
68
+ (11) If your Modified Version has been derived from a Modified Version made by someone other than you, you are nevertheless required to ensure that your Modified Version complies with the requirements of this license.
69
+
70
+ (12) This license does not grant you the right to use any trademark, service mark, tradename, or logo of the Copyright Holder.
71
+
72
+ (13) This license includes the non-exclusive, worldwide, free-of-charge patent license to make, have made, use, offer to sell, sell, import and otherwise transfer the Package with respect to any patent claims licensable by the Copyright Holder that are necessarily infringed by the Package. If you institute patent litigation (including a cross-claim or counterclaim) against any party alleging that the Package constitutes direct or contributory patent infringement, then this Artistic License to you shall terminate on the date that such litigation is filed.
73
+
74
+ (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Spider::Src
2
+
3
+ Spider source files in a gem.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'spider-src'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install spider-src
20
+
21
+ ## Usage
22
+
23
+
24
+ ```ruby
25
+ require 'spider-src'
26
+
27
+ p Spider::Src.js_path # => #<Pathname:/path/to/cli.js>
28
+ p Spider::Src.version # => "0.0.1"
29
+ ```
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/alinbsp/spider-src/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+ require 'rake/testtask'
4
+
5
+ desc 'download the latest Spider source files'
6
+ task 'spider:download' do
7
+ sh 'npm', 'install', 'spider-script'
8
+ end
9
+
10
+
11
+ desc 'upgrade Spider source files'
12
+ task 'spider:upgrade' => %w(spider:download) do
13
+ dir = 'lib/src-src/support'
14
+ rm_rf dir
15
+ mkdir_p dir
16
+ mv 'node_modules/spider-script', "#{dir}/spider"
17
+ end
18
+
19
+ Rake::TestTask.new do |test|
20
+ test.libs << "test"
21
+ test.test_files = FileList['test/test*.rb']
22
+ test.verbose = true
23
+ end
24
+
25
+ task :default => :test
@@ -0,0 +1,17 @@
1
+ {
2
+ "env": {
3
+ "mocha": true,
4
+ "node": true
5
+ },
6
+
7
+ "rules": {
8
+ "global-strict": 0,
9
+ "quotes": 0,
10
+ "no-trailing-spaces": 0,
11
+ "eol-last": 0,
12
+ "consistent-return": 0,
13
+ "no-underscore-dangle": 0,
14
+ "yoda": 0,
15
+ "no-unused-vars": 0
16
+ }
17
+ }
@@ -0,0 +1,9 @@
1
+ test.js
2
+ test.js.map
3
+ test.spider
4
+ src/
5
+ test/
6
+ coverage/
7
+ .git*
8
+ *.map
9
+ npm-debug.log
@@ -0,0 +1,7 @@
1
+ language: node_js
2
+ node_js:
3
+ - '0.10'
4
+ before_script:
5
+ - npm install -g grunt-cli istanbul spider-script
6
+ after_success:
7
+ - istanbul cover -x lib/parser.js ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage
@@ -0,0 +1,3 @@
1
+ {
2
+ "generator-node": {}
3
+ }
@@ -0,0 +1,64 @@
1
+ ### Changelog
2
+
3
+ 2014 11 29 - **v0.1.3-alpha**
4
+
5
+ * Separate a lot of CLI logic to lib/spider
6
+ * Default behaviour for CLI
7
+ * Refactor `spider.compile` API
8
+ * Fix source map path bug with ES5 target
9
+ * Fix "System is not defined" error when using Spider API
10
+
11
+ 2014 11 29 - **v0.1.2-alpha**
12
+
13
+ * CLI bug fixes
14
+
15
+ 2014 11 27 - **v0.1.1-alpha**
16
+
17
+ * [Async/Await](http://spiderlang.org/#async)
18
+ * [Channels](http://spiderlang.org/#channels)
19
+ * Add undefined keyword
20
+ * Fix an undefined bug with destructing patterns
21
+ * Fix CLI execute and remove dependency on vm2
22
+
23
+ 2014 11 26 - **v0.1.0-alpha**
24
+
25
+ * Add a `--target=ES5|ES6` flag (ES5 target uses [Traceur Compiler](https://github.com/google/traceur-compiler))
26
+ * Change `func` keyword to `fn`
27
+ * [ES6 Import/Export support](http://spiderlang.org/#modules)
28
+ * [Curried Functions](http://spiderlang.org/#functions-curried-functions)
29
+ * [Destructring Assignments](http://spiderlang.org/#destructuring)
30
+ * [Object Initializer Shorthand](http://spiderlang.org/#shorthand-property-names)
31
+ * [Property Method Assignments](http://spiderlang.org/#shorthand-method-names)
32
+ * [Multi-line Strings](http://spiderlang.org/#strings-multi-line-strings)
33
+ * [Pattern Matching](http://spiderlang.org/#switch-pattern-matching)
34
+ * [Do-While Loop](http://spiderlang.org/#do-while-statement)
35
+ * Delete Statement
36
+ * Add JavaScript core global identifiers to defined identifiers
37
+ * Add `__dirname` and `__filename` to `use :node`
38
+ * Remove ES6 polyfills (Traceur is now responsible for that)
39
+ * Fix CLI execute script
40
+ * Fix source maps for function expressions
41
+
42
+ 2014 11 22 - **v0.0.7-alpha**
43
+
44
+ * Fat Arrow (`=>`) Function Expressions
45
+ * `not` keyword
46
+ * Fix `break` and `return` statements inside `for-in` and `for-of` statements
47
+ * Disable source map generation option in CLI
48
+ * Fix CLI execute script
49
+ * Comma is now optional between switch case clauses
50
+ * Regular Expression Literals
51
+
52
+ 2014 11 20 - **v0.0.6-alpha**
53
+
54
+ * Fallthrough Statement
55
+ * Fix line endings
56
+
57
+ 2014 11 20 - **v0.0.5-alpha**
58
+
59
+ * Spider is now [self-hosted](http://en.wikipedia.org/wiki/Self-hosting)
60
+ * Parenthesis in `while` and `until` statements are now optional
61
+ * Massive parsing performance improvements
62
+ * Fix "use strict" in compiled JS
63
+ * Add `setTimeout` to `use :node` and `use :browser`
64
+ * Optimize `!!!` to `!` in compiled JS
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ (function () {
3
+ module.exports = function (grunt) {
4
+ require("traceur");
5
+ require("time-grunt")(grunt);
6
+ require("load-grunt-tasks")(grunt);
7
+ grunt.initConfig({
8
+ nodeunit: { files: ["test/**/*_test.js"] },
9
+ eslint: {
10
+ lib: [
11
+ "lib/**/*.js",
12
+ "!lib/parser.js"
13
+ ],
14
+ test: ["test/**/*.js"]
15
+ },
16
+ mochacli: {
17
+ options: {
18
+ reporter: "spec",
19
+ bail: true,
20
+ timeout: 15000
21
+ },
22
+ all: ["test/*.js"]
23
+ },
24
+ watch: {
25
+ gruntfile: {
26
+ files: "<%= jshint.gruntfile.src %>",
27
+ tasks: ["jshint:gruntfile"]
28
+ },
29
+ lib: {
30
+ files: "<%= jshint.lib.src %>",
31
+ tasks: [
32
+ "jshint:lib",
33
+ "mochacli"
34
+ ]
35
+ },
36
+ test: {
37
+ files: "<%= jshint.test.src %>",
38
+ tasks: [
39
+ "jshint:test",
40
+ "mochacli"
41
+ ]
42
+ }
43
+ },
44
+ peg: {
45
+ spider: {
46
+ src: "src/spider.pegjs",
47
+ dest: "lib/parser.js"
48
+ }
49
+ },
50
+ mocha_istanbul: {
51
+ coverage: {
52
+ src: "test",
53
+ options: {
54
+ mask: "*.js",
55
+ excludes: ["lib/parser.js"]
56
+ }
57
+ }
58
+ },
59
+ clean: { build: ["lib/"] },
60
+ spider_script: {
61
+ options: {},
62
+ build: {
63
+ files: [{
64
+ expand: true,
65
+ cwd: "src",
66
+ src: ["**/*.spider"],
67
+ dest: "lib/",
68
+ ext: ".js"
69
+ }]
70
+ }
71
+ },
72
+ copy: {
73
+ build: {
74
+ files: [{
75
+ expand: true,
76
+ cwd: "src",
77
+ src: ["**/*.js"],
78
+ dest: "lib/"
79
+ }]
80
+ }
81
+ }
82
+ });
83
+ grunt.registerTask("default", [
84
+ "build",
85
+ "mochacli"
86
+ ]);
87
+ grunt.registerTask("build", [
88
+ "clean:build",
89
+ "peg",
90
+ "spider_script:build",
91
+ "copy:build"
92
+ ]);
93
+ grunt.registerTask("coverage", ["mocha_istanbul:coverage"]);
94
+ };
95
+ }());
96
+
97
+ //# sourceMappingURL=Gruntfile.map
@@ -0,0 +1,93 @@
1
+ use :node;
2
+
3
+ module.exports = fn (grunt) {
4
+ require('traceur');
5
+
6
+ // Show elapsed time at the end
7
+ require('time-grunt')(grunt);
8
+ // Load all grunt tasks
9
+ require('load-grunt-tasks')(grunt);
10
+
11
+ // Project configuration.
12
+ grunt.initConfig({
13
+ nodeunit: {
14
+ files: ['test/**/*_test.js']
15
+ },
16
+ eslint: {
17
+ lib: [
18
+ 'lib/**/*.js',
19
+ '!lib/parser.js'
20
+ ],
21
+ test: [
22
+ 'test/**/*.js'
23
+ ]
24
+ },
25
+ mochacli: {
26
+ options: {
27
+ reporter: 'spec',
28
+ bail: true,
29
+ timeout: 15000
30
+ },
31
+ all: ['test/*.js']
32
+ },
33
+ watch: {
34
+ gruntfile: {
35
+ files: '<%= jshint.gruntfile.src %>',
36
+ tasks: ['jshint:gruntfile']
37
+ },
38
+ lib: {
39
+ files: '<%= jshint.lib.src %>',
40
+ tasks: ['jshint:lib', 'mochacli']
41
+ },
42
+ test: {
43
+ files: '<%= jshint.test.src %>',
44
+ tasks: ['jshint:test', 'mochacli']
45
+ }
46
+ },
47
+ peg: {
48
+ spider: {
49
+ src: "src/spider.pegjs",
50
+ dest: "lib/parser.js"
51
+ }
52
+ },
53
+ mocha_istanbul: {
54
+ coverage: {
55
+ src: 'test',
56
+ options: {
57
+ mask: '*.js',
58
+ excludes: ['lib/parser.js']
59
+ },
60
+ }
61
+ },
62
+ clean: {
63
+ build: ["lib/"],
64
+ },
65
+ spider_script: {
66
+ options: {},
67
+ build: {
68
+ files: [{
69
+ expand: true,
70
+ cwd: 'src',
71
+ src: ['**/*.spider'],
72
+ dest: 'lib/',
73
+ ext: '.js'
74
+ }]
75
+ }
76
+ },
77
+ copy: {
78
+ build: {
79
+ files: [{
80
+ expand: true,
81
+ cwd: 'src',
82
+ src: ['**/*.js'],
83
+ dest: 'lib/',
84
+ }]
85
+ }
86
+ }
87
+ });
88
+
89
+ // Default task.
90
+ grunt.registerTask('default', ['build', 'mochacli']);
91
+ grunt.registerTask('build', ['clean:build', 'peg', 'spider_script:build', 'copy:build']);
92
+ grunt.registerTask('coverage', ['mocha_istanbul:coverage']);
93
+ };
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "{}"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright {yyyy} {name of copyright owner}
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.