{"size": 778, "ext": "js", "max_stars_repo_path": "index.js", "max_stars_repo_name": "montyanderson/soundfont-parser", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "index.js", "max_issues_repo_name": "montyanderson/soundfont-parser", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "index.js", "max_forks_repo_name": "montyanderson/soundfont-parser", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 16.9130434783, "max_line_length": 57, "alphanum_fraction": 0.5167095116}
module.exports = function soundfontParser(file) {
	const groups = [];
	let group;
	let region;

	for(let line of file.split("\n")) {
		line = line.trim();

		if(line === "") {

		} else if(line.startsWith("//")) {

		} else if(line.startsWith("<") && line.endsWith(">")) {
			const tag = line.slice(1, -1);

			if(tag === "group") {
				group = {
					regions: []
				};

				groups.push(group);

				region = null;
			} else if(tag === "region") {
				region = {};

				group.regions.push(region);
			} else {
				throw new Error(`tag '${tag}' unrecognised`);
			}
		} else {
			for(let pair of line.split(" ")) {
				const [ key, value ] = pair.split("=");

				if(region) {
					region[key] = value;
				} else {
					group[key] = value;
				}
			}
		}
	}

	return groups;
}
