kuniri 0.0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +9 -7
- data/COPYING +160 -656
- data/Gemfile +4 -3
- data/README.md +57 -27
- data/Rakefile +3 -1
- data/bin/kuniri +50 -26
- data/data/aggregation_lang.rb +33 -0
- data/data/attribute_lang.rb +14 -87
- data/data/class_lang.rb +19 -41
- data/data/comment_lang.rb +52 -0
- data/data/conditional_lang.rb +14 -41
- data/data/constructor_lang.rb +4 -12
- data/data/end_block_lang.rb +7 -6
- data/data/extern_requirement_lang.rb +10 -17
- data/data/function_behavior_lang.rb +17 -66
- data/data/global_function_lang.rb +26 -0
- data/data/lang_syntax.rb +82 -49
- data/data/method_lang.rb +26 -0
- data/data/module_namespace_lang.rb +8 -13
- data/data/repetition_lang.rb +19 -32
- data/data/token_lang.rb +2 -44
- data/data/variable_behaviour_lang.rb +43 -0
- data/data/variable_global_lang.rb +13 -72
- data/kuniri.gemspec +4 -4
- data/lib/kuniri/core/configuration/language_available.rb +2 -2
- data/lib/kuniri/core/kuniri.rb +32 -24
- data/lib/kuniri/core/setting.rb +51 -85
- data/lib/kuniri/error/parser_error.rb +9 -0
- data/lib/kuniri/language/abstract_container/structured_and_oo/aggregation.rb +29 -0
- data/lib/kuniri/language/abstract_container/structured_and_oo/attribute.rb +0 -40
- data/lib/kuniri/language/abstract_container/structured_and_oo/global_tokens.rb +20 -0
- data/lib/kuniri/language/abstract_container/structured_and_oo/repetition.rb +9 -1
- data/lib/kuniri/language/abstract_container/structured_and_oo/variable_global.rb +0 -35
- data/lib/kuniri/language/container_data/structured_and_oo/aggregation_data.rb +23 -0
- data/lib/kuniri/language/container_data/structured_and_oo/attribute_data.rb +4 -2
- data/lib/kuniri/language/container_data/structured_and_oo/basic_structure.rb +24 -0
- data/lib/kuniri/language/container_data/structured_and_oo/class_data.rb +13 -19
- data/lib/kuniri/language/container_data/structured_and_oo/conditional_data.rb +2 -13
- data/lib/kuniri/language/container_data/structured_and_oo/constructor_data.rb +2 -0
- data/lib/kuniri/language/container_data/structured_and_oo/extern_requirement_data.rb +11 -6
- data/lib/kuniri/language/container_data/structured_and_oo/{file_element.rb → file_element_data.rb} +11 -9
- data/lib/kuniri/language/container_data/structured_and_oo/function_abstract.rb +58 -11
- data/lib/kuniri/language/container_data/structured_and_oo/function_data.rb +3 -3
- data/lib/kuniri/language/container_data/structured_and_oo/manager_basic_structure_data.rb +55 -0
- data/lib/kuniri/language/container_data/structured_and_oo/method_data.rb +5 -4
- data/lib/kuniri/language/container_data/structured_and_oo/module_namespace_data.rb +3 -1
- data/lib/kuniri/language/container_data/structured_and_oo/repetition_data.rb +2 -13
- data/lib/kuniri/language/container_data/structured_and_oo/variable_global_data.rb +2 -0
- data/lib/kuniri/language/language.rb +37 -11
- data/lib/kuniri/language/metadata.rb +29 -0
- data/lib/kuniri/language/ruby/aggregation_ruby.rb +37 -0
- data/lib/kuniri/language/ruby/attribute_ruby.rb +23 -38
- data/lib/kuniri/language/ruby/class_ruby.rb +2 -10
- data/lib/kuniri/language/ruby/conditional_ruby.rb +20 -6
- data/lib/kuniri/language/ruby/constructor_ruby.rb +5 -7
- data/lib/kuniri/language/ruby/end_block_ruby.rb +1 -1
- data/lib/kuniri/language/ruby/function_behavior_ruby.rb +1 -9
- data/lib/kuniri/language/ruby/global_function_ruby.rb +32 -0
- data/lib/kuniri/language/ruby/method_ruby.rb +33 -0
- data/lib/kuniri/language/ruby/repetition_ruby.rb +60 -14
- data/lib/kuniri/language/ruby/ruby_syntax.rb +76 -49
- data/lib/kuniri/parser/output_factory.rb +29 -0
- data/lib/kuniri/parser/output_format.rb +134 -0
- data/lib/kuniri/parser/parser.rb +3 -7
- data/lib/kuniri/parser/xml_builder_engine.rb +94 -0
- data/lib/kuniri/parser/xml_output_format.rb +143 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/aggregation_state.rb +45 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb +0 -1
- data/lib/kuniri/state_machine/OO_structured_fsm/basic_structure_state.rb +182 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/class_state.rb +12 -3
- data/lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb +11 -68
- data/lib/kuniri/state_machine/OO_structured_fsm/constructor_state.rb +7 -52
- data/lib/kuniri/state_machine/OO_structured_fsm/function_behaviour_state.rb +86 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/include_state.rb +2 -3
- data/lib/kuniri/state_machine/OO_structured_fsm/method_state.rb +8 -50
- data/lib/kuniri/state_machine/OO_structured_fsm/oo_structured_state.rb +6 -1
- data/lib/kuniri/state_machine/OO_structured_fsm/repetition_state.rb +10 -59
- data/lib/kuniri/state_machine/OO_structured_fsm/token_state_machine.rb +4 -0
- data/lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb +0 -1
- data/lib/kuniri/version.rb +1 -1
- data/other/analyseFile.asta +0 -0
- data/spec/core/kuniri_spec.rb +2 -1
- data/spec/core/setting_spec.rb +35 -61
- data/spec/language/abstract_container/aggregation_spec.rb +13 -0
- data/spec/language/abstract_container/extern_requirement_spec.rb +13 -0
- data/spec/language/container_data/structured_and_oo/aggregation_data_spec.rb +29 -0
- data/spec/language/container_data/structured_and_oo/attribute_data_spec.rb +9 -2
- data/spec/language/container_data/structured_and_oo/class_data_spec.rb +1 -46
- data/spec/language/container_data/structured_and_oo/constructor_data_spec.rb +32 -2
- data/spec/language/container_data/structured_and_oo/extern_requirement_data_spec.rb +31 -7
- data/spec/language/container_data/structured_and_oo/{file_element_spec.rb → file_element_data_spec.rb} +21 -5
- data/spec/language/container_data/structured_and_oo/function_abstract_spec.rb +213 -0
- data/spec/language/container_data/structured_and_oo/function_data_spec.rb +31 -2
- data/spec/language/container_data/structured_and_oo/manager_basic_structure_data_spec.rb +150 -0
- data/spec/language/container_data/structured_and_oo/method_data_spec.rb +80 -0
- data/spec/language/container_data/structured_and_oo/module_namespace_spec.rb +7 -1
- data/spec/language/container_data/structured_and_oo/variable_global_data_spec.rb +9 -0
- data/spec/language/language_factory_spec.rb +1 -1
- data/spec/language/language_spec.rb +46 -9
- data/spec/language/ruby/aggregation_ruby_spec.rb +80 -0
- data/spec/language/ruby/class_ruby_spec.rb +66 -6
- data/spec/language/ruby/constructor_ruby_spec.rb +1 -1
- data/spec/language/ruby/end_block_ruby_spec.rb +11 -0
- data/spec/language/ruby/extern_requirement_ruby_spec.rb +59 -0
- data/spec/language/ruby/function_behavior_ruby_spec.rb +54 -2
- data/spec/language/ruby/global_test/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/complete_class_ruby_spec.rb +161 -0
- data/spec/language/ruby/global_test/conditional/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri1.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri2.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri3.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri4.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri5.yml +4 -0
- data/spec/language/ruby/global_test/conditional/.kuniri6.yml +4 -0
- data/spec/language/ruby/global_test/conditional/a_lot_of_conditionals_spec.rb +92 -0
- data/spec/language/ruby/global_test/conditional/constructor_very_mix_conditional_spec.rb +105 -0
- data/spec/language/ruby/global_test/conditional/function_with_conditional_spec.rb +94 -0
- data/spec/language/ruby/global_test/conditional/function_with_nested_conditional_spec.rb +56 -0
- data/spec/language/ruby/global_test/conditional/method_very_mix_conditional_spec.rb +109 -0
- data/spec/language/ruby/global_test/conditional/very_deep_conditional_structure_spec.rb +61 -0
- data/spec/language/ruby/global_test/conditional/very_mix_conditional_spec.rb +105 -0
- data/spec/language/ruby/global_test/conditionalAndRepetition/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/conditionalAndRepetition/mix_conditional_repetition_spec.rb +57 -0
- data/spec/language/ruby/global_test/repetition/.kuniri.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri2.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri3.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri4.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri5.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri6.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri7.yml +4 -0
- data/spec/language/ruby/global_test/repetition/.kuniri8.yml +4 -0
- data/spec/language/ruby/global_test/repetition/complete_class_integrity.rb +41 -0
- data/spec/language/ruby/global_test/repetition/complete_class_until_loop_spec.rb +42 -0
- data/spec/language/ruby/global_test/repetition/complete_class_while_loop_spec.rb +41 -0
- data/spec/language/ruby/global_test/repetition/complete_class_with_repetition_spec.rb +42 -0
- data/spec/language/ruby/global_test/repetition/constructor_with_mix_repetition_spec.rb +57 -0
- data/spec/language/ruby/global_test/repetition/method_with_mix_repetition_spec.rb +59 -0
- data/spec/language/ruby/global_test/repetition/very_mix_repetition_spec.rb +61 -0
- data/spec/language/ruby/global_test/repetition/very_nested_repetition_spec.rb +65 -0
- data/spec/language/ruby/method_ruby_spec.rb +52 -0
- data/spec/language/ruby/repetition_ruby_spec.rb +175 -8
- data/spec/language/ruby/ruby_syntax_spec.rb +213 -84
- data/spec/parser/output_factory_spec.rb +32 -0
- data/spec/parser/output_format_spec.rb +83 -0
- data/spec/parser/parser_spec.rb +7 -0
- data/spec/parser/xmlSchemaValidate/.kuniri1.yml +3 -0
- data/spec/parser/xmlSchemaValidate/.kuniri2.yml +3 -0
- data/spec/parser/xmlSchemaValidate/.kuniri3.yml +3 -0
- data/spec/parser/xmlSchemaValidate/class_data.xsd +99 -0
- data/spec/parser/xmlSchemaValidate/fullCodeTwo.xsd +119 -0
- data/spec/parser/xmlSchemaValidate/fullCodeWithComments.xsd +146 -0
- data/spec/parser/xmlSchemaValidate/simpleFunction.xsd +25 -0
- data/spec/parser/xmlSchemaValidate/validate_xml_spec.rb +52 -0
- data/spec/parser/xml_builder_engine_spec.rb +258 -0
- data/spec/parser/xml_output_format_spec.rb +274 -0
- data/spec/samples/rubySyntaxParts/aggregation/classAggregation.rb +37 -0
- data/spec/samples/rubySyntaxParts/aggregation/constructorAggregation.rb +36 -0
- data/spec/samples/rubySyntaxParts/aggregation/methodAggregation.rb +36 -0
- data/spec/samples/rubySyntaxParts/aggregation/multipleAggregation.rb +59 -0
- data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_class.rb +7 -0
- data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_class.rb +2 -1
- data/spec/samples/rubySyntaxParts/conditionalStatment/aLotOfConditionals.rb +42 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/commonCasesOfConditionals.rb +47 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/constructorConditional.rb +1 -1
- data/spec/samples/rubySyntaxParts/conditionalStatment/constructorMixConditional.rb +41 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/methodMixConditional.rb +41 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/mixConditionalWithRepetition.rb +20 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/nestedConditional.rb +61 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/veryDeepConditionalStructure.rb +48 -0
- data/spec/samples/rubySyntaxParts/conditionalStatment/veryMixConditional.rb +37 -0
- data/spec/samples/rubySyntaxParts/fullCode/fullCodeTwo.rb +56 -0
- data/spec/samples/rubySyntaxParts/fullCode/fullCodeWithComments.rb +64 -0
- data/spec/samples/rubySyntaxParts/fullCode/simpleFullCode.rb +9 -1
- data/spec/samples/rubySyntaxParts/method/simpleMethod.rb +2 -0
- data/spec/samples/rubySyntaxParts/repetition/beginWithWhileLoopInClass.rb +10 -0
- data/spec/samples/rubySyntaxParts/repetition/constructorWithMixRepetition.rb +22 -0
- data/spec/samples/rubySyntaxParts/repetition/forLoopInClass.rb +7 -0
- data/spec/samples/rubySyntaxParts/repetition/methodWithMixRepetition.rb +19 -0
- data/spec/samples/rubySyntaxParts/repetition/mixConditionalRepetition.rb +17 -0
- data/spec/samples/rubySyntaxParts/repetition/untilLoopInClass.rb +16 -0
- data/spec/samples/rubySyntaxParts/repetition/veryMixRepetition.rb +28 -0
- data/spec/samples/rubySyntaxParts/repetition/veryNestedRepetition.rb +17 -0
- data/spec/samples/rubySyntaxParts/repetition/whileLoopInClass.rb +12 -0
- data/spec/state_machine/OO_structured_fsm/aggregation_state_spec.rb +67 -0
- data/spec/state_machine/OO_structured_fsm/class_state_spec.rb +15 -0
- data/spec/state_machine/OO_structured_fsm/conditional_state_spec.rb +64 -0
- data/spec/state_machine/OO_structured_fsm/include_state_spec.rb +3 -3
- data/spec/state_machine/OO_structured_fsm/method_state_spec.rb +18 -0
- data/spec/state_machine/OO_structured_fsm/repetition_state_spec.rb +27 -0
- metadata +195 -28
- data/lib/kuniri/core/configuration/monitor_available.rb +0 -13
- data/lib/kuniri/language/abstract_container/structured_and_oo/constructor.rb +0 -52
- data/lib/kuniri/parser/parser_xml.rb +0 -128
- data/spec/language/abstract_container/constructor_spec.rb +0 -13
- data/spec/util/html_logger_spec.rb +0 -31
- data/spec/util/logger_spec.rb +0 -20
- data/spec/util/txt_logger_spec.rb +0 -31
@@ -0,0 +1,37 @@
|
|
1
|
+
class Class1
|
2
|
+
|
3
|
+
attr_accessor :value
|
4
|
+
|
5
|
+
def initialize(value)
|
6
|
+
@value = value
|
7
|
+
end
|
8
|
+
|
9
|
+
def print_value()
|
10
|
+
puts @value
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class Class2
|
16
|
+
|
17
|
+
def initialize()
|
18
|
+
@value = 10
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class Class3
|
24
|
+
|
25
|
+
attr_accessor :class1, :class2
|
26
|
+
|
27
|
+
@class1 = Class1.new(10)
|
28
|
+
@class2 = Class2 . new 10
|
29
|
+
|
30
|
+
def initialize()
|
31
|
+
end
|
32
|
+
|
33
|
+
def print_value
|
34
|
+
puts @class.print_value()
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Foo
|
2
|
+
|
3
|
+
attr_accessor :value
|
4
|
+
|
5
|
+
def initialize()
|
6
|
+
@value = 10
|
7
|
+
end
|
8
|
+
|
9
|
+
def print_value()
|
10
|
+
puts @value
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class Blah
|
16
|
+
|
17
|
+
def initialize()
|
18
|
+
@value = 20
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class Bar
|
24
|
+
|
25
|
+
attr_accessor :foo1, :foo2
|
26
|
+
|
27
|
+
def initialize()
|
28
|
+
@foo1 = Foo.new
|
29
|
+
@foo2 = Blah .new
|
30
|
+
end
|
31
|
+
|
32
|
+
def print_value
|
33
|
+
puts @foo.print_value()
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class Test1
|
2
|
+
|
3
|
+
attr_accessor :value
|
4
|
+
|
5
|
+
def initialize(value)
|
6
|
+
@value = value
|
7
|
+
end
|
8
|
+
|
9
|
+
def print_value()
|
10
|
+
puts @value
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class Test2
|
16
|
+
|
17
|
+
def initialize()
|
18
|
+
@value = 10
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
class Test2
|
24
|
+
|
25
|
+
attr_accessor :test1, :test2
|
26
|
+
|
27
|
+
def initialize()
|
28
|
+
end
|
29
|
+
|
30
|
+
def print_value
|
31
|
+
@test1 = Test1.new(10)
|
32
|
+
@test2 = Test2 . new 10
|
33
|
+
puts @test.print_value()
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
class Class1
|
4
|
+
|
5
|
+
attr_accessor :value
|
6
|
+
|
7
|
+
def initialize(value)
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
def print_value()
|
12
|
+
puts @value
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
class Class2
|
18
|
+
|
19
|
+
def initialize()
|
20
|
+
@value = 10
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
class Class3
|
26
|
+
|
27
|
+
def initialize(value)
|
28
|
+
@value = value
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
class Class4
|
34
|
+
|
35
|
+
def initialize(value)
|
36
|
+
@value = value
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
class Class5
|
42
|
+
|
43
|
+
attr_accessor :class1, :class2, :class3, :class4, :class5, :class6
|
44
|
+
|
45
|
+
@class1 = Class1.new(10)
|
46
|
+
@class2 = Class2 . new
|
47
|
+
|
48
|
+
def initialize()
|
49
|
+
@class3 = Class3.new(20)
|
50
|
+
@class4 = Array.new
|
51
|
+
@class5 = Set.new
|
52
|
+
@class6 = Class1.new
|
53
|
+
end
|
54
|
+
|
55
|
+
def print_value
|
56
|
+
puts @class.print_value()
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
def aLotOfConditionals
|
2
|
+
if conditional1 == "level0"
|
3
|
+
y = 12
|
4
|
+
if conditional2 == "level1"
|
5
|
+
puts "wtf?"
|
6
|
+
end
|
7
|
+
unless conditional3 == "level1"
|
8
|
+
puts "yes"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
if xpto == "level0"
|
13
|
+
puts "no"
|
14
|
+
elsif abc == "level0"
|
15
|
+
puts "yes"
|
16
|
+
elsif banana == "level0"
|
17
|
+
puts "banana"
|
18
|
+
if abc == "level1"
|
19
|
+
puts "abc"
|
20
|
+
unless moreAndMore == "level2"
|
21
|
+
puts "unlesssss"
|
22
|
+
end
|
23
|
+
elsif asdf == "level1"
|
24
|
+
puts "1234567"
|
25
|
+
else
|
26
|
+
puts "abc"
|
27
|
+
end
|
28
|
+
else
|
29
|
+
case p
|
30
|
+
when 2
|
31
|
+
x = 3
|
32
|
+
when 4
|
33
|
+
y = 12
|
34
|
+
when 7
|
35
|
+
k = 9
|
36
|
+
else
|
37
|
+
u = 8
|
38
|
+
end
|
39
|
+
puts "Else"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
def simple_conditional
|
2
|
+
if x == 99
|
3
|
+
puts "ahhh"
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
def simple_conditional_with_else
|
8
|
+
if x == 47
|
9
|
+
puts "hummm"
|
10
|
+
else
|
11
|
+
puts "aaaa"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def simple_conditional_with_elsif
|
16
|
+
if x == 555
|
17
|
+
puts "ufa"
|
18
|
+
elsif x == 777
|
19
|
+
puts "noooo"
|
20
|
+
elsif x == 111
|
21
|
+
puts "jaule"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def simple_conditional_with_elsif_else
|
26
|
+
if xpto == 778
|
27
|
+
puts "neeee"
|
28
|
+
elsif abc == 555
|
29
|
+
puts "nuuuu"
|
30
|
+
elsif asdf == 'a'
|
31
|
+
puts "pooooo"
|
32
|
+
else
|
33
|
+
puts "o/"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def case_conditional
|
38
|
+
case xpto
|
39
|
+
when 1
|
40
|
+
k = 12
|
41
|
+
when 2
|
42
|
+
k = 14
|
43
|
+
else
|
44
|
+
k = 0
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class ConstructorWithMixConditional
|
2
|
+
|
3
|
+
def initialize
|
4
|
+
case p
|
5
|
+
when 2
|
6
|
+
if xpto == "level1"
|
7
|
+
puts "ayhh"
|
8
|
+
else
|
9
|
+
puts "ooooo"
|
10
|
+
end
|
11
|
+
when 4
|
12
|
+
if xpto1 == "level1"
|
13
|
+
if xpto2 == "level2"
|
14
|
+
if xpto3 == "level3"
|
15
|
+
puts "xpto"
|
16
|
+
elsif abc == "level3"
|
17
|
+
puts "abc"
|
18
|
+
else
|
19
|
+
puts "llll"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
elsif banana == "level1"
|
23
|
+
puts "banana"
|
24
|
+
end
|
25
|
+
when 7
|
26
|
+
unless abc == "level1"
|
27
|
+
if xpto == "level2"
|
28
|
+
case x
|
29
|
+
when 6
|
30
|
+
puts "6"
|
31
|
+
when 7
|
32
|
+
puts "7"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
37
|
+
u = 8
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
class MethodWithMixConditional
|
2
|
+
|
3
|
+
def methodTest
|
4
|
+
case p
|
5
|
+
when 2
|
6
|
+
if xpto == "level1"
|
7
|
+
puts "ayhh"
|
8
|
+
else
|
9
|
+
puts "ooooo"
|
10
|
+
end
|
11
|
+
when 4
|
12
|
+
if xpto1 == "level1"
|
13
|
+
if xpto2 == "level2"
|
14
|
+
if xpto3 == "level3"
|
15
|
+
puts "xpto"
|
16
|
+
elsif abc == "level3"
|
17
|
+
puts "abc"
|
18
|
+
else
|
19
|
+
puts "llll"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
elsif banana == "level1"
|
23
|
+
puts "banana"
|
24
|
+
end
|
25
|
+
when 7
|
26
|
+
unless abc == "level1"
|
27
|
+
if xpto == "level2"
|
28
|
+
case x
|
29
|
+
when 6
|
30
|
+
puts "6"
|
31
|
+
when 7
|
32
|
+
puts "7"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
else
|
37
|
+
u = 8
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
def simple_nested_with_repetition
|
2
|
+
if xpto == 'a'
|
3
|
+
y = 2
|
4
|
+
while true
|
5
|
+
if y < 10
|
6
|
+
puts "ahhh"
|
7
|
+
end
|
8
|
+
end
|
9
|
+
elsif xpto == 'b'
|
10
|
+
puts "noooo"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def simple_repetition_with_conditional
|
15
|
+
while true
|
16
|
+
if k == "k"
|
17
|
+
k = 'y'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
def nested_conditional
|
2
|
+
if xpto == "level0"
|
3
|
+
y = 12
|
4
|
+
if abc == "level1"
|
5
|
+
puts "wtf?"
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
if xyz == "level0"
|
10
|
+
k = "bla"
|
11
|
+
if abc == "level1"
|
12
|
+
u = "u"
|
13
|
+
else
|
14
|
+
u = "k"
|
15
|
+
end
|
16
|
+
else
|
17
|
+
u = 77
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def deeply_nested_conditional
|
22
|
+
if xpto == "level0"
|
23
|
+
k = 55
|
24
|
+
if abc == "level1"
|
25
|
+
k = 51
|
26
|
+
elsif jkl == "level1"
|
27
|
+
k = 200
|
28
|
+
else
|
29
|
+
k = 0
|
30
|
+
end
|
31
|
+
elsif xpto == "level0"
|
32
|
+
if plus == "level1"
|
33
|
+
k = 98
|
34
|
+
if myGod == "level2"
|
35
|
+
k = 1
|
36
|
+
elsif myGodd == "level2"
|
37
|
+
k = 2
|
38
|
+
end
|
39
|
+
end
|
40
|
+
elsif godHelp == "level0"
|
41
|
+
if lala == "level1"
|
42
|
+
k = 'a'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def very_nested_conditional
|
48
|
+
if xpto == "level0"
|
49
|
+
if abc == "level1"
|
50
|
+
if xyz == "level2"
|
51
|
+
if arroba == "level3"
|
52
|
+
puts "Finally"
|
53
|
+
else
|
54
|
+
puts "almost..."
|
55
|
+
end
|
56
|
+
elsif jay == "level2"
|
57
|
+
puts "niceeee"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|