laser 0.7.0.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +14 -0
- data/LICENSE +661 -0
- data/README.md +158 -0
- data/Rakefile +104 -0
- data/VERSION +1 -0
- data/bin/laser +7 -0
- data/design_docs/goals.md +57 -0
- data/design_docs/object_regex.md +426 -0
- data/design_docs/type_annotations.md +80 -0
- data/ext/laser/BasicBlock.cpp +572 -0
- data/ext/laser/BasicBlock.h +118 -0
- data/ext/laser/extconf.rb +3 -0
- data/features/laser.feature +25 -0
- data/features/step_definitions/laser_steps.rb +39 -0
- data/features/support/env.rb +14 -0
- data/features/support/testdata/1_input +1 -0
- data/features/support/testdata/1_output +1 -0
- data/features/support/testdata/2_input +4 -0
- data/features/support/testdata/2_output +4 -0
- data/features/support/testdata/3_input +8 -0
- data/features/support/testdata/3_output +11 -0
- data/features/support/testdata/4_input +5 -0
- data/features/support/testdata/4_output +5 -0
- data/features/support/testdata/5_input +13 -0
- data/laser.gemspec +382 -0
- data/lib/laser.rb +98 -0
- data/lib/laser/analysis/annotations.rb +95 -0
- data/lib/laser/analysis/annotations/annotation_config.yaml +3 -0
- data/lib/laser/analysis/annotations/comment_attachment_annotation.rb +66 -0
- data/lib/laser/analysis/annotations/node_pointers_annotation.rb +36 -0
- data/lib/laser/analysis/annotations/runtime_annotation.rb +55 -0
- data/lib/laser/analysis/argument_expansion.rb +132 -0
- data/lib/laser/analysis/arity.rb +34 -0
- data/lib/laser/analysis/bindings.rb +144 -0
- data/lib/laser/analysis/bootstrap/bootstrap.rb +298 -0
- data/lib/laser/analysis/bootstrap/laser_class.rb +106 -0
- data/lib/laser/analysis/bootstrap/laser_method.rb +255 -0
- data/lib/laser/analysis/bootstrap/laser_module.rb +403 -0
- data/lib/laser/analysis/bootstrap/laser_module_copy.rb +74 -0
- data/lib/laser/analysis/bootstrap/laser_object.rb +69 -0
- data/lib/laser/analysis/bootstrap/laser_proc.rb +150 -0
- data/lib/laser/analysis/bootstrap/laser_singleton_class.rb +44 -0
- data/lib/laser/analysis/comments.rb +35 -0
- data/lib/laser/analysis/control_flow.rb +28 -0
- data/lib/laser/analysis/control_flow/alias_analysis.rb +31 -0
- data/lib/laser/analysis/control_flow/basic_block.rb +105 -0
- data/lib/laser/analysis/control_flow/cfg_builder.rb +2505 -0
- data/lib/laser/analysis/control_flow/cfg_instruction.rb +190 -0
- data/lib/laser/analysis/control_flow/constant_propagation.rb +742 -0
- data/lib/laser/analysis/control_flow/control_flow_graph.rb +370 -0
- data/lib/laser/analysis/control_flow/lifetime_analysis.rb +91 -0
- data/lib/laser/analysis/control_flow/method_call_search.rb +26 -0
- data/lib/laser/analysis/control_flow/raise_properties.rb +25 -0
- data/lib/laser/analysis/control_flow/simulation.rb +385 -0
- data/lib/laser/analysis/control_flow/static_single_assignment.rb +185 -0
- data/lib/laser/analysis/control_flow/unreachability_analysis.rb +57 -0
- data/lib/laser/analysis/control_flow/unused_variables.rb +91 -0
- data/lib/laser/analysis/control_flow/yield_properties.rb +103 -0
- data/lib/laser/analysis/errors.rb +131 -0
- data/lib/laser/analysis/laser_utils.rb +18 -0
- data/lib/laser/analysis/lexical_analysis.rb +172 -0
- data/lib/laser/analysis/method_call.rb +68 -0
- data/lib/laser/analysis/protocol_registry.rb +30 -0
- data/lib/laser/analysis/scope.rb +118 -0
- data/lib/laser/analysis/sexp.rb +159 -0
- data/lib/laser/analysis/sexp_analysis.rb +40 -0
- data/lib/laser/analysis/sexp_extensions/constant_extraction.rb +115 -0
- data/lib/laser/analysis/sexp_extensions/source_location.rb +164 -0
- data/lib/laser/analysis/sexp_extensions/type_inference.rb +47 -0
- data/lib/laser/analysis/signature.rb +76 -0
- data/lib/laser/analysis/special_methods/send.rb +67 -0
- data/lib/laser/analysis/unused_methods.rb +21 -0
- data/lib/laser/analysis/visitor.rb +141 -0
- data/lib/laser/annotation_parser/annotations.treetop +126 -0
- data/lib/laser/annotation_parser/annotations_parser.rb +748 -0
- data/lib/laser/annotation_parser/class_annotations.treetop +82 -0
- data/lib/laser/annotation_parser/class_annotations_parser.rb +654 -0
- data/lib/laser/annotation_parser/overload.treetop +24 -0
- data/lib/laser/annotation_parser/overload_parser.rb +167 -0
- data/lib/laser/annotation_parser/parsers.rb +6 -0
- data/lib/laser/annotation_parser/structural.treetop +37 -0
- data/lib/laser/annotation_parser/structural_parser.rb +406 -0
- data/lib/laser/annotation_parser/useful_parsers.treetop +47 -0
- data/lib/laser/annotation_parser/useful_parsers_parser.rb +674 -0
- data/lib/laser/rake/task.rb +46 -0
- data/lib/laser/runner.rb +189 -0
- data/lib/laser/scanner.rb +169 -0
- data/lib/laser/standard_library/_thread.rb +110 -0
- data/lib/laser/standard_library/abbrev.rb +103 -0
- data/lib/laser/standard_library/array.rb +418 -0
- data/lib/laser/standard_library/base64.rb +91 -0
- data/lib/laser/standard_library/basic_object.rb +55 -0
- data/lib/laser/standard_library/benchmark.rb +556 -0
- data/lib/laser/standard_library/bignum.rb +185 -0
- data/lib/laser/standard_library/cgi.rb +275 -0
- data/lib/laser/standard_library/cgi/cookie.rb +147 -0
- data/lib/laser/standard_library/cgi/core.rb +791 -0
- data/lib/laser/standard_library/cgi/html.rb +1021 -0
- data/lib/laser/standard_library/cgi/session.rb +537 -0
- data/lib/laser/standard_library/cgi/session/pstore.rb +111 -0
- data/lib/laser/standard_library/cgi/util.rb +188 -0
- data/lib/laser/standard_library/class_definitions.rb +333 -0
- data/lib/laser/standard_library/comparable.rb +125 -0
- data/lib/laser/standard_library/complex.rb +162 -0
- data/lib/laser/standard_library/enumerable.rb +178 -0
- data/lib/laser/standard_library/exceptions.rb +135 -0
- data/lib/laser/standard_library/fixnum.rb +188 -0
- data/lib/laser/standard_library/float.rb +180 -0
- data/lib/laser/standard_library/hash.rb +237 -0
- data/lib/laser/standard_library/integer.rb +123 -0
- data/lib/laser/standard_library/laser_magic.rb +7 -0
- data/lib/laser/standard_library/nil_false_true.rb +113 -0
- data/lib/laser/standard_library/numbers.rb +192 -0
- data/lib/laser/standard_library/proc.rb +31 -0
- data/lib/laser/standard_library/set.rb +1348 -0
- data/lib/laser/standard_library/string.rb +666 -0
- data/lib/laser/standard_library/stringio.rb +2 -0
- data/lib/laser/standard_library/symbol.rb +125 -0
- data/lib/laser/standard_library/tsort.rb +242 -0
- data/lib/laser/support/acts_as_struct.rb +66 -0
- data/lib/laser/support/frequency.rb +55 -0
- data/lib/laser/support/inheritable_attributes.rb +145 -0
- data/lib/laser/support/module_extensions.rb +94 -0
- data/lib/laser/support/placeholder_object.rb +13 -0
- data/lib/laser/third_party/rgl/adjacency.rb +221 -0
- data/lib/laser/third_party/rgl/base.rb +228 -0
- data/lib/laser/third_party/rgl/bidirectional.rb +39 -0
- data/lib/laser/third_party/rgl/condensation.rb +47 -0
- data/lib/laser/third_party/rgl/connected_components.rb +138 -0
- data/lib/laser/third_party/rgl/control_flow.rb +170 -0
- data/lib/laser/third_party/rgl/depth_first_spanning_tree.rb +37 -0
- data/lib/laser/third_party/rgl/dominators.rb +124 -0
- data/lib/laser/third_party/rgl/dot.rb +93 -0
- data/lib/laser/third_party/rgl/graphxml.rb +51 -0
- data/lib/laser/third_party/rgl/implicit.rb +174 -0
- data/lib/laser/third_party/rgl/mutable.rb +117 -0
- data/lib/laser/third_party/rgl/rdot.rb +445 -0
- data/lib/laser/third_party/rgl/topsort.rb +72 -0
- data/lib/laser/third_party/rgl/transitivity.rb +180 -0
- data/lib/laser/third_party/rgl/traversal.rb +348 -0
- data/lib/laser/types/types.rb +433 -0
- data/lib/laser/version.rb +14 -0
- data/lib/laser/warning.rb +149 -0
- data/lib/laser/warning_sets/default.yml +13 -0
- data/lib/laser/warnings/assignment_in_condition.rb +20 -0
- data/lib/laser/warnings/comment_spacing.rb +31 -0
- data/lib/laser/warnings/extra_blank_lines.rb +30 -0
- data/lib/laser/warnings/extra_whitespace.rb +16 -0
- data/lib/laser/warnings/hash_symbol_18_warning.rb +63 -0
- data/lib/laser/warnings/hash_symbol_19_warning.rb +29 -0
- data/lib/laser/warnings/line_length.rb +115 -0
- data/lib/laser/warnings/misaligned_unindentation.rb +17 -0
- data/lib/laser/warnings/operator_spacing.rb +68 -0
- data/lib/laser/warnings/parens_on_declaration.rb +30 -0
- data/lib/laser/warnings/rescue_exception.rb +42 -0
- data/lib/laser/warnings/semicolon.rb +25 -0
- data/lib/laser/warnings/sexp_errors.rb +24 -0
- data/lib/laser/warnings/uncalled_method_warning.rb +7 -0
- data/lib/laser/warnings/useless_double_quotes.rb +38 -0
- data/spec/analysis_specs/annotations_spec.rb +47 -0
- data/spec/analysis_specs/annotations_specs/comment_attachment_spec.rb +68 -0
- data/spec/analysis_specs/annotations_specs/node_pointers_annotation_spec.rb +90 -0
- data/spec/analysis_specs/annotations_specs/runtime_annotation_spec.rb +135 -0
- data/spec/analysis_specs/annotations_specs/spec_helper.rb +33 -0
- data/spec/analysis_specs/argument_expansion_spec.rb +113 -0
- data/spec/analysis_specs/bindings_spec.rb +36 -0
- data/spec/analysis_specs/comment_spec.rb +93 -0
- data/spec/analysis_specs/control_flow_specs/cfg_instruction_spec.rb +111 -0
- data/spec/analysis_specs/control_flow_specs/constant_propagation_spec.rb +560 -0
- data/spec/analysis_specs/control_flow_specs/control_flow_graph_spec.rb +5 -0
- data/spec/analysis_specs/control_flow_specs/raise_properties_spec.rb +310 -0
- data/spec/analysis_specs/control_flow_specs/raise_type_inference_spec.rb +301 -0
- data/spec/analysis_specs/control_flow_specs/return_type_inference_spec.rb +431 -0
- data/spec/analysis_specs/control_flow_specs/simulation_spec.rb +158 -0
- data/spec/analysis_specs/control_flow_specs/spec_helper.rb +110 -0
- data/spec/analysis_specs/control_flow_specs/tuple_misuse_inference_spec.rb +125 -0
- data/spec/analysis_specs/control_flow_specs/unreachability_analysis_spec.rb +76 -0
- data/spec/analysis_specs/control_flow_specs/unused_variable_spec.rb +99 -0
- data/spec/analysis_specs/control_flow_specs/yield_properties_spec.rb +372 -0
- data/spec/analysis_specs/error_spec.rb +30 -0
- data/spec/analysis_specs/laser_class_spec.rb +322 -0
- data/spec/analysis_specs/lexical_analysis_spec.rb +184 -0
- data/spec/analysis_specs/protocol_registry_spec.rb +63 -0
- data/spec/analysis_specs/scope_annotation_spec.rb +1013 -0
- data/spec/analysis_specs/scope_spec.rb +126 -0
- data/spec/analysis_specs/sexp_analysis_spec.rb +30 -0
- data/spec/analysis_specs/sexp_extension_specs/constant_extraction_spec.rb +309 -0
- data/spec/analysis_specs/sexp_extension_specs/source_location_spec.rb +231 -0
- data/spec/analysis_specs/sexp_extension_specs/spec_helper.rb +1 -0
- data/spec/analysis_specs/sexp_extension_specs/type_inference_spec.rb +252 -0
- data/spec/analysis_specs/sexp_spec.rb +167 -0
- data/spec/analysis_specs/spec_helper.rb +27 -0
- data/spec/analysis_specs/unused_methods_spec.rb +65 -0
- data/spec/analysis_specs/visitor_spec.rb +64 -0
- data/spec/annotation_parser_specs/annotations_parser_spec.rb +89 -0
- data/spec/annotation_parser_specs/class_annotation_parser_spec.rb +120 -0
- data/spec/annotation_parser_specs/overload_parser_spec.rb +39 -0
- data/spec/annotation_parser_specs/parsers_spec.rb +14 -0
- data/spec/annotation_parser_specs/spec_helper.rb +1 -0
- data/spec/annotation_parser_specs/structural_parser_spec.rb +67 -0
- data/spec/laser_spec.rb +14 -0
- data/spec/rake_specs/spec_helper.rb +1 -0
- data/spec/rake_specs/task_spec.rb +67 -0
- data/spec/runner_spec.rb +207 -0
- data/spec/scanner_spec.rb +75 -0
- data/spec/spec_helper.rb +121 -0
- data/spec/standard_library/exceptions_spec.rb +19 -0
- data/spec/standard_library/globals_spec.rb +14 -0
- data/spec/standard_library/set_spec.rb +31 -0
- data/spec/standard_library/spec_helper.rb +1 -0
- data/spec/standard_library/standard_library_spec.rb +302 -0
- data/spec/support_specs/acts_as_struct_spec.rb +94 -0
- data/spec/support_specs/frequency_spec.rb +23 -0
- data/spec/support_specs/module_extensions_spec.rb +117 -0
- data/spec/support_specs/spec_helper.rb +1 -0
- data/spec/type_specs/spec_helper.rb +1 -0
- data/spec/type_specs/types_spec.rb +133 -0
- data/spec/warning_spec.rb +95 -0
- data/spec/warning_specs/assignment_in_condition_spec.rb +68 -0
- data/spec/warning_specs/comment_spacing_spec.rb +65 -0
- data/spec/warning_specs/extra_blank_lines_spec.rb +70 -0
- data/spec/warning_specs/extra_whitespace_spec.rb +33 -0
- data/spec/warning_specs/hash_symbol_18_warning_spec.rb +89 -0
- data/spec/warning_specs/hash_symbol_19_warning_spec.rb +63 -0
- data/spec/warning_specs/line_length_spec.rb +173 -0
- data/spec/warning_specs/misaligned_unindentation_spec.rb +35 -0
- data/spec/warning_specs/operator_spacing_spec.rb +104 -0
- data/spec/warning_specs/parens_on_declaration_spec.rb +57 -0
- data/spec/warning_specs/rescue_exception_spec.rb +105 -0
- data/spec/warning_specs/semicolon_spec.rb +58 -0
- data/spec/warning_specs/spec_helper.rb +1 -0
- data/spec/warning_specs/useless_double_quotes_spec.rb +74 -0
- data/status_reports/2010/12/2010-12-14.md +163 -0
- data/status_reports/2010/12/2010-12-23.md +298 -0
- data/status_reports/2010/12/2010-12-24.md +6 -0
- data/test/third_party_tests/rgl_tests/TestComponents.rb +65 -0
- data/test/third_party_tests/rgl_tests/TestCycles.rb +61 -0
- data/test/third_party_tests/rgl_tests/TestDirectedGraph.rb +125 -0
- data/test/third_party_tests/rgl_tests/TestDot.rb +18 -0
- data/test/third_party_tests/rgl_tests/TestEdge.rb +34 -0
- data/test/third_party_tests/rgl_tests/TestGraph.rb +71 -0
- data/test/third_party_tests/rgl_tests/TestGraphXML.rb +57 -0
- data/test/third_party_tests/rgl_tests/TestImplicit.rb +52 -0
- data/test/third_party_tests/rgl_tests/TestRdot.rb +863 -0
- data/test/third_party_tests/rgl_tests/TestTransitivity.rb +129 -0
- data/test/third_party_tests/rgl_tests/TestTraversal.rb +220 -0
- data/test/third_party_tests/rgl_tests/TestUnDirectedGraph.rb +102 -0
- data/test/third_party_tests/rgl_tests/examples/north/Graph.log +128 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.0.graphml +28 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.1.graphml +28 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.11.graphml +31 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.12.graphml +27 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.13.graphml +27 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.14.graphml +27 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.15.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.16.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.17.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.19.graphml +37 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.2.graphml +28 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.20.graphml +38 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.22.graphml +43 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.24.graphml +30 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.25.graphml +45 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.27.graphml +38 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.28.graphml +30 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.29.graphml +38 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.3.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.30.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.31.graphml +42 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.34.graphml +42 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.37.graphml +28 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.38.graphml +38 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.39.graphml +36 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.4.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.40.graphml +37 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.41.graphml +37 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.42.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.45.graphml +28 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.46.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.5.graphml +31 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.50.graphml +30 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.56.graphml +29 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.57.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.58.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.6.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.60.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.61.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.62.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.68.graphml +30 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.69.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.7.graphml +29 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.70.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.71.graphml +27 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.72.graphml +28 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.74.graphml +29 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.75.graphml +29 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.78.graphml +27 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.79.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.8.graphml +29 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.80.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.82.graphml +35 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.83.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.85.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.86.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.88.graphml +37 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.89.graphml +29 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.9.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.90.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.91.graphml +31 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.92.graphml +26 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.93.graphml +32 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.10.94.graphml +34 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.12.8.graphml +40 -0
- data/test/third_party_tests/rgl_tests/examples/north/g.14.9.graphml +36 -0
- data/test/third_party_tests/rgl_tests/test_helper.rb +7 -0
- data/test/third_party_tests/test_inheritable_attributes.rb +187 -0
- metadata +470 -0
@@ -0,0 +1,135 @@
|
|
1
|
+
class Exception < Object
|
2
|
+
def initialize(msg=nil)
|
3
|
+
@__mesg__ = msg
|
4
|
+
@__bt__ = nil
|
5
|
+
end
|
6
|
+
def backtrace
|
7
|
+
@__bt__
|
8
|
+
end
|
9
|
+
def to_s
|
10
|
+
@__mesg__ ? (@__mesg__.to_str) : self.class.name
|
11
|
+
#@__mesg__ ? (@__mesg__.to_s rescue @__mesg__) : self.class.name
|
12
|
+
end
|
13
|
+
alias message to_s
|
14
|
+
BT_FAILURE_MESSAGE = "backtrace must be Array of String"
|
15
|
+
def __check_backtrace__(bt)
|
16
|
+
return bt if NilClass === bt
|
17
|
+
if String === bt
|
18
|
+
[bt]
|
19
|
+
elsif Array === bt
|
20
|
+
unless bt.all? { |x| String === x }
|
21
|
+
raise TypeError.new(BT_FAILURE_MESSAGE)
|
22
|
+
end
|
23
|
+
else
|
24
|
+
raise TypeError.new(BT_FAILURE_MESSAGE)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
private :__check_backtrace__
|
28
|
+
def set_backtrace(new_bt)
|
29
|
+
@__bt__ = __check_backtrace__(new_bt)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
class SystemExit < Exception
|
33
|
+
EXIT_SUCCESS = 0
|
34
|
+
def initialize(val=nil, msg=nil)
|
35
|
+
if Fixnum === val
|
36
|
+
@__status__ = val
|
37
|
+
super(msg)
|
38
|
+
else
|
39
|
+
super(val)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
def status
|
43
|
+
@__status__
|
44
|
+
end
|
45
|
+
def success?
|
46
|
+
@__status__.nil? || @__status__ == EXIT_SUCCESS
|
47
|
+
end
|
48
|
+
end
|
49
|
+
# class fatal < Exception
|
50
|
+
# end
|
51
|
+
class SignalException < Exception
|
52
|
+
end
|
53
|
+
class Interrupt < SignalException
|
54
|
+
end
|
55
|
+
class StandardError < Exception
|
56
|
+
end
|
57
|
+
class TypeError < StandardError
|
58
|
+
end
|
59
|
+
# Since TypeErrors often have specific semantic meanings, I'd rather
|
60
|
+
# use a class for each. But I have to make sure user code isn't impacted
|
61
|
+
# by this choice, so we must override #class. TypeError#=== and rescues
|
62
|
+
# will still work.
|
63
|
+
class LaserTypeErrorWrapper < TypeError
|
64
|
+
def class
|
65
|
+
TypeError
|
66
|
+
end
|
67
|
+
end
|
68
|
+
class LaserReopenedClassAsModuleError < LaserTypeErrorWrapper
|
69
|
+
end
|
70
|
+
class LaserReopenedModuleAsClassError < LaserTypeErrorWrapper
|
71
|
+
end
|
72
|
+
class LaserSuperclassMismatchError < LaserTypeErrorWrapper
|
73
|
+
end
|
74
|
+
class ArgumentError < StandardError
|
75
|
+
end
|
76
|
+
class IndexError < StandardError
|
77
|
+
end
|
78
|
+
class KeyError < IndexError
|
79
|
+
end
|
80
|
+
class RangeError < StandardError
|
81
|
+
end
|
82
|
+
class ScriptError < Exception
|
83
|
+
end
|
84
|
+
class SyntaxError < ScriptError
|
85
|
+
end
|
86
|
+
class LoadError < ScriptError
|
87
|
+
end
|
88
|
+
class NotImplementedError < ScriptError
|
89
|
+
end
|
90
|
+
class NameError < StandardError
|
91
|
+
def initialize(msg=nil, name=nil)
|
92
|
+
@__name__ = name
|
93
|
+
@__mesg__ = msg
|
94
|
+
@__bt__ = nil
|
95
|
+
end
|
96
|
+
def name
|
97
|
+
@__name__
|
98
|
+
end
|
99
|
+
end
|
100
|
+
class NoMethodError < NameError
|
101
|
+
end
|
102
|
+
class RuntimeError < StandardError
|
103
|
+
end
|
104
|
+
class SecurityError < Exception
|
105
|
+
end
|
106
|
+
class NoMemoryError < Exception
|
107
|
+
end
|
108
|
+
class EncodingError < StandardError
|
109
|
+
end
|
110
|
+
class SystemCallError < StandardError
|
111
|
+
end
|
112
|
+
class ZeroDivisionError < StandardError
|
113
|
+
end
|
114
|
+
class FloatDomainError < RangeError
|
115
|
+
end
|
116
|
+
class RegexpError < StandardError
|
117
|
+
end
|
118
|
+
class IOError < StandardError
|
119
|
+
end
|
120
|
+
class EOFError < IOError
|
121
|
+
end
|
122
|
+
class LocalJumpError < StandardError
|
123
|
+
end
|
124
|
+
class SystemStackError < Exception
|
125
|
+
end
|
126
|
+
module Math
|
127
|
+
class DomainError < StandardError
|
128
|
+
end
|
129
|
+
end
|
130
|
+
class StopIteration < IndexError
|
131
|
+
end
|
132
|
+
class ThreadError < StandardError
|
133
|
+
end
|
134
|
+
class FiberError < StandardError
|
135
|
+
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
class Fixnum < Integer
|
2
|
+
# pure: true
|
3
|
+
# builtin: true
|
4
|
+
# returns: Fixnum= | Bignum=
|
5
|
+
def %(num)
|
6
|
+
end
|
7
|
+
# pure: true
|
8
|
+
# builtin: true
|
9
|
+
# returns: Fixnum= | Bignum=
|
10
|
+
def &(num)
|
11
|
+
end
|
12
|
+
# pure: true
|
13
|
+
# builtin: true
|
14
|
+
# overload: (Float) -> Float=
|
15
|
+
# overload: (Fixnum) -> Fixnum= | Bignum=
|
16
|
+
# overload: (Bignum) -> Fixnum= | Bignum=
|
17
|
+
# raises: never
|
18
|
+
def *(num)
|
19
|
+
end
|
20
|
+
# pure: true
|
21
|
+
# builtin: true
|
22
|
+
# overload: (Float) -> Float=
|
23
|
+
# overload: (Fixnum) -> Fixnum= | Bignum=
|
24
|
+
# overload: (Bignum) -> Fixnum= | Bignum=
|
25
|
+
def **(num)
|
26
|
+
end
|
27
|
+
# pure: true
|
28
|
+
# builtin: true
|
29
|
+
def +(num)
|
30
|
+
end
|
31
|
+
# pure: true
|
32
|
+
# builtin: true
|
33
|
+
# overload: (Float) -> Float=
|
34
|
+
# overload: (Fixnum) -> Fixnum= | Bignum=
|
35
|
+
# overload: (Bignum) -> Fixnum= | Bignum=
|
36
|
+
def -(num)
|
37
|
+
end
|
38
|
+
# pure: true
|
39
|
+
# builtin: true
|
40
|
+
# returns: Fixnum= | Bignum=
|
41
|
+
# raises: never
|
42
|
+
def -@
|
43
|
+
end
|
44
|
+
# pure: true
|
45
|
+
# builtin: true
|
46
|
+
def /(num)
|
47
|
+
end
|
48
|
+
# pure: true
|
49
|
+
# builtin: true
|
50
|
+
# returns: Boolean
|
51
|
+
# num: Numeric
|
52
|
+
# raises: never
|
53
|
+
def <(num)
|
54
|
+
end
|
55
|
+
# pure: true
|
56
|
+
# builtin: true
|
57
|
+
# returns: Fixnum= | Bignum=
|
58
|
+
def <<(amt)
|
59
|
+
end
|
60
|
+
# pure: true
|
61
|
+
# builtin: true
|
62
|
+
# returns: Boolean
|
63
|
+
def <=(num)
|
64
|
+
end
|
65
|
+
# pure: true
|
66
|
+
# builtin: true
|
67
|
+
def <=>(num)
|
68
|
+
end
|
69
|
+
# pure: true
|
70
|
+
# builtin: true
|
71
|
+
# returns: Boolean
|
72
|
+
def ==(num)
|
73
|
+
end
|
74
|
+
# pure: true
|
75
|
+
# builtin: true
|
76
|
+
# returns: Boolean
|
77
|
+
def ===(num)
|
78
|
+
end
|
79
|
+
# pure: true
|
80
|
+
# builtin: true
|
81
|
+
# returns: Boolean
|
82
|
+
# num: Numeric
|
83
|
+
# raises: never
|
84
|
+
def >(num)
|
85
|
+
end
|
86
|
+
# pure: true
|
87
|
+
# builtin: true
|
88
|
+
# returns: Boolean
|
89
|
+
def >=(num)
|
90
|
+
end
|
91
|
+
# pure: true
|
92
|
+
# builtin: true
|
93
|
+
# returns: Fixnum= | Bignum=
|
94
|
+
def >>(num)
|
95
|
+
end
|
96
|
+
# pure: true
|
97
|
+
# builtin: true
|
98
|
+
# returns: Fixnum= | Bignum=
|
99
|
+
def [](bit)
|
100
|
+
end
|
101
|
+
# pure: true
|
102
|
+
# builtin: true
|
103
|
+
# returns: Fixnum= | Bignum=
|
104
|
+
def ^(num)
|
105
|
+
end
|
106
|
+
# pure: true
|
107
|
+
# builtin: true
|
108
|
+
# returns: Fixnum= | Bignum=
|
109
|
+
# raises: never
|
110
|
+
def abs
|
111
|
+
end
|
112
|
+
# pure: true
|
113
|
+
# builtin: true
|
114
|
+
# returns: Fixnum= | Bignum=
|
115
|
+
def div(other)
|
116
|
+
end
|
117
|
+
# pure: true
|
118
|
+
# builtin: true
|
119
|
+
def divmod(other)
|
120
|
+
end
|
121
|
+
# pure: true
|
122
|
+
# builtin: true
|
123
|
+
# returns: Boolean
|
124
|
+
# raises: never
|
125
|
+
def even?
|
126
|
+
end
|
127
|
+
# pure: true
|
128
|
+
# builtin: true
|
129
|
+
def fdiv(num)
|
130
|
+
end
|
131
|
+
# pure: true
|
132
|
+
# builtin: true
|
133
|
+
# returns: Fixnum= | Bignum=
|
134
|
+
# raises: never
|
135
|
+
def magnitude
|
136
|
+
end
|
137
|
+
# pure: true
|
138
|
+
# builtin: true
|
139
|
+
def modulo(num)
|
140
|
+
end
|
141
|
+
# pure: true
|
142
|
+
# builtin: true
|
143
|
+
# returns: Boolean
|
144
|
+
# raises: never
|
145
|
+
def odd?
|
146
|
+
end
|
147
|
+
# pure: true
|
148
|
+
# builtin: true
|
149
|
+
# returns: Fixnum= | Bignum=
|
150
|
+
# raises: never
|
151
|
+
def size
|
152
|
+
end
|
153
|
+
# pure: true
|
154
|
+
# builtin: true
|
155
|
+
# returns: Fixnum= | Bignum=
|
156
|
+
# raises: never
|
157
|
+
def succ
|
158
|
+
end
|
159
|
+
# pure: true
|
160
|
+
# builtin: true
|
161
|
+
# returns: Float
|
162
|
+
# raises: never
|
163
|
+
def to_f
|
164
|
+
end
|
165
|
+
# pure: true
|
166
|
+
# builtin: true
|
167
|
+
# returns: String
|
168
|
+
# raises: never
|
169
|
+
def to_s
|
170
|
+
end
|
171
|
+
# pure: true
|
172
|
+
# builtin: true
|
173
|
+
# returns: Boolean
|
174
|
+
# raises: never
|
175
|
+
def zero?
|
176
|
+
end
|
177
|
+
# pure: true
|
178
|
+
# builtin: true
|
179
|
+
# returns: Fixnum= | Bignum=
|
180
|
+
def |(num)
|
181
|
+
end
|
182
|
+
# pure: true
|
183
|
+
# builtin: true
|
184
|
+
# returns: Fixnum= | Bignum=
|
185
|
+
# raises: never
|
186
|
+
def ~
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
class Float < Numeric
|
2
|
+
# pure: true
|
3
|
+
# builtin: true
|
4
|
+
def %(other)
|
5
|
+
end
|
6
|
+
# pure: true
|
7
|
+
# builtin: true
|
8
|
+
# overload: (Float) -> Float=
|
9
|
+
# overload: (Fixnum) -> Float=
|
10
|
+
# overload: (Bignum) -> Float=
|
11
|
+
def *(other)
|
12
|
+
end
|
13
|
+
# pure: true
|
14
|
+
# builtin: true
|
15
|
+
def **(other)
|
16
|
+
end
|
17
|
+
# pure: true
|
18
|
+
# builtin: true
|
19
|
+
def +(other)
|
20
|
+
end
|
21
|
+
# pure: true
|
22
|
+
# builtin: true
|
23
|
+
def -(other)
|
24
|
+
end
|
25
|
+
# pure: true
|
26
|
+
# builtin: true
|
27
|
+
def -@
|
28
|
+
end
|
29
|
+
# pure: true
|
30
|
+
# builtin: true
|
31
|
+
def /(other)
|
32
|
+
end
|
33
|
+
# pure: true
|
34
|
+
# builtin: true
|
35
|
+
def <(other)
|
36
|
+
end
|
37
|
+
# pure: true
|
38
|
+
# builtin: true
|
39
|
+
def <=(other)
|
40
|
+
end
|
41
|
+
# pure: true
|
42
|
+
# builtin: true
|
43
|
+
def <=>(other)
|
44
|
+
end
|
45
|
+
# pure: true
|
46
|
+
# builtin: true
|
47
|
+
# returns: Boolean
|
48
|
+
def ==(other)
|
49
|
+
end
|
50
|
+
# pure: true
|
51
|
+
# builtin: true
|
52
|
+
# returns: Boolean
|
53
|
+
def ===(other)
|
54
|
+
end
|
55
|
+
# pure: true
|
56
|
+
# builtin: true
|
57
|
+
def >(other)
|
58
|
+
end
|
59
|
+
# pure: true
|
60
|
+
# builtin: true
|
61
|
+
def >=(other)
|
62
|
+
end
|
63
|
+
# pure: true
|
64
|
+
# builtin: true
|
65
|
+
def abs
|
66
|
+
end
|
67
|
+
# pure: true
|
68
|
+
# builtin: true
|
69
|
+
def angle
|
70
|
+
end
|
71
|
+
# pure: true
|
72
|
+
# builtin: true
|
73
|
+
def arg
|
74
|
+
end
|
75
|
+
# pure: true
|
76
|
+
# builtin: true
|
77
|
+
def ceil
|
78
|
+
end
|
79
|
+
# pure: true
|
80
|
+
# builtin: true
|
81
|
+
def coerce(other)
|
82
|
+
end
|
83
|
+
# pure: true
|
84
|
+
# builtin: true
|
85
|
+
def denominator
|
86
|
+
end
|
87
|
+
# pure: true
|
88
|
+
# builtin: true
|
89
|
+
def divmod(other)
|
90
|
+
end
|
91
|
+
# pure: true
|
92
|
+
# builtin: true
|
93
|
+
def eql?(other)
|
94
|
+
end
|
95
|
+
# pure: true
|
96
|
+
# builtin: true
|
97
|
+
def fdiv
|
98
|
+
end
|
99
|
+
# pure: true
|
100
|
+
# builtin: true
|
101
|
+
def finite?
|
102
|
+
end
|
103
|
+
# pure: true
|
104
|
+
# builtin: true
|
105
|
+
def floor
|
106
|
+
end
|
107
|
+
# pure: true
|
108
|
+
# builtin: true
|
109
|
+
def hash
|
110
|
+
end
|
111
|
+
# pure: true
|
112
|
+
# builtin: true
|
113
|
+
def infinite?
|
114
|
+
end
|
115
|
+
# pure: true
|
116
|
+
# builtin: true
|
117
|
+
def magnitude
|
118
|
+
end
|
119
|
+
# pure: true
|
120
|
+
# builtin: true
|
121
|
+
def modulo(other)
|
122
|
+
end
|
123
|
+
# pure: true
|
124
|
+
# builtin: true
|
125
|
+
def nan?
|
126
|
+
end
|
127
|
+
# pure: true
|
128
|
+
# builtin: true
|
129
|
+
def numerator
|
130
|
+
end
|
131
|
+
# pure: true
|
132
|
+
# builtin: true
|
133
|
+
def phase
|
134
|
+
end
|
135
|
+
# pure: true
|
136
|
+
# builtin: true
|
137
|
+
def quo(other)
|
138
|
+
end
|
139
|
+
# pure: true
|
140
|
+
# builtin: true
|
141
|
+
def rationalize(eps = :__unset__)
|
142
|
+
end
|
143
|
+
# pure: true
|
144
|
+
# builtin: true
|
145
|
+
def round(ndigits=0)
|
146
|
+
end
|
147
|
+
# pure: true
|
148
|
+
# builtin: true
|
149
|
+
def to_f
|
150
|
+
end
|
151
|
+
# pure: true
|
152
|
+
# builtin: true
|
153
|
+
def to_i
|
154
|
+
end
|
155
|
+
# pure: true
|
156
|
+
# builtin: true
|
157
|
+
def to_int
|
158
|
+
end
|
159
|
+
# pure: true
|
160
|
+
# builtin: true
|
161
|
+
def to_r
|
162
|
+
end
|
163
|
+
# pure: true
|
164
|
+
# builtin: true
|
165
|
+
# returns: String=
|
166
|
+
def to_s
|
167
|
+
end
|
168
|
+
# pure: true
|
169
|
+
# builtin: true
|
170
|
+
def to_yaml
|
171
|
+
end
|
172
|
+
# pure: true
|
173
|
+
# builtin: true
|
174
|
+
def truncate
|
175
|
+
end
|
176
|
+
# pure: true
|
177
|
+
# builtin: true
|
178
|
+
def zero?
|
179
|
+
end
|
180
|
+
end
|