lib/nilac/compile_interpolated_strings.rb in nilac-0.0.4.3.9.3 vs lib/nilac/compile_interpolated_strings.rb in nilac-0.0.4.3.9.4

- old
+ new

@@ -1,9 +1,39 @@ require_relative 'find_all_matching_indices' def compile_interpolated_strings(input_file_contents) + def replace_string_arrays(input_string) + + def extract(input_string, pattern_start, pattern_end) + + all_start_locations = find_all_matching_indices(input_string, pattern_start) + + all_end_locations = find_all_matching_indices(input_string, pattern_end) + + pattern = [] + + all_start_locations.each_with_index do |location, index| + + pattern << input_string[location..all_end_locations[index]] + + end + + return pattern + + end + + if input_string.include?("%W") + + input_string = input_string.sub(extract(input_string,"%W{","}\n")[0],"--stringarray") + + end + + return input_string + + end + modified_file_contents = input_file_contents.dup single_quoted_strings = input_file_contents.reject { |element| !(element.count("'") >= 2) } single_quoted_strings.each do |str| @@ -24,10 +54,10 @@ end input_file_contents.each_with_index do |line, index| - if line.include?("\#{") + if replace_string_arrays(line+"\n").include?("\#{") modified_line = line.dup interpol_starting_loc = find_all_matching_indices(modified_line, "\#{") + [-1] \ No newline at end of file