module Unicoder module Builder class Scripts include Builder include MultiDimensionalArrayBuilder def initialize_index @index = { SCRIPTS: [], SCRIPT_EXTENSIONS: {}, SCRIPT_ALIASES: {}, SCRIPT_NAMES: [], } @reverse_script_names = {} @reverse_script_extension_names = {} end def lookup_extension_names(extension_scripts_string) extension_scripts_string.split(" ").map{ |extension_script| @reverse_script_extension_names[extension_script] } end def parse! parse_file :property_value_aliases, :line, regex: /^sc ; (?\S+?)\s*; (?\S+?)(?:\s*; (?\S+))?$/ do |line| @index[:SCRIPT_NAMES] << line["long"] script_number = @reverse_script_names.size @reverse_script_names[line["long"]] = script_number @index[:SCRIPT_ALIASES][line["short" ]] = script_number @index[:SCRIPT_ALIASES][line["short2"]] = script_number if line["short2"] @reverse_script_extension_names[line["short"]] = script_number end parse_file :scripts, :line, regex: /^(?\S+?)(\.\.(?\S+))?\s+; (?