kuniri 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +43 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +18 -0
  5. data/.yardopts +1 -0
  6. data/COPYING +661 -0
  7. data/Gemfile +14 -0
  8. data/Guardfile +8 -0
  9. data/README.md +102 -0
  10. data/Rakefile +114 -0
  11. data/bin/kuniri +53 -0
  12. data/data/attribute_lang.rb +131 -0
  13. data/data/class_lang.rb +77 -0
  14. data/data/conditional_lang.rb +71 -0
  15. data/data/constructor_lang.rb +34 -0
  16. data/data/end_block_lang.rb +30 -0
  17. data/data/extern_requirement_lang.rb +45 -0
  18. data/data/function_behavior_lang.rb +113 -0
  19. data/data/lang_syntax.rb +111 -0
  20. data/data/module_namespace_lang.rb +43 -0
  21. data/data/repetition_lang.rb +62 -0
  22. data/data/token_lang.rb +55 -0
  23. data/data/variable_global_lang.rb +118 -0
  24. data/kuniri.gemspec +24 -0
  25. data/lib/kuniri/core/configuration/language_available.rb +7 -0
  26. data/lib/kuniri/core/configuration/log_available.rb +7 -0
  27. data/lib/kuniri/core/configuration/monitor_available.rb +13 -0
  28. data/lib/kuniri/core/kuniri.rb +78 -0
  29. data/lib/kuniri/core/setting.rb +143 -0
  30. data/lib/kuniri/error/configuration_file_error.rb +12 -0
  31. data/lib/kuniri/error/language_error.rb +12 -0
  32. data/lib/kuniri/language/abstract_container/structured_and_oo/attribute.rb +73 -0
  33. data/lib/kuniri/language/abstract_container/structured_and_oo/class.rb +51 -0
  34. data/lib/kuniri/language/abstract_container/structured_and_oo/comment.rb +57 -0
  35. data/lib/kuniri/language/abstract_container/structured_and_oo/conditional.rb +42 -0
  36. data/lib/kuniri/language/abstract_container/structured_and_oo/constructor.rb +52 -0
  37. data/lib/kuniri/language/abstract_container/structured_and_oo/end_block.rb +27 -0
  38. data/lib/kuniri/language/abstract_container/structured_and_oo/extern_requirement.rb +36 -0
  39. data/lib/kuniri/language/abstract_container/structured_and_oo/function_behavior.rb +55 -0
  40. data/lib/kuniri/language/abstract_container/structured_and_oo/module_namespace.rb +36 -0
  41. data/lib/kuniri/language/abstract_container/structured_and_oo/repetition.rb +42 -0
  42. data/lib/kuniri/language/abstract_container/structured_and_oo/variable_behaviour.rb +53 -0
  43. data/lib/kuniri/language/abstract_container/structured_and_oo/variable_global.rb +67 -0
  44. data/lib/kuniri/language/container_data/structured_and_oo/attribute_data.rb +26 -0
  45. data/lib/kuniri/language/container_data/structured_and_oo/basic_data.rb +18 -0
  46. data/lib/kuniri/language/container_data/structured_and_oo/class_data.rb +77 -0
  47. data/lib/kuniri/language/container_data/structured_and_oo/conditional_data.rb +23 -0
  48. data/lib/kuniri/language/container_data/structured_and_oo/constructor_data.rb +18 -0
  49. data/lib/kuniri/language/container_data/structured_and_oo/extern_requirement_data.rb +26 -0
  50. data/lib/kuniri/language/container_data/structured_and_oo/file_element.rb +77 -0
  51. data/lib/kuniri/language/container_data/structured_and_oo/function_abstract.rb +52 -0
  52. data/lib/kuniri/language/container_data/structured_and_oo/function_data.rb +21 -0
  53. data/lib/kuniri/language/container_data/structured_and_oo/method_data.rb +20 -0
  54. data/lib/kuniri/language/container_data/structured_and_oo/module_namespace_data.rb +18 -0
  55. data/lib/kuniri/language/container_data/structured_and_oo/repetition_data.rb +23 -0
  56. data/lib/kuniri/language/container_data/structured_and_oo/variable_global_data.rb +22 -0
  57. data/lib/kuniri/language/language.rb +222 -0
  58. data/lib/kuniri/language/language_factory.rb +48 -0
  59. data/lib/kuniri/language/ruby/attribute_ruby.rb +134 -0
  60. data/lib/kuniri/language/ruby/class_ruby.rb +83 -0
  61. data/lib/kuniri/language/ruby/comment_ruby.rb +84 -0
  62. data/lib/kuniri/language/ruby/conditional_ruby.rb +77 -0
  63. data/lib/kuniri/language/ruby/constructor_ruby.rb +36 -0
  64. data/lib/kuniri/language/ruby/end_block_ruby.rb +33 -0
  65. data/lib/kuniri/language/ruby/extern_requirement_ruby.rb +49 -0
  66. data/lib/kuniri/language/ruby/function_behavior_ruby.rb +120 -0
  67. data/lib/kuniri/language/ruby/module_namespace_ruby.rb +47 -0
  68. data/lib/kuniri/language/ruby/repetition_ruby.rb +68 -0
  69. data/lib/kuniri/language/ruby/ruby_syntax.rb +117 -0
  70. data/lib/kuniri/language/ruby/token_ruby.rb +59 -0
  71. data/lib/kuniri/language/ruby/variable_behaviour_ruby.rb +83 -0
  72. data/lib/kuniri/language/ruby/variable_global_ruby.rb +123 -0
  73. data/lib/kuniri/parser/parser.rb +45 -0
  74. data/lib/kuniri/parser/parser_xml.rb +128 -0
  75. data/lib/kuniri/state_machine/OO_structured_fsm/attribute_state.rb +51 -0
  76. data/lib/kuniri/state_machine/OO_structured_fsm/class_state.rb +94 -0
  77. data/lib/kuniri/state_machine/OO_structured_fsm/comment_state.rb +76 -0
  78. data/lib/kuniri/state_machine/OO_structured_fsm/conditional_state.rb +92 -0
  79. data/lib/kuniri/state_machine/OO_structured_fsm/constructor_state.rb +71 -0
  80. data/lib/kuniri/state_machine/OO_structured_fsm/function_state.rb +82 -0
  81. data/lib/kuniri/state_machine/OO_structured_fsm/idle_state.rb +80 -0
  82. data/lib/kuniri/state_machine/OO_structured_fsm/include_state.rb +59 -0
  83. data/lib/kuniri/state_machine/OO_structured_fsm/method_state.rb +69 -0
  84. data/lib/kuniri/state_machine/OO_structured_fsm/module_state.rb +79 -0
  85. data/lib/kuniri/state_machine/OO_structured_fsm/oo_structured_state.rb +92 -0
  86. data/lib/kuniri/state_machine/OO_structured_fsm/repetition_state.rb +85 -0
  87. data/lib/kuniri/state_machine/OO_structured_fsm/token_state_machine.rb +8 -0
  88. data/lib/kuniri/state_machine/OO_structured_fsm/variable_state.rb +49 -0
  89. data/lib/kuniri/util/html_logger.rb +41 -0
  90. data/lib/kuniri/util/logger.rb +34 -0
  91. data/lib/kuniri/util/txt_logger.rb +29 -0
  92. data/lib/kuniri/version.rb +3 -0
  93. data/lib/kuniri.rb +5 -0
  94. data/other/analyseFile.asta +0 -0
  95. data/spec/core/kuniri_spec.rb +14 -0
  96. data/spec/core/setting_spec.rb +114 -0
  97. data/spec/language/abstract_container/attribute_spec.rb +13 -0
  98. data/spec/language/abstract_container/class_spec.rb +13 -0
  99. data/spec/language/abstract_container/comment_spec.rb +31 -0
  100. data/spec/language/abstract_container/conditional_spec.rb +13 -0
  101. data/spec/language/abstract_container/constructor_spec.rb +13 -0
  102. data/spec/language/abstract_container/end_block_spec.rb +14 -0
  103. data/spec/language/abstract_container/module_namespace_spec.rb +13 -0
  104. data/spec/language/abstract_container/repetition_spec.rb +13 -0
  105. data/spec/language/container_data/structured_and_oo/attribute_data_spec.rb +32 -0
  106. data/spec/language/container_data/structured_and_oo/class_data_spec.rb +121 -0
  107. data/spec/language/container_data/structured_and_oo/conditional_data_spec.rb +34 -0
  108. data/spec/language/container_data/structured_and_oo/constructor_data_spec.rb +46 -0
  109. data/spec/language/container_data/structured_and_oo/extern_requirement_data_spec.rb +26 -0
  110. data/spec/language/container_data/structured_and_oo/file_element_spec.rb +91 -0
  111. data/spec/language/container_data/structured_and_oo/function_data_spec.rb +22 -0
  112. data/spec/language/container_data/structured_and_oo/module_namespace_spec.rb +20 -0
  113. data/spec/language/container_data/structured_and_oo/repetition_data_spec.rb +34 -0
  114. data/spec/language/container_data/structured_and_oo/variable_global_data_spec.rb +39 -0
  115. data/spec/language/language_factory_spec.rb +64 -0
  116. data/spec/language/language_spec.rb +74 -0
  117. data/spec/language/ruby/attribute_ruby_spec.rb +126 -0
  118. data/spec/language/ruby/class_ruby_spec.rb +102 -0
  119. data/spec/language/ruby/comment_ruby_spec.rb +78 -0
  120. data/spec/language/ruby/conditional_ruby_spec.rb +106 -0
  121. data/spec/language/ruby/constructor_ruby_spec.rb +57 -0
  122. data/spec/language/ruby/end_block_ruby_spec.rb +62 -0
  123. data/spec/language/ruby/function_behavior_ruby_spec.rb +246 -0
  124. data/spec/language/ruby/module_namespace_ruby_spec.rb +55 -0
  125. data/spec/language/ruby/repetition_ruby_spec.rb +33 -0
  126. data/spec/language/ruby/ruby_syntax_spec.rb +482 -0
  127. data/spec/language/ruby/variable_ruby_spec.rb +134 -0
  128. data/spec/parser/parser_spec.rb +25 -0
  129. data/spec/samples/rubySyntaxParts/attribute/simpleAttribute.rb +15 -0
  130. data/spec/samples/rubySyntaxParts/class/simpleClass.rb +19 -0
  131. data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_class.rb +33 -0
  132. data/spec/samples/rubySyntaxParts/comment/simple_multiple_line_comment_global.rb +20 -0
  133. data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_class.rb +23 -0
  134. data/spec/samples/rubySyntaxParts/comment/simple_single_line_comment_global.rb +16 -0
  135. data/spec/samples/rubySyntaxParts/conditionalStatment/constructorConditional.rb +28 -0
  136. data/spec/samples/rubySyntaxParts/conditionalStatment/methodConditional.rb +42 -0
  137. data/spec/samples/rubySyntaxParts/conditionalStatment/nestedConditional.rb +0 -0
  138. data/spec/samples/rubySyntaxParts/conditionalStatment/simpleConditional.rb +43 -0
  139. data/spec/samples/rubySyntaxParts/constructor/simpleConstructor.rb +27 -0
  140. data/spec/samples/rubySyntaxParts/extern/multipleLineExternRequirement.rb +0 -0
  141. data/spec/samples/rubySyntaxParts/extern/requireRelative.rb +6 -0
  142. data/spec/samples/rubySyntaxParts/extern/simpleExternRequirement.rb +14 -0
  143. data/spec/samples/rubySyntaxParts/fullCode/simpleCodeWithConditional.rb +18 -0
  144. data/spec/samples/rubySyntaxParts/fullCode/simpleFullCode.rb +19 -0
  145. data/spec/samples/rubySyntaxParts/function/simpleFunction.rb +29 -0
  146. data/spec/samples/rubySyntaxParts/method/simpleMethod.rb +13 -0
  147. data/spec/samples/rubySyntaxParts/module/simpleModule.rb +12 -0
  148. data/spec/samples/rubySyntaxParts/repetition/simpleRepetition.rb +28 -0
  149. data/spec/samples/rubySyntaxParts/variable/simpleVariable.rb +13 -0
  150. data/spec/spec_helper.rb +20 -0
  151. data/spec/state_machine/OO_structured_fsm/attribute_state_spec.rb +44 -0
  152. data/spec/state_machine/OO_structured_fsm/class_state_spec.rb +90 -0
  153. data/spec/state_machine/OO_structured_fsm/comment_state_spec.rb +30 -0
  154. data/spec/state_machine/OO_structured_fsm/conditional_state_spec.rb +83 -0
  155. data/spec/state_machine/OO_structured_fsm/constructor_state_spec.rb +48 -0
  156. data/spec/state_machine/OO_structured_fsm/function_state_spec.rb +41 -0
  157. data/spec/state_machine/OO_structured_fsm/idle_state_spec.rb +101 -0
  158. data/spec/state_machine/OO_structured_fsm/include_state_spec.rb +62 -0
  159. data/spec/state_machine/OO_structured_fsm/method_state_spec.rb +42 -0
  160. data/spec/state_machine/OO_structured_fsm/module_state_spec.rb +54 -0
  161. data/spec/state_machine/OO_structured_fsm/oo_structured_state_spec.rb +0 -0
  162. data/spec/state_machine/OO_structured_fsm/repetition_state_spec.rb +83 -0
  163. data/spec/state_machine/OO_structured_fsm/variable_state_spec.rb +40 -0
  164. data/spec/util/html_logger_spec.rb +31 -0
  165. data/spec/util/logger_spec.rb +20 -0
  166. data/spec/util/txt_logger_spec.rb +31 -0
  167. metadata +326 -0
@@ -0,0 +1,53 @@
1
+ module Languages
2
+
3
+ # @abstract This class is an abstraction for handling any element whose the
4
+ # behaviour is similar to a variable. As an example, we have global
5
+ # variables and attributes that have some similarities.
6
+ class VariableBehaviour
7
+
8
+ protected
9
+
10
+ # Remove unnecessary information from line. For example, remove
11
+ # everything into parenthesis or line comment.
12
+ # @param pString String for remove unnecessary information.
13
+ # @return If match any unnecessary character defined by the programmer
14
+ # returns the new string, otherwise return the same string.
15
+ def remove_unnecessary_information(pString)
16
+ raise NotImplementedError
17
+ end
18
+
19
+ # Prepare final string, before save it in a container data.
20
+ # @param pLine Line to be inspected.
21
+ # @return Return a string.
22
+ def prepare_final_string(pLine)
23
+ raise NotImplementedError
24
+ end
25
+
26
+ # One common behaviour related with variables, is the multiple
27
+ # declaration separated by comma. This method is responsible for
28
+ # handling multiple line declaration separated by comma.
29
+ # @param pString String to be handled.
30
+ # @return Return an array with multiple variables.
31
+ def handle_multiple_declaration_with_comma(pString)
32
+ raise NotImplementedError
33
+ end
34
+
35
+ # Handling multiple declaration with equal.
36
+ # @param pString String with multiple declaration.
37
+ # @return Return an string.
38
+ def handle_multiple_declaration_with_equal(pString)
39
+ raise NotImplementedError
40
+ end
41
+
42
+ # Handling line declaration.
43
+ # @param pString Line with simple declaration.
44
+ # @return Return a string.
45
+ def handle_line_declaration(pString)
46
+ raise NotImplementedError
47
+ end
48
+
49
+ # Class
50
+ end
51
+
52
+ # Language
53
+ end
@@ -0,0 +1,67 @@
1
+ module Languages
2
+
3
+ # @abstract Any global variable should be handler here.
4
+ class VariableGlobal
5
+
6
+ public
7
+
8
+ # This method is the main interface for extract data from specific
9
+ # code and convert it to a common representation.
10
+ # @param pLine Line to be inspected.
11
+ # @return If line has a variable, this method returns an object of
12
+ # VariableGlobalData. Otherwise returns nil.
13
+ # @see variable_global_data.rb
14
+ def get_variable(pLine)
15
+ raise NotImplementedError
16
+ end
17
+
18
+ protected
19
+
20
+ # Verify if line has a variable.
21
+ # @param pLine String to be analysed.
22
+ # @return Returns a partial string, if it can be a variable. Otherwise
23
+ # return nil.
24
+ def detect_variable(pLine)
25
+ raise NotImplementedError
26
+ end
27
+
28
+ # Remove unnecessary information.
29
+ # @param pLine String to be improved.
30
+ # @return Return an partial string, or the same if no work is needed.
31
+ def remove_unnecessary_information(pLine)
32
+ raise NotImplementedError
33
+ end
34
+
35
+ # Make some prunes and adjustments in the string.
36
+ # @param pLine String to be prepared.
37
+ # @return Return a string.
38
+ def prepare_final_string(pLine)
39
+ raise NotImplementedError
40
+ end
41
+
42
+ # Handling multiple line declaration with comma.
43
+ # @param pString String with multiple declaration with comma.
44
+ # @return Return a string.
45
+ def handle_multiple_declaration_with_comma(pString)
46
+ raise NotImplementedError
47
+ end
48
+
49
+ # Handling multiple declaration with equal.
50
+ # @param pString String to be handled.
51
+ # @return Return an array with all variables.
52
+ def handle_multiple_declaration_with_equal(pString)
53
+ raise NotImplementedError
54
+ end
55
+
56
+ # Handling simple line declaration.
57
+ # @param pString String with simple declaration.
58
+ # @return Return a string.
59
+ def handle_line_declaration(pString)
60
+ raise NotImplementedError
61
+ end
62
+
63
+ # class
64
+ end
65
+
66
+ # module
67
+ end
@@ -0,0 +1,26 @@
1
+ require_relative 'basic_data'
2
+
3
+ module Languages
4
+
5
+ # Handling attributes data.
6
+ class AttributeData < Languages::BasicData
7
+
8
+ public
9
+
10
+ # Basic initialization of attribute.
11
+ # @param pAttribute_name Attribute name for basic initialization.
12
+ def initialize (pAttribute_name)
13
+ @name = pAttribute_name
14
+ @visibility = "public"
15
+ end
16
+
17
+ private
18
+
19
+ # Type of the attribute.
20
+ @type
21
+
22
+ # Class
23
+ end
24
+
25
+ # Module
26
+ end
@@ -0,0 +1,18 @@
1
+ module Languages
2
+
3
+ # @abstract Usually, all data in this container needs at list one
4
+ # information: name. This class aim to be a generic class for all elements
5
+ # of container data.
6
+ class BasicData
7
+
8
+ public
9
+
10
+ attr_accessor :name
11
+ attr_accessor :visibility
12
+ attr_accessor :comments
13
+
14
+ # class
15
+ end
16
+
17
+ # module
18
+ end
@@ -0,0 +1,77 @@
1
+ require_relative 'basic_data'
2
+ require_relative 'attribute_data'
3
+ require_relative 'method_data'
4
+ require_relative 'constructor_data'
5
+
6
+ module Languages
7
+
8
+ # Handling class information
9
+ class ClassData < Languages::BasicData
10
+
11
+ public
12
+
13
+ attr_accessor :inheritances
14
+ attr_reader :attributes
15
+ attr_reader :methods
16
+ attr_reader :constructors
17
+
18
+ def initialize
19
+ @inheritances = []
20
+ @attributes = []
21
+ @methods = []
22
+ @constructors = []
23
+ @visibility = "public"
24
+ end
25
+
26
+ # Add attribute to class data, notice the possibility of call this
27
+ # method more than one time.
28
+ # @param pAttribute Attribute to be added inside class. This attribute
29
+ # is a list of AttributeData.
30
+ def add_attribute(pAttribute)
31
+ pAttribute.each do |attributeElement|
32
+ return unless attributeElement.is_a?(Languages::AttributeData)
33
+ @attributes.push(attributeElement)
34
+ end
35
+ end
36
+
37
+ # Add method inside ClassData. Remember the possibility of have zero or
38
+ # any method inside a class.
39
+ # @param pMethod It is an object of FunctionData with the method
40
+ # informations.
41
+ def add_method(pMethod)
42
+ return unless pMethod.is_a?(Languages::FunctionData)
43
+
44
+ @methods.push(pMethod)
45
+ end
46
+
47
+ # Add constructor inside class.
48
+ # @param pConstructor Object of FunctionData to be added at class.
49
+ def add_constructor(pConstructor)
50
+ return unless pConstructor.is_a?(Languages::FunctionData)
51
+
52
+ @constructors.push(pConstructor)
53
+ end
54
+
55
+ # TODO: REMOVE IT!
56
+ def get_methods
57
+ @methods
58
+ end
59
+
60
+ def get_attributes
61
+ @attributes
62
+ end
63
+
64
+ def get_constructors
65
+ @constructors
66
+ end
67
+
68
+ def get_parameters
69
+ @parameters
70
+ end
71
+
72
+ # Class
73
+ end
74
+
75
+ # Module
76
+ end
77
+
@@ -0,0 +1,23 @@
1
+ require_relative 'basic_data'
2
+
3
+ module Languages
4
+
5
+ # Class responsible for handling conditional data
6
+ class ConditionalData < Languages::BasicData
7
+
8
+ public
9
+
10
+ attr_accessor :type
11
+ attr_accessor :expression
12
+
13
+ def initialize
14
+ @name = "nothing"
15
+ @type = "none"
16
+ @expression = "empty"
17
+ end
18
+
19
+ # class
20
+ end
21
+
22
+ # module
23
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'function_abstract'
2
+
3
+ module Languages
4
+
5
+ # Handling constructor information.
6
+ class ConstructorData < Languages::FunctionAbstract
7
+
8
+ public
9
+
10
+ def initialize(pConstructorName)
11
+ super(pConstructorName)
12
+ end
13
+
14
+ # Class
15
+ end
16
+
17
+ # Module
18
+ end
@@ -0,0 +1,26 @@
1
+ require_relative 'basic_data'
2
+
3
+ module Languages
4
+
5
+ # ExternRequirementData Handling extern requirements
6
+ class ExternRequirementData < Languages::BasicData
7
+
8
+ public
9
+
10
+ attr_reader :path
11
+
12
+ def initialize(pRequirement)
13
+ @name = pRequirement
14
+ end
15
+
16
+ # Set path of extern requirement.
17
+ # @param pPath Path inside the extern requirement.
18
+ def setPath(pPath)
19
+ @path = pPath
20
+ end
21
+
22
+ # Class
23
+ end
24
+
25
+ # Module
26
+ end
@@ -0,0 +1,77 @@
1
+ require_relative 'basic_data'
2
+ require_relative 'function_data'
3
+ require_relative 'variable_global_data'
4
+ require_relative 'extern_requirement_data'
5
+ require_relative 'module_namespace_data'
6
+ require_relative 'class_data'
7
+
8
+ module Languages
9
+
10
+ # FileElement is the upper element related with container data, this class
11
+ # refers to file.
12
+ class FileElement < Languages::BasicData
13
+
14
+ public
15
+
16
+ attr_reader :global_functions
17
+ attr_reader :global_variables
18
+ attr_reader :extern_requirements
19
+ attr_reader :classes
20
+ attr_reader :modules
21
+
22
+ def initialize(pName)
23
+ @global_functions = []
24
+ @global_variables = []
25
+ @extern_requirements = []
26
+ @classes = []
27
+ @modules = []
28
+ @name = pName
29
+ @comments = ""
30
+ end
31
+
32
+ # Add global function to the file.
33
+ # @param pFunction An object of FunctionData to be added at the file.
34
+ def add_global_function(pFunction)
35
+ return if not pFunction.is_a?(Languages::FunctionData)
36
+
37
+ @global_functions.push(pFunction)
38
+ end
39
+
40
+ # Add global variable inside file.
41
+ # @param pVariable An VariableGlobalData object to be added.
42
+ def add_global_variable(pVariable)
43
+ pVariable.each do |element|
44
+ next unless element.is_a?(Languages::VariableGlobalData)
45
+ @global_variables.push(element)
46
+ end
47
+ end
48
+
49
+ # Add extern requirement inside file.
50
+ # @param pOutside Add an object of ExternRequirementData.
51
+ def add_extern_requirement(pOutside)
52
+ return unless pOutside.is_a?(Languages::ExternRequirementData)
53
+
54
+ @extern_requirements.push(pOutside)
55
+ end
56
+
57
+ # Add a class inside file.
58
+ # @param pClass Add an object of ClassData.
59
+ def add_class(pClass)
60
+ return unless pClass.is_a?(Languages::ClassData)
61
+
62
+ @classes.push(pClass)
63
+ end
64
+
65
+ # Add a module inside file.
66
+ # @param pModule Add an object of ModuleNamespaceData
67
+ def add_modules(pModule)
68
+ return unless pModule.is_a?(Languages::ModuleNamespaceData)
69
+
70
+ @modules.push(pModule)
71
+ end
72
+
73
+ # Class
74
+ end
75
+
76
+ # Module
77
+ end
@@ -0,0 +1,52 @@
1
+ require_relative 'basic_data'
2
+ require_relative 'conditional_data'
3
+ require_relative 'repetition_data'
4
+
5
+ module Languages
6
+
7
+ # Abstraction for handling function data
8
+ class FunctionAbstract < Languages::BasicData
9
+
10
+ public
11
+
12
+ attr_reader :parameters
13
+ attr_reader :conditionals
14
+ attr_reader :repetitions
15
+ attr_accessor :type
16
+
17
+ def initialize(pFunctionName)
18
+ @name = pFunctionName
19
+ @parameters = []
20
+ @conditionals = []
21
+ @repetitions = []
22
+ end
23
+
24
+ # Add parameters inside function.
25
+ # @param pValue Add a parameter inside function.
26
+ def add_parameters(pValue)
27
+ # TODO: You have to fix it.
28
+ @parameters.push(pValue)
29
+ end
30
+
31
+ # Add conditional element inside function.
32
+ # @param pConditional An object of ConditionalData.
33
+ # @return If pConditional is not an instance of ConditionalData,
34
+ # return nil.
35
+ def add_conditional(pConditional)
36
+ return nil unless (pConditional.instance_of?Languages::ConditionalData)
37
+ @conditionals.push(pConditional)
38
+ end
39
+
40
+ # Add repetition element inside function.
41
+ # @param pRepetition An object of RepetionData.
42
+ # @return If pRepetition is not RepetionData instance return nil.
43
+ def add_repetition(pRepetition)
44
+ return nil unless (pRepetition.instance_of?Languages::RepetitionData)
45
+ @repetitions.push(pRepetition)
46
+ end
47
+
48
+ # class
49
+ end
50
+
51
+ # Module
52
+ end
@@ -0,0 +1,21 @@
1
+ require_relative 'function_abstract'
2
+
3
+ module Languages
4
+
5
+ # Handle function data
6
+ class FunctionData < Languages::FunctionAbstract
7
+
8
+ public
9
+
10
+ attr_reader :parameters
11
+
12
+ def initialize(pFunctionName)
13
+ super(pFunctionName)
14
+ @visibility = "global"
15
+ end
16
+
17
+ # class
18
+ end
19
+
20
+ # Module
21
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'function_abstract'
2
+
3
+ module Languages
4
+
5
+ # Handling method informations
6
+ class MethodData < Languages::FunctionAbstract
7
+
8
+ public
9
+
10
+ attr_reader :parameters
11
+
12
+ def initialize(pMethod_name)
13
+ super(pMethod_name)
14
+ end
15
+
16
+ # Class
17
+ end
18
+
19
+ # Module
20
+ end
@@ -0,0 +1,18 @@
1
+ require_relative 'basic_data'
2
+
3
+ module Languages
4
+
5
+ # Handling module data
6
+ class ModuleNamespaceData < Languages::BasicData
7
+
8
+ public
9
+
10
+ def initialize(pName)
11
+ @name = pName
12
+ end
13
+
14
+ # Class
15
+ end
16
+
17
+ # Module
18
+ end
@@ -0,0 +1,23 @@
1
+ require_relative 'basic_data'
2
+
3
+ module Languages
4
+
5
+ # Class responsible for handling repetition data
6
+ class RepetitionData < Languages::BasicData
7
+
8
+ public
9
+
10
+ attr_accessor :type
11
+ attr_accessor :expression
12
+
13
+ def initialize
14
+ @name = "nothing"
15
+ @type = "none"
16
+ @expression = "empty"
17
+ end
18
+
19
+ # class
20
+ end
21
+
22
+ # module
23
+ end
@@ -0,0 +1,22 @@
1
+ require_relative 'basic_data'
2
+
3
+ module Languages
4
+
5
+ # Class responsible for handling global variables.
6
+ class VariableGlobalData < Languages::BasicData
7
+
8
+ public
9
+
10
+ attr_accessor :value
11
+ attr_accessor :type
12
+
13
+ def initialize(pName)
14
+ @name = pName
15
+ @visibility = "global"
16
+ end
17
+
18
+ # Class
19
+ end
20
+
21
+ # Languages
22
+ end