laser 0.7.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (319) hide show
  1. data/.document +5 -0
  2. data/.rspec +1 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +661 -0
  5. data/README.md +158 -0
  6. data/Rakefile +104 -0
  7. data/VERSION +1 -0
  8. data/bin/laser +7 -0
  9. data/design_docs/goals.md +57 -0
  10. data/design_docs/object_regex.md +426 -0
  11. data/design_docs/type_annotations.md +80 -0
  12. data/ext/laser/BasicBlock.cpp +572 -0
  13. data/ext/laser/BasicBlock.h +118 -0
  14. data/ext/laser/extconf.rb +3 -0
  15. data/features/laser.feature +25 -0
  16. data/features/step_definitions/laser_steps.rb +39 -0
  17. data/features/support/env.rb +14 -0
  18. data/features/support/testdata/1_input +1 -0
  19. data/features/support/testdata/1_output +1 -0
  20. data/features/support/testdata/2_input +4 -0
  21. data/features/support/testdata/2_output +4 -0
  22. data/features/support/testdata/3_input +8 -0
  23. data/features/support/testdata/3_output +11 -0
  24. data/features/support/testdata/4_input +5 -0
  25. data/features/support/testdata/4_output +5 -0
  26. data/features/support/testdata/5_input +13 -0
  27. data/laser.gemspec +382 -0
  28. data/lib/laser.rb +98 -0
  29. data/lib/laser/analysis/annotations.rb +95 -0
  30. data/lib/laser/analysis/annotations/annotation_config.yaml +3 -0
  31. data/lib/laser/analysis/annotations/comment_attachment_annotation.rb +66 -0
  32. data/lib/laser/analysis/annotations/node_pointers_annotation.rb +36 -0
  33. data/lib/laser/analysis/annotations/runtime_annotation.rb +55 -0
  34. data/lib/laser/analysis/argument_expansion.rb +132 -0
  35. data/lib/laser/analysis/arity.rb +34 -0
  36. data/lib/laser/analysis/bindings.rb +144 -0
  37. data/lib/laser/analysis/bootstrap/bootstrap.rb +298 -0
  38. data/lib/laser/analysis/bootstrap/laser_class.rb +106 -0
  39. data/lib/laser/analysis/bootstrap/laser_method.rb +255 -0
  40. data/lib/laser/analysis/bootstrap/laser_module.rb +403 -0
  41. data/lib/laser/analysis/bootstrap/laser_module_copy.rb +74 -0
  42. data/lib/laser/analysis/bootstrap/laser_object.rb +69 -0
  43. data/lib/laser/analysis/bootstrap/laser_proc.rb +150 -0
  44. data/lib/laser/analysis/bootstrap/laser_singleton_class.rb +44 -0
  45. data/lib/laser/analysis/comments.rb +35 -0
  46. data/lib/laser/analysis/control_flow.rb +28 -0
  47. data/lib/laser/analysis/control_flow/alias_analysis.rb +31 -0
  48. data/lib/laser/analysis/control_flow/basic_block.rb +105 -0
  49. data/lib/laser/analysis/control_flow/cfg_builder.rb +2505 -0
  50. data/lib/laser/analysis/control_flow/cfg_instruction.rb +190 -0
  51. data/lib/laser/analysis/control_flow/constant_propagation.rb +742 -0
  52. data/lib/laser/analysis/control_flow/control_flow_graph.rb +370 -0
  53. data/lib/laser/analysis/control_flow/lifetime_analysis.rb +91 -0
  54. data/lib/laser/analysis/control_flow/method_call_search.rb +26 -0
  55. data/lib/laser/analysis/control_flow/raise_properties.rb +25 -0
  56. data/lib/laser/analysis/control_flow/simulation.rb +385 -0
  57. data/lib/laser/analysis/control_flow/static_single_assignment.rb +185 -0
  58. data/lib/laser/analysis/control_flow/unreachability_analysis.rb +57 -0
  59. data/lib/laser/analysis/control_flow/unused_variables.rb +91 -0
  60. data/lib/laser/analysis/control_flow/yield_properties.rb +103 -0
  61. data/lib/laser/analysis/errors.rb +131 -0
  62. data/lib/laser/analysis/laser_utils.rb +18 -0
  63. data/lib/laser/analysis/lexical_analysis.rb +172 -0
  64. data/lib/laser/analysis/method_call.rb +68 -0
  65. data/lib/laser/analysis/protocol_registry.rb +30 -0
  66. data/lib/laser/analysis/scope.rb +118 -0
  67. data/lib/laser/analysis/sexp.rb +159 -0
  68. data/lib/laser/analysis/sexp_analysis.rb +40 -0
  69. data/lib/laser/analysis/sexp_extensions/constant_extraction.rb +115 -0
  70. data/lib/laser/analysis/sexp_extensions/source_location.rb +164 -0
  71. data/lib/laser/analysis/sexp_extensions/type_inference.rb +47 -0
  72. data/lib/laser/analysis/signature.rb +76 -0
  73. data/lib/laser/analysis/special_methods/send.rb +67 -0
  74. data/lib/laser/analysis/unused_methods.rb +21 -0
  75. data/lib/laser/analysis/visitor.rb +141 -0
  76. data/lib/laser/annotation_parser/annotations.treetop +126 -0
  77. data/lib/laser/annotation_parser/annotations_parser.rb +748 -0
  78. data/lib/laser/annotation_parser/class_annotations.treetop +82 -0
  79. data/lib/laser/annotation_parser/class_annotations_parser.rb +654 -0
  80. data/lib/laser/annotation_parser/overload.treetop +24 -0
  81. data/lib/laser/annotation_parser/overload_parser.rb +167 -0
  82. data/lib/laser/annotation_parser/parsers.rb +6 -0
  83. data/lib/laser/annotation_parser/structural.treetop +37 -0
  84. data/lib/laser/annotation_parser/structural_parser.rb +406 -0
  85. data/lib/laser/annotation_parser/useful_parsers.treetop +47 -0
  86. data/lib/laser/annotation_parser/useful_parsers_parser.rb +674 -0
  87. data/lib/laser/rake/task.rb +46 -0
  88. data/lib/laser/runner.rb +189 -0
  89. data/lib/laser/scanner.rb +169 -0
  90. data/lib/laser/standard_library/_thread.rb +110 -0
  91. data/lib/laser/standard_library/abbrev.rb +103 -0
  92. data/lib/laser/standard_library/array.rb +418 -0
  93. data/lib/laser/standard_library/base64.rb +91 -0
  94. data/lib/laser/standard_library/basic_object.rb +55 -0
  95. data/lib/laser/standard_library/benchmark.rb +556 -0
  96. data/lib/laser/standard_library/bignum.rb +185 -0
  97. data/lib/laser/standard_library/cgi.rb +275 -0
  98. data/lib/laser/standard_library/cgi/cookie.rb +147 -0
  99. data/lib/laser/standard_library/cgi/core.rb +791 -0
  100. data/lib/laser/standard_library/cgi/html.rb +1021 -0
  101. data/lib/laser/standard_library/cgi/session.rb +537 -0
  102. data/lib/laser/standard_library/cgi/session/pstore.rb +111 -0
  103. data/lib/laser/standard_library/cgi/util.rb +188 -0
  104. data/lib/laser/standard_library/class_definitions.rb +333 -0
  105. data/lib/laser/standard_library/comparable.rb +125 -0
  106. data/lib/laser/standard_library/complex.rb +162 -0
  107. data/lib/laser/standard_library/enumerable.rb +178 -0
  108. data/lib/laser/standard_library/exceptions.rb +135 -0
  109. data/lib/laser/standard_library/fixnum.rb +188 -0
  110. data/lib/laser/standard_library/float.rb +180 -0
  111. data/lib/laser/standard_library/hash.rb +237 -0
  112. data/lib/laser/standard_library/integer.rb +123 -0
  113. data/lib/laser/standard_library/laser_magic.rb +7 -0
  114. data/lib/laser/standard_library/nil_false_true.rb +113 -0
  115. data/lib/laser/standard_library/numbers.rb +192 -0
  116. data/lib/laser/standard_library/proc.rb +31 -0
  117. data/lib/laser/standard_library/set.rb +1348 -0
  118. data/lib/laser/standard_library/string.rb +666 -0
  119. data/lib/laser/standard_library/stringio.rb +2 -0
  120. data/lib/laser/standard_library/symbol.rb +125 -0
  121. data/lib/laser/standard_library/tsort.rb +242 -0
  122. data/lib/laser/support/acts_as_struct.rb +66 -0
  123. data/lib/laser/support/frequency.rb +55 -0
  124. data/lib/laser/support/inheritable_attributes.rb +145 -0
  125. data/lib/laser/support/module_extensions.rb +94 -0
  126. data/lib/laser/support/placeholder_object.rb +13 -0
  127. data/lib/laser/third_party/rgl/adjacency.rb +221 -0
  128. data/lib/laser/third_party/rgl/base.rb +228 -0
  129. data/lib/laser/third_party/rgl/bidirectional.rb +39 -0
  130. data/lib/laser/third_party/rgl/condensation.rb +47 -0
  131. data/lib/laser/third_party/rgl/connected_components.rb +138 -0
  132. data/lib/laser/third_party/rgl/control_flow.rb +170 -0
  133. data/lib/laser/third_party/rgl/depth_first_spanning_tree.rb +37 -0
  134. data/lib/laser/third_party/rgl/dominators.rb +124 -0
  135. data/lib/laser/third_party/rgl/dot.rb +93 -0
  136. data/lib/laser/third_party/rgl/graphxml.rb +51 -0
  137. data/lib/laser/third_party/rgl/implicit.rb +174 -0
  138. data/lib/laser/third_party/rgl/mutable.rb +117 -0
  139. data/lib/laser/third_party/rgl/rdot.rb +445 -0
  140. data/lib/laser/third_party/rgl/topsort.rb +72 -0
  141. data/lib/laser/third_party/rgl/transitivity.rb +180 -0
  142. data/lib/laser/third_party/rgl/traversal.rb +348 -0
  143. data/lib/laser/types/types.rb +433 -0
  144. data/lib/laser/version.rb +14 -0
  145. data/lib/laser/warning.rb +149 -0
  146. data/lib/laser/warning_sets/default.yml +13 -0
  147. data/lib/laser/warnings/assignment_in_condition.rb +20 -0
  148. data/lib/laser/warnings/comment_spacing.rb +31 -0
  149. data/lib/laser/warnings/extra_blank_lines.rb +30 -0
  150. data/lib/laser/warnings/extra_whitespace.rb +16 -0
  151. data/lib/laser/warnings/hash_symbol_18_warning.rb +63 -0
  152. data/lib/laser/warnings/hash_symbol_19_warning.rb +29 -0
  153. data/lib/laser/warnings/line_length.rb +115 -0
  154. data/lib/laser/warnings/misaligned_unindentation.rb +17 -0
  155. data/lib/laser/warnings/operator_spacing.rb +68 -0
  156. data/lib/laser/warnings/parens_on_declaration.rb +30 -0
  157. data/lib/laser/warnings/rescue_exception.rb +42 -0
  158. data/lib/laser/warnings/semicolon.rb +25 -0
  159. data/lib/laser/warnings/sexp_errors.rb +24 -0
  160. data/lib/laser/warnings/uncalled_method_warning.rb +7 -0
  161. data/lib/laser/warnings/useless_double_quotes.rb +38 -0
  162. data/spec/analysis_specs/annotations_spec.rb +47 -0
  163. data/spec/analysis_specs/annotations_specs/comment_attachment_spec.rb +68 -0
  164. data/spec/analysis_specs/annotations_specs/node_pointers_annotation_spec.rb +90 -0
  165. data/spec/analysis_specs/annotations_specs/runtime_annotation_spec.rb +135 -0
  166. data/spec/analysis_specs/annotations_specs/spec_helper.rb +33 -0
  167. data/spec/analysis_specs/argument_expansion_spec.rb +113 -0
  168. data/spec/analysis_specs/bindings_spec.rb +36 -0
  169. data/spec/analysis_specs/comment_spec.rb +93 -0
  170. data/spec/analysis_specs/control_flow_specs/cfg_instruction_spec.rb +111 -0
  171. data/spec/analysis_specs/control_flow_specs/constant_propagation_spec.rb +560 -0
  172. data/spec/analysis_specs/control_flow_specs/control_flow_graph_spec.rb +5 -0
  173. data/spec/analysis_specs/control_flow_specs/raise_properties_spec.rb +310 -0
  174. data/spec/analysis_specs/control_flow_specs/raise_type_inference_spec.rb +301 -0
  175. data/spec/analysis_specs/control_flow_specs/return_type_inference_spec.rb +431 -0
  176. data/spec/analysis_specs/control_flow_specs/simulation_spec.rb +158 -0
  177. data/spec/analysis_specs/control_flow_specs/spec_helper.rb +110 -0
  178. data/spec/analysis_specs/control_flow_specs/tuple_misuse_inference_spec.rb +125 -0
  179. data/spec/analysis_specs/control_flow_specs/unreachability_analysis_spec.rb +76 -0
  180. data/spec/analysis_specs/control_flow_specs/unused_variable_spec.rb +99 -0
  181. data/spec/analysis_specs/control_flow_specs/yield_properties_spec.rb +372 -0
  182. data/spec/analysis_specs/error_spec.rb +30 -0
  183. data/spec/analysis_specs/laser_class_spec.rb +322 -0
  184. data/spec/analysis_specs/lexical_analysis_spec.rb +184 -0
  185. data/spec/analysis_specs/protocol_registry_spec.rb +63 -0
  186. data/spec/analysis_specs/scope_annotation_spec.rb +1013 -0
  187. data/spec/analysis_specs/scope_spec.rb +126 -0
  188. data/spec/analysis_specs/sexp_analysis_spec.rb +30 -0
  189. data/spec/analysis_specs/sexp_extension_specs/constant_extraction_spec.rb +309 -0
  190. data/spec/analysis_specs/sexp_extension_specs/source_location_spec.rb +231 -0
  191. data/spec/analysis_specs/sexp_extension_specs/spec_helper.rb +1 -0
  192. data/spec/analysis_specs/sexp_extension_specs/type_inference_spec.rb +252 -0
  193. data/spec/analysis_specs/sexp_spec.rb +167 -0
  194. data/spec/analysis_specs/spec_helper.rb +27 -0
  195. data/spec/analysis_specs/unused_methods_spec.rb +65 -0
  196. data/spec/analysis_specs/visitor_spec.rb +64 -0
  197. data/spec/annotation_parser_specs/annotations_parser_spec.rb +89 -0
  198. data/spec/annotation_parser_specs/class_annotation_parser_spec.rb +120 -0
  199. data/spec/annotation_parser_specs/overload_parser_spec.rb +39 -0
  200. data/spec/annotation_parser_specs/parsers_spec.rb +14 -0
  201. data/spec/annotation_parser_specs/spec_helper.rb +1 -0
  202. data/spec/annotation_parser_specs/structural_parser_spec.rb +67 -0
  203. data/spec/laser_spec.rb +14 -0
  204. data/spec/rake_specs/spec_helper.rb +1 -0
  205. data/spec/rake_specs/task_spec.rb +67 -0
  206. data/spec/runner_spec.rb +207 -0
  207. data/spec/scanner_spec.rb +75 -0
  208. data/spec/spec_helper.rb +121 -0
  209. data/spec/standard_library/exceptions_spec.rb +19 -0
  210. data/spec/standard_library/globals_spec.rb +14 -0
  211. data/spec/standard_library/set_spec.rb +31 -0
  212. data/spec/standard_library/spec_helper.rb +1 -0
  213. data/spec/standard_library/standard_library_spec.rb +302 -0
  214. data/spec/support_specs/acts_as_struct_spec.rb +94 -0
  215. data/spec/support_specs/frequency_spec.rb +23 -0
  216. data/spec/support_specs/module_extensions_spec.rb +117 -0
  217. data/spec/support_specs/spec_helper.rb +1 -0
  218. data/spec/type_specs/spec_helper.rb +1 -0
  219. data/spec/type_specs/types_spec.rb +133 -0
  220. data/spec/warning_spec.rb +95 -0
  221. data/spec/warning_specs/assignment_in_condition_spec.rb +68 -0
  222. data/spec/warning_specs/comment_spacing_spec.rb +65 -0
  223. data/spec/warning_specs/extra_blank_lines_spec.rb +70 -0
  224. data/spec/warning_specs/extra_whitespace_spec.rb +33 -0
  225. data/spec/warning_specs/hash_symbol_18_warning_spec.rb +89 -0
  226. data/spec/warning_specs/hash_symbol_19_warning_spec.rb +63 -0
  227. data/spec/warning_specs/line_length_spec.rb +173 -0
  228. data/spec/warning_specs/misaligned_unindentation_spec.rb +35 -0
  229. data/spec/warning_specs/operator_spacing_spec.rb +104 -0
  230. data/spec/warning_specs/parens_on_declaration_spec.rb +57 -0
  231. data/spec/warning_specs/rescue_exception_spec.rb +105 -0
  232. data/spec/warning_specs/semicolon_spec.rb +58 -0
  233. data/spec/warning_specs/spec_helper.rb +1 -0
  234. data/spec/warning_specs/useless_double_quotes_spec.rb +74 -0
  235. data/status_reports/2010/12/2010-12-14.md +163 -0
  236. data/status_reports/2010/12/2010-12-23.md +298 -0
  237. data/status_reports/2010/12/2010-12-24.md +6 -0
  238. data/test/third_party_tests/rgl_tests/TestComponents.rb +65 -0
  239. data/test/third_party_tests/rgl_tests/TestCycles.rb +61 -0
  240. data/test/third_party_tests/rgl_tests/TestDirectedGraph.rb +125 -0
  241. data/test/third_party_tests/rgl_tests/TestDot.rb +18 -0
  242. data/test/third_party_tests/rgl_tests/TestEdge.rb +34 -0
  243. data/test/third_party_tests/rgl_tests/TestGraph.rb +71 -0
  244. data/test/third_party_tests/rgl_tests/TestGraphXML.rb +57 -0
  245. data/test/third_party_tests/rgl_tests/TestImplicit.rb +52 -0
  246. data/test/third_party_tests/rgl_tests/TestRdot.rb +863 -0
  247. data/test/third_party_tests/rgl_tests/TestTransitivity.rb +129 -0
  248. data/test/third_party_tests/rgl_tests/TestTraversal.rb +220 -0
  249. data/test/third_party_tests/rgl_tests/TestUnDirectedGraph.rb +102 -0
  250. data/test/third_party_tests/rgl_tests/examples/north/Graph.log +128 -0
  251. data/test/third_party_tests/rgl_tests/examples/north/g.10.0.graphml +28 -0
  252. data/test/third_party_tests/rgl_tests/examples/north/g.10.1.graphml +28 -0
  253. data/test/third_party_tests/rgl_tests/examples/north/g.10.11.graphml +31 -0
  254. data/test/third_party_tests/rgl_tests/examples/north/g.10.12.graphml +27 -0
  255. data/test/third_party_tests/rgl_tests/examples/north/g.10.13.graphml +27 -0
  256. data/test/third_party_tests/rgl_tests/examples/north/g.10.14.graphml +27 -0
  257. data/test/third_party_tests/rgl_tests/examples/north/g.10.15.graphml +26 -0
  258. data/test/third_party_tests/rgl_tests/examples/north/g.10.16.graphml +26 -0
  259. data/test/third_party_tests/rgl_tests/examples/north/g.10.17.graphml +26 -0
  260. data/test/third_party_tests/rgl_tests/examples/north/g.10.19.graphml +37 -0
  261. data/test/third_party_tests/rgl_tests/examples/north/g.10.2.graphml +28 -0
  262. data/test/third_party_tests/rgl_tests/examples/north/g.10.20.graphml +38 -0
  263. data/test/third_party_tests/rgl_tests/examples/north/g.10.22.graphml +43 -0
  264. data/test/third_party_tests/rgl_tests/examples/north/g.10.24.graphml +30 -0
  265. data/test/third_party_tests/rgl_tests/examples/north/g.10.25.graphml +45 -0
  266. data/test/third_party_tests/rgl_tests/examples/north/g.10.27.graphml +38 -0
  267. data/test/third_party_tests/rgl_tests/examples/north/g.10.28.graphml +30 -0
  268. data/test/third_party_tests/rgl_tests/examples/north/g.10.29.graphml +38 -0
  269. data/test/third_party_tests/rgl_tests/examples/north/g.10.3.graphml +26 -0
  270. data/test/third_party_tests/rgl_tests/examples/north/g.10.30.graphml +34 -0
  271. data/test/third_party_tests/rgl_tests/examples/north/g.10.31.graphml +42 -0
  272. data/test/third_party_tests/rgl_tests/examples/north/g.10.34.graphml +42 -0
  273. data/test/third_party_tests/rgl_tests/examples/north/g.10.37.graphml +28 -0
  274. data/test/third_party_tests/rgl_tests/examples/north/g.10.38.graphml +38 -0
  275. data/test/third_party_tests/rgl_tests/examples/north/g.10.39.graphml +36 -0
  276. data/test/third_party_tests/rgl_tests/examples/north/g.10.4.graphml +26 -0
  277. data/test/third_party_tests/rgl_tests/examples/north/g.10.40.graphml +37 -0
  278. data/test/third_party_tests/rgl_tests/examples/north/g.10.41.graphml +37 -0
  279. data/test/third_party_tests/rgl_tests/examples/north/g.10.42.graphml +26 -0
  280. data/test/third_party_tests/rgl_tests/examples/north/g.10.45.graphml +28 -0
  281. data/test/third_party_tests/rgl_tests/examples/north/g.10.46.graphml +32 -0
  282. data/test/third_party_tests/rgl_tests/examples/north/g.10.5.graphml +31 -0
  283. data/test/third_party_tests/rgl_tests/examples/north/g.10.50.graphml +30 -0
  284. data/test/third_party_tests/rgl_tests/examples/north/g.10.56.graphml +29 -0
  285. data/test/third_party_tests/rgl_tests/examples/north/g.10.57.graphml +32 -0
  286. data/test/third_party_tests/rgl_tests/examples/north/g.10.58.graphml +32 -0
  287. data/test/third_party_tests/rgl_tests/examples/north/g.10.6.graphml +26 -0
  288. data/test/third_party_tests/rgl_tests/examples/north/g.10.60.graphml +32 -0
  289. data/test/third_party_tests/rgl_tests/examples/north/g.10.61.graphml +34 -0
  290. data/test/third_party_tests/rgl_tests/examples/north/g.10.62.graphml +34 -0
  291. data/test/third_party_tests/rgl_tests/examples/north/g.10.68.graphml +30 -0
  292. data/test/third_party_tests/rgl_tests/examples/north/g.10.69.graphml +32 -0
  293. data/test/third_party_tests/rgl_tests/examples/north/g.10.7.graphml +29 -0
  294. data/test/third_party_tests/rgl_tests/examples/north/g.10.70.graphml +26 -0
  295. data/test/third_party_tests/rgl_tests/examples/north/g.10.71.graphml +27 -0
  296. data/test/third_party_tests/rgl_tests/examples/north/g.10.72.graphml +28 -0
  297. data/test/third_party_tests/rgl_tests/examples/north/g.10.74.graphml +29 -0
  298. data/test/third_party_tests/rgl_tests/examples/north/g.10.75.graphml +29 -0
  299. data/test/third_party_tests/rgl_tests/examples/north/g.10.78.graphml +27 -0
  300. data/test/third_party_tests/rgl_tests/examples/north/g.10.79.graphml +34 -0
  301. data/test/third_party_tests/rgl_tests/examples/north/g.10.8.graphml +29 -0
  302. data/test/third_party_tests/rgl_tests/examples/north/g.10.80.graphml +34 -0
  303. data/test/third_party_tests/rgl_tests/examples/north/g.10.82.graphml +35 -0
  304. data/test/third_party_tests/rgl_tests/examples/north/g.10.83.graphml +32 -0
  305. data/test/third_party_tests/rgl_tests/examples/north/g.10.85.graphml +34 -0
  306. data/test/third_party_tests/rgl_tests/examples/north/g.10.86.graphml +34 -0
  307. data/test/third_party_tests/rgl_tests/examples/north/g.10.88.graphml +37 -0
  308. data/test/third_party_tests/rgl_tests/examples/north/g.10.89.graphml +29 -0
  309. data/test/third_party_tests/rgl_tests/examples/north/g.10.9.graphml +26 -0
  310. data/test/third_party_tests/rgl_tests/examples/north/g.10.90.graphml +32 -0
  311. data/test/third_party_tests/rgl_tests/examples/north/g.10.91.graphml +31 -0
  312. data/test/third_party_tests/rgl_tests/examples/north/g.10.92.graphml +26 -0
  313. data/test/third_party_tests/rgl_tests/examples/north/g.10.93.graphml +32 -0
  314. data/test/third_party_tests/rgl_tests/examples/north/g.10.94.graphml +34 -0
  315. data/test/third_party_tests/rgl_tests/examples/north/g.12.8.graphml +40 -0
  316. data/test/third_party_tests/rgl_tests/examples/north/g.14.9.graphml +36 -0
  317. data/test/third_party_tests/rgl_tests/test_helper.rb +7 -0
  318. data/test/third_party_tests/test_inheritable_attributes.rb +187 -0
  319. metadata +470 -0
@@ -0,0 +1,103 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ #
4
+ # Copyright (c) 2001,2003 Akinori MUSHA <knu@iDaemons.org>
5
+ #
6
+ # All rights reserved. You can redistribute and/or modify it under
7
+ # the same terms as Ruby.
8
+ #
9
+ # $Idaemons: /home/cvs/rb/abbrev.rb,v 1.2 2001/05/30 09:37:45 knu Exp $
10
+ # $RoughId: abbrev.rb,v 1.4 2003/10/14 19:45:42 knu Exp $
11
+ # $Id: abbrev.rb 25189 2009-10-02 12:04:37Z akr $
12
+ =end
13
+
14
+ # Calculate the set of unique abbreviations for a given set of strings.
15
+ #
16
+ # require 'abbrev'
17
+ # require 'pp'
18
+ #
19
+ # pp Abbrev::abbrev(['ruby', 'rules']).sort
20
+ #
21
+ # <i>Generates:</i>
22
+ #
23
+ # [["rub", "ruby"],
24
+ # ["ruby", "ruby"],
25
+ # ["rul", "rules"],
26
+ # ["rule", "rules"],
27
+ # ["rules", "rules"]]
28
+ #
29
+ # Also adds an +abbrev+ method to class +Array+.
30
+
31
+ module Abbrev
32
+
33
+ # Given a set of strings, calculate the set of unambiguous
34
+ # abbreviations for those strings, and return a hash where the keys
35
+ # are all the possible abbreviations and the values are the full
36
+ # strings. Thus, given input of "car" and "cone", the keys pointing
37
+ # to "car" would be "ca" and "car", while those pointing to "cone"
38
+ # would be "co", "con", and "cone".
39
+ #
40
+ # The optional +pattern+ parameter is a pattern or a string. Only
41
+ # those input strings matching the pattern, or begging the string,
42
+ # are considered for inclusion in the output hash
43
+
44
+ def abbrev(words, pattern = nil)
45
+ table = {}
46
+ seen = Hash.new(0)
47
+
48
+ if pattern.is_a?(String)
49
+ pattern = /^#{Regexp.quote(pattern)}/ # regard as a prefix
50
+ end
51
+
52
+ words.each do |word|
53
+ next if (abbrev = word).empty?
54
+ while (len = abbrev.rindex(/[\w\W]\z/)) > 0
55
+ abbrev = word[0,len]
56
+
57
+ next if pattern && pattern !~ abbrev
58
+
59
+ case seen[abbrev] += 1
60
+ when 1
61
+ table[abbrev] = word
62
+ when 2
63
+ table.delete(abbrev)
64
+ else
65
+ break
66
+ end
67
+ end
68
+ end
69
+
70
+ words.each do |word|
71
+ next if pattern && pattern !~ word
72
+
73
+ table[word] = word
74
+ end
75
+
76
+ table
77
+ end
78
+
79
+ module_function :abbrev
80
+ end
81
+
82
+ class Array
83
+ # Calculates the set of unambiguous abbreviations for the strings in
84
+ # +self+. If passed a pattern or a string, only the strings matching
85
+ # the pattern or starting with the string are considered.
86
+ #
87
+ # %w{ car cone }.abbrev #=> { "ca" => "car", "car" => "car",
88
+ # "co" => "cone", "con" => cone",
89
+ # "cone" => "cone" }
90
+ def abbrev(pattern = nil)
91
+ Abbrev::abbrev(self, pattern)
92
+ end
93
+ end
94
+
95
+ if $0 == __FILE__
96
+ while line = gets
97
+ hash = line.split.abbrev
98
+
99
+ hash.sort.each do |k, v|
100
+ puts "#{k} => #{v}"
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,418 @@
1
+ class Array
2
+ # pure: true
3
+ # builtin: true
4
+ # returns: Array=
5
+ def self.[](*args)
6
+ end
7
+ # pure: true
8
+ # builtin: true
9
+ # returns: Array=
10
+ def &(other_ary)
11
+ end
12
+ # pure: true
13
+ # builtin: true
14
+ # returns: Array=
15
+ def |(other_ary)
16
+ end
17
+ # pure: true
18
+ # builtin: true
19
+ # returns: Array=
20
+ def *(int_or_str)
21
+ end
22
+ # pure: true
23
+ # builtin: true
24
+ # returns: Array=
25
+ def +(other_ary)
26
+ end
27
+ # pure: true
28
+ # builtin: true
29
+ # returns: Array=
30
+ def -(other_ary)
31
+ end
32
+ # pure: true
33
+ # builtin: true
34
+ # returns: Array=
35
+ def <<(obj)
36
+ end
37
+ # pure: true
38
+ # builtin: true
39
+ def <=>(other_ary)
40
+ end
41
+ # pure: true
42
+ # builtin: true
43
+ def ==(other_ary)
44
+ end
45
+ # pure: true
46
+ # builtin: true
47
+ def [](*args)
48
+ end
49
+ # pure: true
50
+ # builtin: true
51
+ def []=(*args)
52
+ end
53
+ # pure: true
54
+ # builtin: true
55
+ def assoc(obj)
56
+ end
57
+ # pure: true
58
+ # builtin: true
59
+ def at(index)
60
+ end
61
+ # pure: true
62
+ # builtin: true
63
+ # returns: Array=
64
+ def clear
65
+ end
66
+ # pure: true
67
+ # builtin: true
68
+ # yield_usage: optional
69
+ def collect
70
+ end
71
+ # pure: true
72
+ # builtin: true
73
+ # yield_usage: optional
74
+ def collect!
75
+ end
76
+ # pure: true
77
+ # builtin: true
78
+ # yield_usage: optional
79
+ def combination(n)
80
+ end
81
+ # pure: true
82
+ # builtin: true
83
+ # returns: Array=
84
+ def compact
85
+ end
86
+ # pure: true
87
+ # builtin: true
88
+ def compact!
89
+ end
90
+ # pure: true
91
+ # builtin: true
92
+ # returns: Array=
93
+ def concat(other_ary)
94
+ end
95
+ # pure: true
96
+ # builtin: true
97
+ # yield_usage: optional
98
+ def count(*args)
99
+ end
100
+ # pure: true
101
+ # builtin: true
102
+ # yield_usage: optional
103
+ def cycle(n=nil)
104
+ end
105
+ # pure: true
106
+ # builtin: true
107
+ # yield_usage: optional
108
+ def delete(obj)
109
+ end
110
+ # pure: true
111
+ # builtin: true
112
+ def delete_at(index)
113
+ end
114
+ # pure: true
115
+ # builtin: true
116
+ # yield_usage: optional
117
+ def delete_if
118
+ end
119
+ # pure: true
120
+ # builtin: true
121
+ # returns: Array=
122
+ def drop(n)
123
+ end
124
+ # pure: true
125
+ # builtin: true
126
+ # returns: Array=
127
+ # yield_usage: optional
128
+ def drop_while
129
+ end
130
+ # pure: true
131
+ # builtin: true
132
+ # yield_usage: optional
133
+ # returns: Array=
134
+ def each
135
+ end
136
+ # pure: true
137
+ # builtin: true
138
+ # yield_usage: optional
139
+ def each_index
140
+ end
141
+ # pure: true
142
+ # builtin: true
143
+ def empty?
144
+ end
145
+ # pure: true
146
+ # builtin: true
147
+ def eql?(other_ary)
148
+ end
149
+ # pure: true
150
+ # builtin: true
151
+ # yield_usage: optional
152
+ def fetch(*args)
153
+ end
154
+ # pure: true
155
+ # builtin: true
156
+ # yield_usage: optional
157
+ def fill(*args)
158
+ end
159
+ # pure: true
160
+ # builtin: true
161
+ # yield_usage: optional
162
+ def find_index(*args)
163
+ end
164
+ # pure: true
165
+ # builtin: true
166
+ def first(*args)
167
+ end
168
+ # pure: true
169
+ # builtin: true
170
+ # returns: Array= | NilClass
171
+ def flatten(*args)
172
+ end
173
+ # pure: true
174
+ # builtin: true
175
+ def flatten!(*args)
176
+ end
177
+ # pure: true
178
+ # builtin: true
179
+ def frozen?
180
+ end
181
+ # pure: true
182
+ # builtin: true
183
+ def hash
184
+ end
185
+ # pure: true
186
+ # builtin: true
187
+ def include?(obj)
188
+ end
189
+ # pure: true
190
+ # builtin: true
191
+ def index(*args)
192
+ end
193
+ # pure: true
194
+ # builtin: true
195
+ def insert(index, *obj)
196
+ end
197
+ # pure: true
198
+ # builtin: true
199
+ def inspect
200
+ end
201
+ # pure: true
202
+ # builtin: true
203
+ def join(sep=$,)
204
+ end
205
+ # pure: true
206
+ # builtin: true
207
+ # yield_usage: optional
208
+ def keep_if
209
+ end
210
+ # pure: true
211
+ # builtin: true
212
+ def last(*arg)
213
+ end
214
+ # pure: true
215
+ # builtin: true
216
+ # returns: Array=
217
+ # yield_usage: optional
218
+ def map
219
+ end
220
+ # pure: true
221
+ # builtin: true
222
+ # yield_usage: optional
223
+ def map!
224
+ end
225
+ # pure: true
226
+ # builtin: true
227
+ def pack(template_string)
228
+ end
229
+ # pure: true
230
+ # builtin: true
231
+ # yield_usage: optional
232
+ def permutation(*arg)
233
+ end
234
+ # pure: true
235
+ # builtin: true
236
+ def pop(*arg)
237
+ end
238
+ # pure: true
239
+ # builtin: true
240
+ # returns: Array=
241
+ # yield_usage: optional
242
+ def product(other_ary, *rest)
243
+ end
244
+ # pure: true
245
+ # builtin: true
246
+ # returns: Array=
247
+ def push(obj, *rest)
248
+ end
249
+ # pure: true
250
+ # builtin: true
251
+ def rassoc(obj)
252
+ end
253
+ # pure: true
254
+ # builtin: true
255
+ # returns: Array=
256
+ # yield_usage: optional
257
+ def reject
258
+ end
259
+ # pure: true
260
+ # builtin: true
261
+ # yield_usage: optional
262
+ def reject!
263
+ end
264
+ # pure: true
265
+ # builtin: true
266
+ # yield_usage: optional
267
+ def repeated_combination(n)
268
+ end
269
+ # pure: true
270
+ # builtin: true
271
+ # yield_usage: optional
272
+ def repeated_permutation(n)
273
+ end
274
+ # pure: true
275
+ # builtin: true
276
+ def replace(other_ary)
277
+ end
278
+ # pure: true
279
+ # builtin: true
280
+ # returns: Array=
281
+ def reverse
282
+ end
283
+ # pure: true
284
+ # builtin: true
285
+ def reverse!
286
+ end
287
+ # pure: true
288
+ # builtin: true
289
+ # yield_usage: optional
290
+ def reverse_each
291
+ end
292
+ # pure: true
293
+ # builtin: true
294
+ def rindex(*obj_or_not)
295
+ end
296
+ # pure: true
297
+ # builtin: true
298
+ def rotate(n=1)
299
+ end
300
+ # pure: true
301
+ # builtin: true
302
+ def rotate!(cnt=1)
303
+ end
304
+ # builtin: true
305
+ # predictable: false
306
+ def sample(*n_or_not)
307
+ end
308
+ # pure: true
309
+ # builtin: true
310
+ # returns: Array=
311
+ # yield_usage: optional
312
+ def select
313
+ end
314
+ # pure: true
315
+ # builtin: true
316
+ # yield_usage: optional
317
+ def select!
318
+ end
319
+ # pure: true
320
+ # builtin: true
321
+ def shift(*n_or_not)
322
+ end
323
+ # builtin: true
324
+ # predictable: false
325
+ # returns: Array=
326
+ def shuffle
327
+ end
328
+ # builtin: true
329
+ # predictable: false
330
+ def shuffle!
331
+ end
332
+ # pure: true
333
+ # raise: false
334
+ # builtin: true
335
+ # returns: Fixnum=
336
+ def size
337
+ end
338
+ alias length size
339
+ # pure: true
340
+ # builtin: true
341
+ def slice(*args)
342
+ end
343
+ # pure: true
344
+ # builtin: true
345
+ def slice!(*args)
346
+ end
347
+ # pure: true
348
+ # builtin: true
349
+ # returns: Array=
350
+ # yield_usage: optional
351
+ def sort
352
+ end
353
+ # pure: true
354
+ # builtin: true
355
+ # yield_usage: optional
356
+ def sort!
357
+ end
358
+ # pure: true
359
+ # builtin: true
360
+ # yield_usage: optional
361
+ def sort_by!
362
+ end
363
+ # pure: true
364
+ # builtin: true
365
+ # returns: Array=
366
+ def take(n)
367
+ end
368
+ # pure: true
369
+ # builtin: true
370
+ # yield_usage: optional
371
+ def take_while
372
+ end
373
+ # pure: true
374
+ # raise: false
375
+ # builtin: true
376
+ # returns: Array=
377
+ def to_a
378
+ end
379
+ # pure: true
380
+ # raise: false
381
+ # builtin: true
382
+ # returns: Array=
383
+ def to_ary
384
+ end
385
+ # pure: true
386
+ # builtin: true
387
+ # returns: String=
388
+ def to_s
389
+ end
390
+ # pure: true
391
+ # builtin: true
392
+ def transpose
393
+ end
394
+ # pure: true
395
+ # builtin: true
396
+ # returns: Array=
397
+ def uniq
398
+ end
399
+ # pure: true
400
+ # builtin: true
401
+ def uniq!
402
+ end
403
+ # pure: true
404
+ # builtin: true
405
+ # returns: Array=
406
+ def unshift(obj, *objs)
407
+ end
408
+ # pure: true
409
+ # builtin: true
410
+ def values_at(selector, *selectors)
411
+ end
412
+ # pure: true
413
+ # builtin: true
414
+ # returns: Array=
415
+ # yield_usage: optional
416
+ def zip(arg, *args)
417
+ end
418
+ end