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,47 @@
1
+ module Laser
2
+ module Parsers
3
+ grammar GeneralPurpose
4
+ rule space
5
+ [ \t]
6
+ end
7
+
8
+ rule annotation_name
9
+ [A-Za-z0-9_]+
10
+ end
11
+
12
+ rule method_name
13
+ [A-Za-z0-9_]+ [=!?]? / operator
14
+ end
15
+
16
+ rule operator
17
+ '[]=' / '[]' / '|' / '^' / '&' / '<=>' / '===' / '==' / '=~' / '>>' /
18
+ '>=' / '>'/ '<<' / '<=' / '<' / '+@' / '-@' / '+' / '-' / '**' / '*' /
19
+ '/' / '!' / '~' / '%'
20
+ end
21
+
22
+ rule parenthesized_type_list
23
+ '(' space* ')' {
24
+ def all_types
25
+ []
26
+ end
27
+ } / '(' type_list ')' {
28
+ def all_types
29
+ type_list.all_types
30
+ end
31
+ }
32
+ end
33
+
34
+ rule type_list
35
+ type space* ',' space* type_list {
36
+ def all_types
37
+ [type.type] + type_list.all_types
38
+ end
39
+ } / type {
40
+ def all_types
41
+ [type]
42
+ end
43
+ }
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,674 @@
1
+ # Autogenerated from a Treetop grammar. Edits may be lost.
2
+
3
+
4
+ module Laser
5
+ module Parsers
6
+ module GeneralPurpose
7
+ include Treetop::Runtime
8
+
9
+ def root
10
+ @root ||= :space
11
+ end
12
+
13
+ def _nt_space
14
+ start_index = index
15
+ if node_cache[:space].has_key?(index)
16
+ cached = node_cache[:space][index]
17
+ if cached
18
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
19
+ @index = cached.interval.end
20
+ end
21
+ return cached
22
+ end
23
+
24
+ if has_terminal?('\G[ \\t]', true, index)
25
+ r0 = instantiate_node(SyntaxNode,input, index...(index + 1))
26
+ @index += 1
27
+ else
28
+ r0 = nil
29
+ end
30
+
31
+ node_cache[:space][start_index] = r0
32
+
33
+ r0
34
+ end
35
+
36
+ def _nt_annotation_name
37
+ start_index = index
38
+ if node_cache[:annotation_name].has_key?(index)
39
+ cached = node_cache[:annotation_name][index]
40
+ if cached
41
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
42
+ @index = cached.interval.end
43
+ end
44
+ return cached
45
+ end
46
+
47
+ s0, i0 = [], index
48
+ loop do
49
+ if has_terminal?('\G[A-Za-z0-9_]', true, index)
50
+ r1 = true
51
+ @index += 1
52
+ else
53
+ r1 = nil
54
+ end
55
+ if r1
56
+ s0 << r1
57
+ else
58
+ break
59
+ end
60
+ end
61
+ if s0.empty?
62
+ @index = i0
63
+ r0 = nil
64
+ else
65
+ r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
66
+ end
67
+
68
+ node_cache[:annotation_name][start_index] = r0
69
+
70
+ r0
71
+ end
72
+
73
+ module MethodName0
74
+ end
75
+
76
+ def _nt_method_name
77
+ start_index = index
78
+ if node_cache[:method_name].has_key?(index)
79
+ cached = node_cache[:method_name][index]
80
+ if cached
81
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
82
+ @index = cached.interval.end
83
+ end
84
+ return cached
85
+ end
86
+
87
+ i0 = index
88
+ i1, s1 = index, []
89
+ s2, i2 = [], index
90
+ loop do
91
+ if has_terminal?('\G[A-Za-z0-9_]', true, index)
92
+ r3 = true
93
+ @index += 1
94
+ else
95
+ r3 = nil
96
+ end
97
+ if r3
98
+ s2 << r3
99
+ else
100
+ break
101
+ end
102
+ end
103
+ if s2.empty?
104
+ @index = i2
105
+ r2 = nil
106
+ else
107
+ r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
108
+ end
109
+ s1 << r2
110
+ if r2
111
+ if has_terminal?('\G[=!?]', true, index)
112
+ r5 = true
113
+ @index += 1
114
+ else
115
+ r5 = nil
116
+ end
117
+ if r5
118
+ r4 = r5
119
+ else
120
+ r4 = instantiate_node(SyntaxNode,input, index...index)
121
+ end
122
+ s1 << r4
123
+ end
124
+ if s1.last
125
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
126
+ r1.extend(MethodName0)
127
+ else
128
+ @index = i1
129
+ r1 = nil
130
+ end
131
+ if r1
132
+ r0 = r1
133
+ else
134
+ r6 = _nt_operator
135
+ if r6
136
+ r0 = r6
137
+ else
138
+ @index = i0
139
+ r0 = nil
140
+ end
141
+ end
142
+
143
+ node_cache[:method_name][start_index] = r0
144
+
145
+ r0
146
+ end
147
+
148
+ def _nt_operator
149
+ start_index = index
150
+ if node_cache[:operator].has_key?(index)
151
+ cached = node_cache[:operator][index]
152
+ if cached
153
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
154
+ @index = cached.interval.end
155
+ end
156
+ return cached
157
+ end
158
+
159
+ i0 = index
160
+ if has_terminal?('[]=', false, index)
161
+ r1 = instantiate_node(SyntaxNode,input, index...(index + 3))
162
+ @index += 3
163
+ else
164
+ terminal_parse_failure('[]=')
165
+ r1 = nil
166
+ end
167
+ if r1
168
+ r0 = r1
169
+ else
170
+ if has_terminal?('[]', false, index)
171
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 2))
172
+ @index += 2
173
+ else
174
+ terminal_parse_failure('[]')
175
+ r2 = nil
176
+ end
177
+ if r2
178
+ r0 = r2
179
+ else
180
+ if has_terminal?('|', false, index)
181
+ r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
182
+ @index += 1
183
+ else
184
+ terminal_parse_failure('|')
185
+ r3 = nil
186
+ end
187
+ if r3
188
+ r0 = r3
189
+ else
190
+ if has_terminal?('^', false, index)
191
+ r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
192
+ @index += 1
193
+ else
194
+ terminal_parse_failure('^')
195
+ r4 = nil
196
+ end
197
+ if r4
198
+ r0 = r4
199
+ else
200
+ if has_terminal?('&', false, index)
201
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
202
+ @index += 1
203
+ else
204
+ terminal_parse_failure('&')
205
+ r5 = nil
206
+ end
207
+ if r5
208
+ r0 = r5
209
+ else
210
+ if has_terminal?('<=>', false, index)
211
+ r6 = instantiate_node(SyntaxNode,input, index...(index + 3))
212
+ @index += 3
213
+ else
214
+ terminal_parse_failure('<=>')
215
+ r6 = nil
216
+ end
217
+ if r6
218
+ r0 = r6
219
+ else
220
+ if has_terminal?('===', false, index)
221
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 3))
222
+ @index += 3
223
+ else
224
+ terminal_parse_failure('===')
225
+ r7 = nil
226
+ end
227
+ if r7
228
+ r0 = r7
229
+ else
230
+ if has_terminal?('==', false, index)
231
+ r8 = instantiate_node(SyntaxNode,input, index...(index + 2))
232
+ @index += 2
233
+ else
234
+ terminal_parse_failure('==')
235
+ r8 = nil
236
+ end
237
+ if r8
238
+ r0 = r8
239
+ else
240
+ if has_terminal?('=~', false, index)
241
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 2))
242
+ @index += 2
243
+ else
244
+ terminal_parse_failure('=~')
245
+ r9 = nil
246
+ end
247
+ if r9
248
+ r0 = r9
249
+ else
250
+ if has_terminal?('>>', false, index)
251
+ r10 = instantiate_node(SyntaxNode,input, index...(index + 2))
252
+ @index += 2
253
+ else
254
+ terminal_parse_failure('>>')
255
+ r10 = nil
256
+ end
257
+ if r10
258
+ r0 = r10
259
+ else
260
+ if has_terminal?('>=', false, index)
261
+ r11 = instantiate_node(SyntaxNode,input, index...(index + 2))
262
+ @index += 2
263
+ else
264
+ terminal_parse_failure('>=')
265
+ r11 = nil
266
+ end
267
+ if r11
268
+ r0 = r11
269
+ else
270
+ if has_terminal?('>', false, index)
271
+ r12 = instantiate_node(SyntaxNode,input, index...(index + 1))
272
+ @index += 1
273
+ else
274
+ terminal_parse_failure('>')
275
+ r12 = nil
276
+ end
277
+ if r12
278
+ r0 = r12
279
+ else
280
+ if has_terminal?('<<', false, index)
281
+ r13 = instantiate_node(SyntaxNode,input, index...(index + 2))
282
+ @index += 2
283
+ else
284
+ terminal_parse_failure('<<')
285
+ r13 = nil
286
+ end
287
+ if r13
288
+ r0 = r13
289
+ else
290
+ if has_terminal?('<=', false, index)
291
+ r14 = instantiate_node(SyntaxNode,input, index...(index + 2))
292
+ @index += 2
293
+ else
294
+ terminal_parse_failure('<=')
295
+ r14 = nil
296
+ end
297
+ if r14
298
+ r0 = r14
299
+ else
300
+ if has_terminal?('<', false, index)
301
+ r15 = instantiate_node(SyntaxNode,input, index...(index + 1))
302
+ @index += 1
303
+ else
304
+ terminal_parse_failure('<')
305
+ r15 = nil
306
+ end
307
+ if r15
308
+ r0 = r15
309
+ else
310
+ if has_terminal?('+@', false, index)
311
+ r16 = instantiate_node(SyntaxNode,input, index...(index + 2))
312
+ @index += 2
313
+ else
314
+ terminal_parse_failure('+@')
315
+ r16 = nil
316
+ end
317
+ if r16
318
+ r0 = r16
319
+ else
320
+ if has_terminal?('-@', false, index)
321
+ r17 = instantiate_node(SyntaxNode,input, index...(index + 2))
322
+ @index += 2
323
+ else
324
+ terminal_parse_failure('-@')
325
+ r17 = nil
326
+ end
327
+ if r17
328
+ r0 = r17
329
+ else
330
+ if has_terminal?('+', false, index)
331
+ r18 = instantiate_node(SyntaxNode,input, index...(index + 1))
332
+ @index += 1
333
+ else
334
+ terminal_parse_failure('+')
335
+ r18 = nil
336
+ end
337
+ if r18
338
+ r0 = r18
339
+ else
340
+ if has_terminal?('-', false, index)
341
+ r19 = instantiate_node(SyntaxNode,input, index...(index + 1))
342
+ @index += 1
343
+ else
344
+ terminal_parse_failure('-')
345
+ r19 = nil
346
+ end
347
+ if r19
348
+ r0 = r19
349
+ else
350
+ if has_terminal?('**', false, index)
351
+ r20 = instantiate_node(SyntaxNode,input, index...(index + 2))
352
+ @index += 2
353
+ else
354
+ terminal_parse_failure('**')
355
+ r20 = nil
356
+ end
357
+ if r20
358
+ r0 = r20
359
+ else
360
+ if has_terminal?('*', false, index)
361
+ r21 = instantiate_node(SyntaxNode,input, index...(index + 1))
362
+ @index += 1
363
+ else
364
+ terminal_parse_failure('*')
365
+ r21 = nil
366
+ end
367
+ if r21
368
+ r0 = r21
369
+ else
370
+ if has_terminal?('/', false, index)
371
+ r22 = instantiate_node(SyntaxNode,input, index...(index + 1))
372
+ @index += 1
373
+ else
374
+ terminal_parse_failure('/')
375
+ r22 = nil
376
+ end
377
+ if r22
378
+ r0 = r22
379
+ else
380
+ if has_terminal?('!', false, index)
381
+ r23 = instantiate_node(SyntaxNode,input, index...(index + 1))
382
+ @index += 1
383
+ else
384
+ terminal_parse_failure('!')
385
+ r23 = nil
386
+ end
387
+ if r23
388
+ r0 = r23
389
+ else
390
+ if has_terminal?('~', false, index)
391
+ r24 = instantiate_node(SyntaxNode,input, index...(index + 1))
392
+ @index += 1
393
+ else
394
+ terminal_parse_failure('~')
395
+ r24 = nil
396
+ end
397
+ if r24
398
+ r0 = r24
399
+ else
400
+ if has_terminal?('%', false, index)
401
+ r25 = instantiate_node(SyntaxNode,input, index...(index + 1))
402
+ @index += 1
403
+ else
404
+ terminal_parse_failure('%')
405
+ r25 = nil
406
+ end
407
+ if r25
408
+ r0 = r25
409
+ else
410
+ @index = i0
411
+ r0 = nil
412
+ end
413
+ end
414
+ end
415
+ end
416
+ end
417
+ end
418
+ end
419
+ end
420
+ end
421
+ end
422
+ end
423
+ end
424
+ end
425
+ end
426
+ end
427
+ end
428
+ end
429
+ end
430
+ end
431
+ end
432
+ end
433
+ end
434
+ end
435
+ end
436
+ end
437
+
438
+ node_cache[:operator][start_index] = r0
439
+
440
+ r0
441
+ end
442
+
443
+ module ParenthesizedTypeList0
444
+ end
445
+
446
+ module ParenthesizedTypeList1
447
+ def all_types
448
+ []
449
+ end
450
+ end
451
+
452
+ module ParenthesizedTypeList2
453
+ def type_list
454
+ elements[1]
455
+ end
456
+
457
+ end
458
+
459
+ module ParenthesizedTypeList3
460
+ def all_types
461
+ type_list.all_types
462
+ end
463
+ end
464
+
465
+ def _nt_parenthesized_type_list
466
+ start_index = index
467
+ if node_cache[:parenthesized_type_list].has_key?(index)
468
+ cached = node_cache[:parenthesized_type_list][index]
469
+ if cached
470
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
471
+ @index = cached.interval.end
472
+ end
473
+ return cached
474
+ end
475
+
476
+ i0 = index
477
+ i1, s1 = index, []
478
+ if has_terminal?('(', false, index)
479
+ r2 = instantiate_node(SyntaxNode,input, index...(index + 1))
480
+ @index += 1
481
+ else
482
+ terminal_parse_failure('(')
483
+ r2 = nil
484
+ end
485
+ s1 << r2
486
+ if r2
487
+ s3, i3 = [], index
488
+ loop do
489
+ r4 = _nt_space
490
+ if r4
491
+ s3 << r4
492
+ else
493
+ break
494
+ end
495
+ end
496
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
497
+ s1 << r3
498
+ if r3
499
+ if has_terminal?(')', false, index)
500
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
501
+ @index += 1
502
+ else
503
+ terminal_parse_failure(')')
504
+ r5 = nil
505
+ end
506
+ s1 << r5
507
+ end
508
+ end
509
+ if s1.last
510
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
511
+ r1.extend(ParenthesizedTypeList0)
512
+ r1.extend(ParenthesizedTypeList1)
513
+ else
514
+ @index = i1
515
+ r1 = nil
516
+ end
517
+ if r1
518
+ r0 = r1
519
+ else
520
+ i6, s6 = index, []
521
+ if has_terminal?('(', false, index)
522
+ r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
523
+ @index += 1
524
+ else
525
+ terminal_parse_failure('(')
526
+ r7 = nil
527
+ end
528
+ s6 << r7
529
+ if r7
530
+ r8 = _nt_type_list
531
+ s6 << r8
532
+ if r8
533
+ if has_terminal?(')', false, index)
534
+ r9 = instantiate_node(SyntaxNode,input, index...(index + 1))
535
+ @index += 1
536
+ else
537
+ terminal_parse_failure(')')
538
+ r9 = nil
539
+ end
540
+ s6 << r9
541
+ end
542
+ end
543
+ if s6.last
544
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
545
+ r6.extend(ParenthesizedTypeList2)
546
+ r6.extend(ParenthesizedTypeList3)
547
+ else
548
+ @index = i6
549
+ r6 = nil
550
+ end
551
+ if r6
552
+ r0 = r6
553
+ else
554
+ @index = i0
555
+ r0 = nil
556
+ end
557
+ end
558
+
559
+ node_cache[:parenthesized_type_list][start_index] = r0
560
+
561
+ r0
562
+ end
563
+
564
+ module TypeList0
565
+ def type
566
+ elements[0]
567
+ end
568
+
569
+ def type_list
570
+ elements[4]
571
+ end
572
+ end
573
+
574
+ module TypeList1
575
+ def all_types
576
+ [type.type] + type_list.all_types
577
+ end
578
+ end
579
+
580
+ module TypeList2
581
+ def all_types
582
+ [type]
583
+ end
584
+ end
585
+
586
+ def _nt_type_list
587
+ start_index = index
588
+ if node_cache[:type_list].has_key?(index)
589
+ cached = node_cache[:type_list][index]
590
+ if cached
591
+ cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
592
+ @index = cached.interval.end
593
+ end
594
+ return cached
595
+ end
596
+
597
+ i0 = index
598
+ i1, s1 = index, []
599
+ r2 = _nt_type
600
+ s1 << r2
601
+ if r2
602
+ s3, i3 = [], index
603
+ loop do
604
+ r4 = _nt_space
605
+ if r4
606
+ s3 << r4
607
+ else
608
+ break
609
+ end
610
+ end
611
+ r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
612
+ s1 << r3
613
+ if r3
614
+ if has_terminal?(',', false, index)
615
+ r5 = instantiate_node(SyntaxNode,input, index...(index + 1))
616
+ @index += 1
617
+ else
618
+ terminal_parse_failure(',')
619
+ r5 = nil
620
+ end
621
+ s1 << r5
622
+ if r5
623
+ s6, i6 = [], index
624
+ loop do
625
+ r7 = _nt_space
626
+ if r7
627
+ s6 << r7
628
+ else
629
+ break
630
+ end
631
+ end
632
+ r6 = instantiate_node(SyntaxNode,input, i6...index, s6)
633
+ s1 << r6
634
+ if r6
635
+ r8 = _nt_type_list
636
+ s1 << r8
637
+ end
638
+ end
639
+ end
640
+ end
641
+ if s1.last
642
+ r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
643
+ r1.extend(TypeList0)
644
+ r1.extend(TypeList1)
645
+ else
646
+ @index = i1
647
+ r1 = nil
648
+ end
649
+ if r1
650
+ r0 = r1
651
+ else
652
+ r9 = _nt_type
653
+ r9.extend(TypeList2)
654
+ if r9
655
+ r0 = r9
656
+ else
657
+ @index = i0
658
+ r0 = nil
659
+ end
660
+ end
661
+
662
+ node_cache[:type_list][start_index] = r0
663
+
664
+ r0
665
+ end
666
+
667
+ end
668
+
669
+ class GeneralPurposeParser < Treetop::Runtime::CompiledParser
670
+ include GeneralPurpose
671
+ end
672
+
673
+ end
674
+ end