From f466034ac5b6a46dd36291d6d5ae570784a34053 Mon Sep 17 00:00:00 2001 From: Stefan Westerfeld Date: Tue, 11 Jul 2023 14:10:59 +0200 Subject: [PATCH] LIB: ignore extra spaces surrounding '=' in sfz files Fixes #40. Signed-off-by: Stefan Westerfeld --- lib/loader.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/loader.cc b/lib/loader.cc index 0d343aa..ae46266 100644 --- a/lib/loader.cc +++ b/lib/loader.cc @@ -1116,7 +1116,7 @@ Loader::parse (const string& filename, SampleCache& sample_cache) static const regex space_re ("\\s+(.*)"); static const regex tag_re ("<([^>]*)>(.*)"); - static const regex key_val_re ("([a-z0-9_]+)=(\\S+)(.*)"); + static const regex key_val_re ("([a-z0-9_]+)\\s*=\\s*(\\S+)(.*)"); for (auto line_info : lines) { current_line_info = line_info; // for error location reporting @@ -1143,9 +1143,9 @@ Loader::parse (const string& filename, SampleCache& sample_cache) * - value is followed by * - value is followed by another opcode (foo=bar) */ - static const regex key_val_space_re_eol ("([a-z0-9_]+)=([^=<]+)"); - static const regex key_val_space_re_tag ("([a-z0-9_]+)=([^=<]+)(<.*)"); - static const regex key_val_space_re_eq ("([a-z0-9_]+)=([^=<]+)(\\s[a-z0-9_]+=.*)"); + static const regex key_val_space_re_eol ("([a-z0-9_]+)\\s*=([^=<]+)"); + static const regex key_val_space_re_tag ("([a-z0-9_]+)\\s*=([^=<]+)(<.*)"); + static const regex key_val_space_re_eq ("([a-z0-9_]+)\\s*=([^=<]+)(\\s[a-z0-9_]+\\s*=.*)"); if (regex_match (l, sm, key_val_space_re_eol)) {