nilac 0.0.4.3.9.7.1 → 0.0.4.3.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/Rakefile +1 -1
  4. data/cookbook/case_insensitive_compare.js +13 -0
  5. data/cookbook/case_insensitive_compare.nila +7 -0
  6. data/cookbook/compare_strings.js +13 -0
  7. data/cookbook/compare_strings.nila +7 -0
  8. data/cookbook/concat11.js +13 -0
  9. data/cookbook/concat11.nila +4 -0
  10. data/cookbook/concat12.js +23 -0
  11. data/cookbook/concat12.nila +15 -0
  12. data/cookbook/find_substring.js +15 -0
  13. data/cookbook/find_substring.nila +5 -0
  14. data/cookbook/string_interpolation.js +7 -0
  15. data/cookbook/string_interpolation.nila +1 -0
  16. data/cookbook/substring_extract.js +21 -0
  17. data/cookbook/substring_extract.nila +8 -0
  18. data/examples/my_file.js +5 -0
  19. data/examples/repl.js +0 -33
  20. data/examples/repl.nila +36 -8
  21. data/examples/temp_nila.nila +63 -0
  22. data/lib/nilac.rb +83 -68
  23. data/lib/nilac/add_line_numbers.rb +17 -0
  24. data/lib/nilac/add_semicolons.rb +13 -3
  25. data/lib/nilac/compile_arrays.rb +38 -5
  26. data/lib/nilac/compile_blocks.rb +87 -25
  27. data/lib/nilac/compile_case_statement.rb +4 -0
  28. data/lib/nilac/compile_chained_comparison.rb +35 -0
  29. data/lib/nilac/compile_comments.rb +9 -0
  30. data/lib/nilac/compile_conditional_structures.rb +26 -3
  31. data/lib/nilac/compile_custom_function_map.rb +24 -2
  32. data/lib/nilac/compile_hashes.rb +3 -1
  33. data/lib/nilac/compile_heredocs.rb +2 -0
  34. data/lib/nilac/compile_inline_for.rb +13 -0
  35. data/lib/nilac/compile_interpolated_strings.rb +184 -5
  36. data/lib/nilac/compile_lambdas.rb +24 -8
  37. data/lib/nilac/compile_new_keyword.rb +37 -0
  38. data/lib/nilac/compile_nilac_options.rb +79 -0
  39. data/lib/nilac/compile_parallel_assignment.rb +3 -1
  40. data/lib/nilac/compile_ranges.rb +60 -0
  41. data/lib/nilac/compile_require_statements.rb +4 -2
  42. data/lib/nilac/compile_ruby_math.rb +20 -0
  43. data/lib/nilac/compile_ruby_methods.rb +49 -0
  44. data/lib/nilac/compile_whitespace_delimited_functions.rb +15 -1
  45. data/lib/nilac/extract_paranthesis_contents.rb +37 -0
  46. data/lib/nilac/extract_strings.rb +63 -0
  47. data/lib/nilac/fix_javascript_traps.rb +89 -0
  48. data/lib/nilac/friendly_errors.rb +128 -0
  49. data/lib/nilac/get_variables.rb +48 -14
  50. data/lib/nilac/lexical_scoped_function_variables.rb +1 -3
  51. data/lib/nilac/optimizer.rb +13 -0
  52. data/lib/nilac/paranthesis_compactor.rb +3 -1
  53. data/lib/nilac/parse_arguments.rb +21 -7
  54. data/lib/nilac/pretty_print_javascript.rb +152 -18
  55. data/lib/nilac/pretty_print_nila.rb +17 -0
  56. data/lib/nilac/replace_comparison_operators.rb +25 -0
  57. data/lib/nilac/replace_multiline_comments.rb +4 -0
  58. data/lib/nilac/replace_singleline_comments.rb +23 -0
  59. data/lib/nilac/replace_strings.rb +3 -3
  60. data/lib/nilac/rollblocks.rb +7 -3
  61. data/lib/nilac/split_semicolon_seperated_expressions.rb +3 -17
  62. data/lib/nilac/square_brackets_compactor.rb +37 -0
  63. data/lib/nilac/version.rb +1 -1
  64. data/shark/features/arrays.feature +11 -0
  65. data/shark/features/builtin_new.feature +11 -0
  66. data/shark/features/comments.feature +11 -0
  67. data/shark/features/fix_newlines.feature +1 -1
  68. data/shark/features/variables.feature +11 -0
  69. data/shark/test_files/array_string_indexing.nila +5 -1
  70. data/shark/test_files/arrays.nila +3 -0
  71. data/shark/test_files/blocks.nila +10 -0
  72. data/shark/test_files/builtin_new.nila +3 -0
  73. data/shark/test_files/case.nila +8 -0
  74. data/shark/test_files/chained_comparison.nila +19 -0
  75. data/shark/test_files/comments.nila +15 -0
  76. data/shark/test_files/correct.js +1 -1
  77. data/shark/test_files/correct_arrays.js +7 -0
  78. data/shark/test_files/correct_blocks.js +14 -1
  79. data/shark/test_files/correct_builtin_new.js +9 -0
  80. data/shark/test_files/correct_case.js +10 -2
  81. data/shark/test_files/correct_comments.js +19 -0
  82. data/shark/test_files/correct_conditional_assignment.js +1 -1
  83. data/shark/test_files/correct_default_parameters.js +1 -1
  84. data/shark/test_files/correct_for.js +1 -1
  85. data/shark/test_files/correct_hashes.js +1 -1
  86. data/shark/test_files/correct_heredoc.js +6 -2
  87. data/shark/test_files/correct_if_then_else.js +5 -1
  88. data/shark/test_files/correct_indexing.js +7 -3
  89. data/shark/test_files/correct_initialization.js +1 -1
  90. data/shark/test_files/correct_javascript_methods.js +1 -1
  91. data/shark/test_files/correct_loop.js +1 -1
  92. data/shark/test_files/correct_monkey_patch.js +1 -1
  93. data/shark/test_files/correct_multiline_array.js +1 -1
  94. data/shark/test_files/correct_multiple_return.js +1 -1
  95. data/shark/test_files/correct_numbers.js +1 -1
  96. data/shark/test_files/correct_operators.js +1 -1
  97. data/shark/test_files/correct_regular_if.js +1 -1
  98. data/shark/test_files/correct_regular_while.js +1 -1
  99. data/shark/test_files/correct_required_module.js +1 -1
  100. data/shark/test_files/correct_return.js +1 -1
  101. data/shark/test_files/correct_ruby_methods.js +1 -1
  102. data/shark/test_files/correct_single_return.js +1 -1
  103. data/shark/test_files/{perfect.js → correct_spacing.js} +1 -1
  104. data/shark/test_files/correct_splats.js +1 -2
  105. data/shark/test_files/correct_string_interpolation.js +8 -2
  106. data/shark/test_files/correct_string_operators.js +1 -1
  107. data/shark/test_files/correct_times.js +1 -1
  108. data/shark/test_files/correct_unless_until.js +2 -4
  109. data/shark/test_files/correct_variables.js +13 -0
  110. data/shark/test_files/correct_whitespace_delimiter.js +1 -1
  111. data/shark/test_files/existential_operators.nila +7 -0
  112. data/shark/test_files/expression.nila +6 -0
  113. data/shark/test_files/global_variables_client.nila +5 -0
  114. data/shark/test_files/heredoc.nila +11 -1
  115. data/shark/test_files/if_then_else.nila +3 -1
  116. data/shark/test_files/inline_for.nila +5 -0
  117. data/shark/test_files/no_return.js +11 -0
  118. data/shark/test_files/parseInt_trap.nila +3 -0
  119. data/shark/test_files/single_return.js +11 -0
  120. data/shark/test_files/string_interpolation.nila +7 -1
  121. data/shark/test_files/variables.nila +7 -0
  122. metadata +54 -3
@@ -0,0 +1,17 @@
1
+ def add_line_numbers(input_file_contents)
2
+
3
+ line_counter = 1
4
+
5
+ modified_file_contents = []
6
+
7
+ input_file_contents.each do |element|
8
+
9
+ modified_file_contents << "<<<#{line_counter}>>> " + element
10
+
11
+ line_counter += 1
12
+
13
+ end
14
+
15
+ return modified_file_contents
16
+
17
+ end
@@ -2,11 +2,11 @@
2
2
 
3
3
  def comment(input_string)
4
4
 
5
- if input_string.include?("--single_line_comment")
5
+ if input_string.strip.split("--single_line_comment")[0].eql?("")
6
6
 
7
7
  true
8
8
 
9
- elsif input_string.include?("--multiline_comment")
9
+ elsif input_string.strip.split("--multiline_comment")[0].eql?("")
10
10
 
11
11
  true
12
12
 
@@ -38,7 +38,17 @@
38
38
 
39
39
  if line.rstrip[-1] != "[" and line.rstrip[-1] != "{" and line.rstrip[-1] != "," and line.rstrip[-1] != ";"
40
40
 
41
- modified_file_contents[index] = line.rstrip + ";\n\n"
41
+ line,comment = line.split("--single_line_comment")
42
+
43
+ unless comment.nil? or comment.strip == ""
44
+
45
+ modified_file_contents[index] = line.rstrip + "; --single_line_comment#{comment}\n\n"
46
+
47
+ else
48
+
49
+ modified_file_contents[index] = line.rstrip + ";\n\n"
50
+
51
+ end
42
52
 
43
53
  end
44
54
 
@@ -1,8 +1,7 @@
1
1
  require_relative 'find_all_matching_indices'
2
-
3
2
  require_relative 'read_file_line_by_line'
4
-
5
3
  require_relative 'compile_interpolated_strings'
4
+ require_relative 'replace_strings'
6
5
 
7
6
  def compile_arrays(input_file_contents, named_functions, temporary_nila_file)
8
7
 
@@ -40,9 +39,19 @@ require_relative 'compile_interpolated_strings'
40
39
 
41
40
  input_file_contents.each_with_index do |line, index|
42
41
 
43
- if line.include?("%w{")
42
+ if line.include?("%w")
43
+
44
+ start_delimiter = close_delimiter = line[line.index("%w")+2]
45
+
46
+ close_delimiter = "}" if start_delimiter.eql?("{")
47
+
48
+ close_delimiter = ")" if start_delimiter.eql?("(")
49
+
50
+ close_delimiter = ">" if start_delimiter.eql?("<")
44
51
 
45
- string_arrays = extract(line, "%w{", "}")
52
+ close_delimiter = "]" if start_delimiter.eql?("[")
53
+
54
+ string_arrays = extract(line, "%w#{start_delimiter}", "#{close_delimiter}")
46
55
 
47
56
  string_arrays.each do |array|
48
57
 
@@ -148,6 +157,8 @@ require_relative 'compile_interpolated_strings'
148
157
 
149
158
  triple_range_indexes = triple_range_indexes.flatten
150
159
 
160
+ triple_range_indexes = triple_range_indexes.uniq
161
+
151
162
  triple_range_indexing.each_with_index do |line, index|
152
163
 
153
164
  split1, split2 = line.split("[")
@@ -187,6 +198,8 @@ require_relative 'compile_interpolated_strings'
187
198
  end
188
199
 
189
200
  double_range_indexes = double_range_indexes.flatten
201
+
202
+ double_range_indexes = double_range_indexes.uniq
190
203
 
191
204
  double_range_indexing.each_with_index do |line, index|
192
205
 
@@ -214,7 +227,7 @@ require_relative 'compile_interpolated_strings'
214
227
 
215
228
  else
216
229
 
217
- replacement_string = split1 + ".slice(#{index_start},#{index_end}+1)\n"
230
+ replacement_string = split1 + ".slice(#{index_start},#{(index_end.to_i+1).to_s})\n"
218
231
 
219
232
  end
220
233
 
@@ -248,6 +261,24 @@ require_relative 'compile_interpolated_strings'
248
261
 
249
262
  end
250
263
 
264
+ def compile_array_slicing(input_file_contents)
265
+
266
+ possible_slicing_operation = input_file_contents.reject {|element| !replace_strings(element).include?(".slice")}
267
+
268
+ possible_slicing_operation.each do |element|
269
+
270
+ if replace_strings(element).include?(",last")
271
+
272
+ input_file_contents[input_file_contents.index(element)] = input_file_contents[input_file_contents.index(element)].gsub(",last","")
273
+
274
+ end
275
+
276
+ end
277
+
278
+ return input_file_contents
279
+
280
+ end
281
+
251
282
  def compile_multiline(input_file_contents, temporary_nila_file)
252
283
 
253
284
  possible_arrays = input_file_contents.reject { |element| !element.include?("[") }
@@ -324,6 +355,8 @@ require_relative 'compile_interpolated_strings'
324
355
 
325
356
  input_file_contents = compile_array_indexing(input_file_contents)
326
357
 
358
+ input_file_contents = compile_array_slicing(input_file_contents)
359
+
327
360
  input_file_contents = compile_multiline(input_file_contents, temporary_nila_file)
328
361
 
329
362
  input_file_contents = compile_array_operators(input_file_contents)
@@ -1,6 +1,8 @@
1
1
  require_relative 'read_file_line_by_line'
2
2
  require_relative 'strToArray'
3
3
  require_relative 'lexical_scoped_function_variables'
4
+ require_relative 'rollblocks'
5
+ require_relative 'replace_strings'
4
6
 
5
7
  def compile_blocks(input_file_contents,temporary_nila_file)
6
8
 
@@ -24,49 +26,69 @@ require_relative 'lexical_scoped_function_variables'
24
26
 
25
27
  input_file_contents = input_file_contents.collect {|element| element.gsub(" do"," do ").gsub("do "," do ")}
26
28
 
27
- possible_blocks = input_file_contents.reject {|line| !line.include?(" do ")}
29
+ modified_file_contents = input_file_contents.clone.collect {|element| element.gsub("end","end"+" "*rand(1..10))}
28
30
 
29
- unless possible_blocks.empty?
31
+ possible_blocks = modified_file_contents.clone.reject {|line| !line.include?(" do ")}
30
32
 
31
- possible_blocks.each do |starting_line|
33
+ extract_expr = /(if |Euuf |while |for |def | do )/
32
34
 
33
- index_counter = starting_counter = input_file_contents.index(starting_line)
35
+ starting_locations = []
34
36
 
35
- line = starting_line
37
+ input_file_contents.each_with_index do |line, index|
36
38
 
37
- until line.strip.eql?("end") or line.strip.eql?("end)")
39
+ if replace_strings(line).index(extract_expr) != nil
38
40
 
39
- index_counter += 1
41
+ starting_locations << index
40
42
 
41
- line = input_file_contents[index_counter]
43
+ end
42
44
 
43
- end
45
+ end
46
+
47
+ starting_locations = [0,starting_locations,-1].flatten.uniq
48
+
49
+ remaining_contents, extracted_blocks = extract_blocks(starting_locations,modified_file_contents,["if","for","while","def and do"])
50
+
51
+ possible_blocks = extracted_blocks.reject {|element| !element[0].index(/( do )/)}
52
+
53
+ replaced_blocks = []
54
+
55
+ unless possible_blocks.empty?
56
+
57
+ possible_blocks.each do |element|
44
58
 
45
- loop_extract = input_file_contents[starting_counter..index_counter]
59
+ starting_counter = modified_file_contents.index(element[0])
46
60
 
47
- loop_condition, block = loop_extract.join.split(" do ")
61
+ end_counter = modified_file_contents.index(element[-1])
48
62
 
49
- block = block.split("end")[0]
63
+ loop_extract = input_file_contents[starting_counter..end_counter]
50
64
 
51
- replacement_string = "#{loop_condition.rstrip} blockky {#{block.strip}}_!"
65
+ loop_condition,function_parameters= loop_extract[0].split(" do ")
52
66
 
53
- input_file_contents[starting_counter..index_counter] = replacement_string
67
+ block = [function_parameters] + loop_extract[1...-1]
68
+
69
+ replacement_string = "#{loop_condition.rstrip} blockky \n{#{block.join.strip}\n}_!"
70
+
71
+ replaced_blocks << replacement_string
72
+
73
+ input_file_contents[starting_counter..end_counter] = replacement_string
74
+
75
+ modified_file_contents[starting_counter..end_counter] = replacement_string
54
76
 
55
77
  end
56
78
 
57
79
  end
58
80
 
59
- possible_blocks = input_file_contents.reject{ |element| !element.include?(" blockky ")}
81
+ original_blocks = replaced_blocks.clone
60
82
 
61
- possible_blocks = possible_blocks.reject {|element| !element.include?("{") and !element.include?("}")}
83
+ possible_blocks = replaced_blocks.clone
62
84
 
63
- modified_file_contents = input_file_contents.clone
85
+ joined_file_contents = input_file_contents.clone.join
64
86
 
65
87
  unless possible_blocks.empty?
66
88
 
67
- possible_blocks.each do |loop|
89
+ possible_blocks.each_with_index do |loop,index|
68
90
 
69
- original_loop = loop.clone
91
+ original_loop = original_blocks[index]
70
92
 
71
93
  string_counter = 1
72
94
 
@@ -84,7 +106,7 @@ require_relative 'lexical_scoped_function_variables'
84
106
 
85
107
  end
86
108
 
87
- block_extract = loop[loop.index("{")..loop.index("}_!")]
109
+ block_extract = strToArray(loop)[1..-1].join[0...-2]
88
110
 
89
111
  compiled_block = ""
90
112
 
@@ -154,24 +176,64 @@ require_relative 'lexical_scoped_function_variables'
154
176
 
155
177
  end
156
178
 
157
- replacement_array[1...-1] = replacement_array[1...-1].collect {|element| "#iggggnnnore #{element}"}
179
+ replacement_array[1...-1] = replacement_array[1...-1].collect do |element|
180
+
181
+ if element.include?("#iggggnnnore")
182
+
183
+ element
184
+
185
+ else
186
+
187
+ "#iggggnnnore #{element}"
188
+
189
+ end
190
+
191
+ end
192
+
193
+ starting_counter = joined_file_contents.index(original_loop)
194
+
195
+ if starting_counter.nil?
196
+
197
+ starting_counter = joined_file_contents.index(original_loop.lstrip)
198
+
199
+ end
200
+
201
+ end_counter = starting_counter+original_loop.length
202
+
203
+ joined_file_contents[starting_counter..end_counter] = replacement_array.join
204
+
205
+ nested_blocks = possible_blocks.clone.reject {|element| !element.include?(original_loop)}
158
206
 
159
- modified_file_contents[input_file_contents.index(original_loop)] = replacement_array.join
207
+ nested_blocks = nested_blocks.reject {|element| element.eql?(original_loop)}
208
+
209
+ nested_blocks.each do |block|
210
+
211
+ replacement_block = original_blocks[original_blocks.index(block)]
212
+
213
+ starting_counter = replacement_block.index(original_loop)
214
+
215
+ end_counter = replacement_block.index(original_loop)+original_loop.length
216
+
217
+ replacement_block[starting_counter..end_counter] = replacement_array.join
218
+
219
+ original_blocks[original_blocks.index(block)] = replacement_block
220
+
221
+ end
160
222
 
161
223
  end
162
224
 
163
225
  end
164
226
 
165
- modified_file_contents = modified_file_contents.collect {|element| element.gsub("appand","append")}
166
-
167
227
  file_id = open(temporary_nila_file, 'w')
168
228
 
169
- file_id.write(modified_file_contents.join)
229
+ file_id.write(joined_file_contents)
170
230
 
171
231
  file_id.close()
172
232
 
173
233
  line_by_line_contents = read_file_line_by_line(temporary_nila_file)
174
234
 
235
+ line_by_line_contents = line_by_line_contents.collect {|element| element.gsub("appand","append")}
236
+
175
237
  return line_by_line_contents
176
238
 
177
239
  end
@@ -51,6 +51,10 @@ require_relative 'read_file_line_by_line'
51
51
 
52
52
  possible_case_statements = input_file_contents.reject {|element| !element.include?("case ")}
53
53
 
54
+ possible_case_statements = possible_case_statements.reject {|element| replace_strings(element).include?(".downcase")}
55
+
56
+ possible_case_statements = possible_case_statements.reject {|element| replace_strings(element).include?(".upcase")}
57
+
54
58
  case_statements = []
55
59
 
56
60
  possible_case_statements.each do |statement|
@@ -0,0 +1,35 @@
1
+ require_relative 'replace_strings'
2
+
3
+ def compile_chained_comparison(input_file_contents)
4
+
5
+ select_regex = /\s?(=?[><]=?|==[=]?|&&|\|\|)/
6
+
7
+ modified_file_contents = input_file_contents.collect {|element| replace_strings(element)}
8
+
9
+ possible_comparisons = modified_file_contents.reject {|element| !element.index(select_regex)}
10
+
11
+ possible_comparisons.each do |comparison|
12
+
13
+ original_expression = comparison.dup
14
+
15
+ comparison_split = comparison.split
16
+
17
+ comparison_op_locations = comparison_split.each_index.select {|index| comparison_split[index].index(select_regex)}
18
+
19
+ compared_expressions = []
20
+
21
+ if comparison_op_locations.length > 1
22
+
23
+ comparison_op_locations.each do |op_index|
24
+
25
+ compared_expressions << [comparison_split[op_index-1],comparison_split[op_index], comparison_split[op_index+1]]
26
+
27
+ end
28
+
29
+ end
30
+
31
+
32
+
33
+ end
34
+
35
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative 'read_file_line_by_line'
2
+ require_relative 'strToArray'
2
3
 
3
4
  def compile_comments(input_file_contents, comments, temporary_nila_file)
4
5
 
@@ -50,6 +51,14 @@ require_relative 'read_file_line_by_line'
50
51
 
51
52
  replacement_multiline_string = replacement_multiline_string.sub("=end", "\n*/")
52
53
 
54
+ replacement_array = strToArray(replacement_multiline_string)
55
+
56
+ replacement_array[2...-2] = replacement_array[2...-2].collect {|element| " " + element}
57
+
58
+ replacement_array = [replacement_array[0]] + replacement_array[1...-1].reject {|element| element.strip.eql?("")} + [replacement_array[-1]]
59
+
60
+ replacement_multiline_string = replacement_array.join
61
+
53
62
  ignorable_keywords.each_with_index do |keyword, index|
54
63
 
55
64
  if replacement_multiline_string.index(keyword) != nil
@@ -1,4 +1,5 @@
1
1
  require_relative 'read_file_line_by_line'
2
+ require_relative 'replace_strings'
2
3
 
3
4
  def compile_conditional_structures(input_file_contents, temporary_nila_file)
4
5
 
@@ -84,10 +85,20 @@ def compile_conditional_structures(input_file_contents, temporary_nila_file)
84
85
 
85
86
  matching_lines.each do |line|
86
87
 
88
+ line,comment = line.split("--single_line_comment")
89
+
90
+ comment ||= ""
91
+
87
92
  line_split = line.split(plain_conditionals[index])
88
93
 
89
94
  condition = line_split[1]
90
95
 
96
+ if replace_strings(condition).include?("not")
97
+
98
+ condition = condition.gsub(/not\s*/,"!")
99
+
100
+ end
101
+
91
102
  condition = condition.gsub(" and "," && ").gsub(" or "," || ").gsub(" not "," !")
92
103
 
93
104
  if index == 0
@@ -150,7 +161,7 @@ def compile_conditional_structures(input_file_contents, temporary_nila_file)
150
161
 
151
162
  extracted_blocks = []
152
163
 
153
- controlregexp = /(if |while |def | do )/
164
+ controlregexp = /(if |while |def | do |for )/
154
165
 
155
166
  rejectionregexp = /( if | while )/
156
167
 
@@ -347,7 +358,7 @@ def compile_conditional_structures(input_file_contents, temporary_nila_file)
347
358
 
348
359
  if_statement_indexes = [0] + if_statement_indexes.flatten + [-1]
349
360
 
350
- controlregexp = /(while |def | do )/
361
+ controlregexp = /(while |def | do |for)/
351
362
 
352
363
  modified_input_contents, extracted_statements = extract_if_blocks(if_statement_indexes, input_file_contents.clone)
353
364
 
@@ -923,7 +934,7 @@ def compile_conditional_structures(input_file_contents, temporary_nila_file)
923
934
 
924
935
  input_file_contents = input_file_contents.collect {|element| element.gsub("forEach","fuuuuurEEEEEach")}
925
936
 
926
- possible_for_statements = input_file_contents.reject { |element| !element.include?("for") }
937
+ possible_for_statements = input_file_contents.reject { |element| !replace_strings(element).include?("for") }
927
938
 
928
939
  possible_for_statements = possible_for_statements.reject {|element| element.include?("for (")}
929
940
 
@@ -1195,10 +1206,20 @@ def compile_conditional_structures(input_file_contents, temporary_nila_file)
1195
1206
 
1196
1207
  return modified_input_block
1197
1208
 
1209
+ end
1210
+
1211
+ def compile_inline_loop(input_loop)
1212
+
1213
+
1214
+
1198
1215
  end
1199
1216
 
1200
1217
  possible_loop_statements = input_file_contents.reject { |element| !element.include?("loop") }
1201
1218
 
1219
+ inline_loops = possible_loop_statements.reject{|element| element.include?("do")}
1220
+
1221
+ possible_loop_statements = possible_loop_statements - inline_loops
1222
+
1202
1223
  if !possible_loop_statements.empty?
1203
1224
 
1204
1225
  loop_statement_indexes = []
@@ -1211,6 +1232,8 @@ def compile_conditional_structures(input_file_contents, temporary_nila_file)
1211
1232
 
1212
1233
  loop_statement_indexes = [0] + loop_statement_indexes.flatten + [-1]
1213
1234
 
1235
+ loop_statement_indexes = loop_statement_indexes.uniq
1236
+
1214
1237
  controlregexp = /(if |def )/
1215
1238
 
1216
1239
  modified_input_contents, extracted_statements = extract_loop_blocks(loop_statement_indexes, input_file_contents.clone)