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,24 @@
1
+ require 'laser/annotation_parser/useful_parsers_parser'
2
+ module Laser
3
+ module Parsers
4
+ grammar Overload
5
+ include GeneralPurpose
6
+ rule function_type
7
+ parenthesized_type_list space* '->' space* return_type:type {
8
+ def type
9
+ result = Types::GenericType.new(
10
+ Types::PROC,
11
+ [Types::TupleType.new(parenthesized_type_list.all_types), return_type.type])
12
+ end
13
+ } / parenthesized_type_list space* return_type:type {
14
+ def type
15
+ result = Types::GenericType.new(
16
+ Types::PROC,
17
+ [Types::TupleType.new(parenthesized_type_list.all_types), return_type.type])
18
+ end
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
24
+
@@ -0,0 +1,167 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ require 'laser/annotation_parser/useful_parsers_parser'
5
+ module Laser
6
+ module Parsers
7
+ module Overload
8
+ include Treetop::Runtime
9
+
10
+ def root
11
+ @root ||= :function_type
12
+ end
13
+
14
+ include GeneralPurpose
15
+
16
+ module FunctionType0
17
+ def parenthesized_type_list
18
+ elements[0]
19
+ end
20
+
21
+ def return_type
22
+ elements[4]
23
+ end
24
+ end
25
+
26
+ module FunctionType1
27
+ def type
28
+ result = Types::GenericType.new(
29
+ Types::PROC,
30
+ [Types::TupleType.new(parenthesized_type_list.all_types), return_type.type])
31
+ end
32
+ end
33
+
34
+ module FunctionType2
35
+ def parenthesized_type_list
36
+ elements[0]
37
+ end
38
+
39
+ def return_type
40
+ elements[2]
41
+ end
42
+ end
43
+
44
+ module FunctionType3
45
+ def type
46
+ result = Types::GenericType.new(
47
+ Types::PROC,
48
+ [Types::TupleType.new(parenthesized_type_list.all_types), return_type.type])
49
+ end
50
+ end
51
+
52
+ def _nt_function_type
53
+ start_index = index
54
+ if node_cache[:function_type].has_key?(index)
55
+ cached = node_cache[:function_type][index]
56
+ if cached
57
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
58
+ @index = cached.interval.end
59
+ end
60
+ return cached
61
+ end
62
+
63
+ i0 = index
64
+ i1, s1 = index, []
65
+ r2 = _nt_parenthesized_type_list
66
+ s1 << r2
67
+ if r2
68
+ s3, i3 = [], index
69
+ loop do
70
+ r4 = _nt_space
71
+ if r4
72
+ s3 << r4
73
+ else
74
+ break
75
+ end
76
+ end
77
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
78
+ s1 << r3
79
+ if r3
80
+ if has_terminal?('->', false, index)
81
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 2))
82
+ @index += 2
83
+ else
84
+ terminal_parse_failure('->')
85
+ r5 = nil
86
+ end
87
+ s1 << r5
88
+ if r5
89
+ s6, i6 = [], index
90
+ loop do
91
+ r7 = _nt_space
92
+ if r7
93
+ s6 << r7
94
+ else
95
+ break
96
+ end
97
+ end
98
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
99
+ s1 << r6
100
+ if r6
101
+ r8 = _nt_type
102
+ s1 << r8
103
+ end
104
+ end
105
+ end
106
+ end
107
+ if s1.last
108
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
109
+ r1.extend(FunctionType0)
110
+ r1.extend(FunctionType1)
111
+ else
112
+ @index = i1
113
+ r1 = nil
114
+ end
115
+ if r1
116
+ r0 = r1
117
+ else
118
+ i9, s9 = index, []
119
+ r10 = _nt_parenthesized_type_list
120
+ s9 << r10
121
+ if r10
122
+ s11, i11 = [], index
123
+ loop do
124
+ r12 = _nt_space
125
+ if r12
126
+ s11 << r12
127
+ else
128
+ break
129
+ end
130
+ end
131
+ r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
132
+ s9 << r11
133
+ if r11
134
+ r13 = _nt_type
135
+ s9 << r13
136
+ end
137
+ end
138
+ if s9.last
139
+ r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
140
+ r9.extend(FunctionType2)
141
+ r9.extend(FunctionType3)
142
+ else
143
+ @index = i9
144
+ r9 = nil
145
+ end
146
+ if r9
147
+ r0 = r9
148
+ else
149
+ @index = i0
150
+ r0 = nil
151
+ end
152
+ end
153
+
154
+ node_cache[:function_type][start_index] = r0
155
+
156
+ r0
157
+ end
158
+
159
+ end
160
+
161
+ class OverloadParser < Treetop::Runtime::CompiledParser
162
+ include Overload
163
+ end
164
+
165
+ end
166
+ end
167
+
@@ -0,0 +1,6 @@
1
+ # This is a generated file
2
+
3
+ require_relative 'class_annotations_parser'
4
+ require_relative 'structural_parser'
5
+ require_relative 'overload_parser'
6
+ require_relative 'annotations_parser'
@@ -0,0 +1,37 @@
1
+ require 'laser/annotation_parser/useful_parsers_parser'
2
+ module Laser
3
+ module Parsers
4
+ grammar Structural
5
+ include GeneralPurpose
6
+ rule structural_constraint
7
+ '#' method_name space* parenthesized_type_list space* '->' space* return_type:type {
8
+ def type
9
+ result = Types::StructuralType.new(
10
+ method_name.text_value, parenthesized_type_list.all_types,
11
+ return_type.type)
12
+ end
13
+ } / '#' method_name space* parenthesized_type_list space* return_type:type {
14
+ def type
15
+ result = Types::StructuralType.new(
16
+ method_name.text_value, parenthesized_type_list.all_types,
17
+ return_type.type)
18
+ end
19
+ } / '#' method_name space* parenthesized_type_list {
20
+ def type
21
+ result = Types::StructuralType.new(
22
+ method_name.text_value, parenthesized_type_list.all_types, [])
23
+ end
24
+ } / '#' method_name space* '->' space* return_type:type {
25
+ def type
26
+ result = Types::StructuralType.new(
27
+ method_name.text_value, [], return_type.type)
28
+ end
29
+ } / '#' method_name {
30
+ def type
31
+ result = Types::StructuralType.new(method_name.text_value, [], [])
32
+ end
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,406 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ require 'laser/annotation_parser/useful_parsers_parser'
5
+ module Laser
6
+ module Parsers
7
+ module Structural
8
+ include Treetop::Runtime
9
+
10
+ def root
11
+ @root ||= :structural_constraint
12
+ end
13
+
14
+ include GeneralPurpose
15
+
16
+ module StructuralConstraint0
17
+ def method_name
18
+ elements[1]
19
+ end
20
+
21
+ def parenthesized_type_list
22
+ elements[3]
23
+ end
24
+
25
+ def return_type
26
+ elements[7]
27
+ end
28
+ end
29
+
30
+ module StructuralConstraint1
31
+ def type
32
+ result = Types::StructuralType.new(
33
+ method_name.text_value, parenthesized_type_list.all_types,
34
+ return_type.type)
35
+ end
36
+ end
37
+
38
+ module StructuralConstraint2
39
+ def method_name
40
+ elements[1]
41
+ end
42
+
43
+ def parenthesized_type_list
44
+ elements[3]
45
+ end
46
+
47
+ def return_type
48
+ elements[5]
49
+ end
50
+ end
51
+
52
+ module StructuralConstraint3
53
+ def type
54
+ result = Types::StructuralType.new(
55
+ method_name.text_value, parenthesized_type_list.all_types,
56
+ return_type.type)
57
+ end
58
+ end
59
+
60
+ module StructuralConstraint4
61
+ def method_name
62
+ elements[1]
63
+ end
64
+
65
+ def parenthesized_type_list
66
+ elements[3]
67
+ end
68
+ end
69
+
70
+ module StructuralConstraint5
71
+ def type
72
+ result = Types::StructuralType.new(
73
+ method_name.text_value, parenthesized_type_list.all_types, [])
74
+ end
75
+ end
76
+
77
+ module StructuralConstraint6
78
+ def method_name
79
+ elements[1]
80
+ end
81
+
82
+ def return_type
83
+ elements[5]
84
+ end
85
+ end
86
+
87
+ module StructuralConstraint7
88
+ def type
89
+ result = Types::StructuralType.new(
90
+ method_name.text_value, [], return_type.type)
91
+ end
92
+ end
93
+
94
+ module StructuralConstraint8
95
+ def method_name
96
+ elements[1]
97
+ end
98
+ end
99
+
100
+ module StructuralConstraint9
101
+ def type
102
+ result = Types::StructuralType.new(method_name.text_value, [], [])
103
+ end
104
+ end
105
+
106
+ def _nt_structural_constraint
107
+ start_index = index
108
+ if node_cache[:structural_constraint].has_key?(index)
109
+ cached = node_cache[:structural_constraint][index]
110
+ if cached
111
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
112
+ @index = cached.interval.end
113
+ end
114
+ return cached
115
+ end
116
+
117
+ i0 = index
118
+ i1, s1 = index, []
119
+ if has_terminal?('#', false, index)
120
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
121
+ @index += 1
122
+ else
123
+ terminal_parse_failure('#')
124
+ r2 = nil
125
+ end
126
+ s1 << r2
127
+ if r2
128
+ r3 = _nt_method_name
129
+ s1 << r3
130
+ if r3
131
+ s4, i4 = [], index
132
+ loop do
133
+ r5 = _nt_space
134
+ if r5
135
+ s4 << r5
136
+ else
137
+ break
138
+ end
139
+ end
140
+ r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
141
+ s1 << r4
142
+ if r4
143
+ r6 = _nt_parenthesized_type_list
144
+ s1 << r6
145
+ if r6
146
+ s7, i7 = [], index
147
+ loop do
148
+ r8 = _nt_space
149
+ if r8
150
+ s7 << r8
151
+ else
152
+ break
153
+ end
154
+ end
155
+ r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
156
+ s1 << r7
157
+ if r7
158
+ if has_terminal?('->', false, index)
159
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 2))
160
+ @index += 2
161
+ else
162
+ terminal_parse_failure('->')
163
+ r9 = nil
164
+ end
165
+ s1 << r9
166
+ if r9
167
+ s10, i10 = [], index
168
+ loop do
169
+ r11 = _nt_space
170
+ if r11
171
+ s10 << r11
172
+ else
173
+ break
174
+ end
175
+ end
176
+ r10 = instantiate_node(SyntaxNode,input, i10...index, s10)
177
+ s1 << r10
178
+ if r10
179
+ r12 = _nt_type
180
+ s1 << r12
181
+ end
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
187
+ end
188
+ if s1.last
189
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
190
+ r1.extend(StructuralConstraint0)
191
+ r1.extend(StructuralConstraint1)
192
+ else
193
+ @index = i1
194
+ r1 = nil
195
+ end
196
+ if r1
197
+ r0 = r1
198
+ else
199
+ i13, s13 = index, []
200
+ if has_terminal?('#', false, index)
201
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 1))
202
+ @index += 1
203
+ else
204
+ terminal_parse_failure('#')
205
+ r14 = nil
206
+ end
207
+ s13 << r14
208
+ if r14
209
+ r15 = _nt_method_name
210
+ s13 << r15
211
+ if r15
212
+ s16, i16 = [], index
213
+ loop do
214
+ r17 = _nt_space
215
+ if r17
216
+ s16 << r17
217
+ else
218
+ break
219
+ end
220
+ end
221
+ r16 = instantiate_node(SyntaxNode,input, i16...index, s16)
222
+ s13 << r16
223
+ if r16
224
+ r18 = _nt_parenthesized_type_list
225
+ s13 << r18
226
+ if r18
227
+ s19, i19 = [], index
228
+ loop do
229
+ r20 = _nt_space
230
+ if r20
231
+ s19 << r20
232
+ else
233
+ break
234
+ end
235
+ end
236
+ r19 = instantiate_node(SyntaxNode,input, i19...index, s19)
237
+ s13 << r19
238
+ if r19
239
+ r21 = _nt_type
240
+ s13 << r21
241
+ end
242
+ end
243
+ end
244
+ end
245
+ end
246
+ if s13.last
247
+ r13 = instantiate_node(SyntaxNode,input, i13...index, s13)
248
+ r13.extend(StructuralConstraint2)
249
+ r13.extend(StructuralConstraint3)
250
+ else
251
+ @index = i13
252
+ r13 = nil
253
+ end
254
+ if r13
255
+ r0 = r13
256
+ else
257
+ i22, s22 = index, []
258
+ if has_terminal?('#', false, index)
259
+ r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
260
+ @index += 1
261
+ else
262
+ terminal_parse_failure('#')
263
+ r23 = nil
264
+ end
265
+ s22 << r23
266
+ if r23
267
+ r24 = _nt_method_name
268
+ s22 << r24
269
+ if r24
270
+ s25, i25 = [], index
271
+ loop do
272
+ r26 = _nt_space
273
+ if r26
274
+ s25 << r26
275
+ else
276
+ break
277
+ end
278
+ end
279
+ r25 = instantiate_node(SyntaxNode,input, i25...index, s25)
280
+ s22 << r25
281
+ if r25
282
+ r27 = _nt_parenthesized_type_list
283
+ s22 << r27
284
+ end
285
+ end
286
+ end
287
+ if s22.last
288
+ r22 = instantiate_node(SyntaxNode,input, i22...index, s22)
289
+ r22.extend(StructuralConstraint4)
290
+ r22.extend(StructuralConstraint5)
291
+ else
292
+ @index = i22
293
+ r22 = nil
294
+ end
295
+ if r22
296
+ r0 = r22
297
+ else
298
+ i28, s28 = index, []
299
+ if has_terminal?('#', false, index)
300
+ r29 = instantiate_node(SyntaxNode,input, index...(index + 1))
301
+ @index += 1
302
+ else
303
+ terminal_parse_failure('#')
304
+ r29 = nil
305
+ end
306
+ s28 << r29
307
+ if r29
308
+ r30 = _nt_method_name
309
+ s28 << r30
310
+ if r30
311
+ s31, i31 = [], index
312
+ loop do
313
+ r32 = _nt_space
314
+ if r32
315
+ s31 << r32
316
+ else
317
+ break
318
+ end
319
+ end
320
+ r31 = instantiate_node(SyntaxNode,input, i31...index, s31)
321
+ s28 << r31
322
+ if r31
323
+ if has_terminal?('->', false, index)
324
+ r33 = instantiate_node(SyntaxNode,input, index...(index + 2))
325
+ @index += 2
326
+ else
327
+ terminal_parse_failure('->')
328
+ r33 = nil
329
+ end
330
+ s28 << r33
331
+ if r33
332
+ s34, i34 = [], index
333
+ loop do
334
+ r35 = _nt_space
335
+ if r35
336
+ s34 << r35
337
+ else
338
+ break
339
+ end
340
+ end
341
+ r34 = instantiate_node(SyntaxNode,input, i34...index, s34)
342
+ s28 << r34
343
+ if r34
344
+ r36 = _nt_type
345
+ s28 << r36
346
+ end
347
+ end
348
+ end
349
+ end
350
+ end
351
+ if s28.last
352
+ r28 = instantiate_node(SyntaxNode,input, i28...index, s28)
353
+ r28.extend(StructuralConstraint6)
354
+ r28.extend(StructuralConstraint7)
355
+ else
356
+ @index = i28
357
+ r28 = nil
358
+ end
359
+ if r28
360
+ r0 = r28
361
+ else
362
+ i37, s37 = index, []
363
+ if has_terminal?('#', false, index)
364
+ r38 = instantiate_node(SyntaxNode,input, index...(index + 1))
365
+ @index += 1
366
+ else
367
+ terminal_parse_failure('#')
368
+ r38 = nil
369
+ end
370
+ s37 << r38
371
+ if r38
372
+ r39 = _nt_method_name
373
+ s37 << r39
374
+ end
375
+ if s37.last
376
+ r37 = instantiate_node(SyntaxNode,input, i37...index, s37)
377
+ r37.extend(StructuralConstraint8)
378
+ r37.extend(StructuralConstraint9)
379
+ else
380
+ @index = i37
381
+ r37 = nil
382
+ end
383
+ if r37
384
+ r0 = r37
385
+ else
386
+ @index = i0
387
+ r0 = nil
388
+ end
389
+ end
390
+ end
391
+ end
392
+ end
393
+
394
+ node_cache[:structural_constraint][start_index] = r0
395
+
396
+ r0
397
+ end
398
+
399
+ end
400
+
401
+ class StructuralParser < Treetop::Runtime::CompiledParser
402
+ include Structural
403
+ end
404
+
405
+ end
406
+ end