From 32865b5841ad5e936318cca3d494326136def061 Mon Sep 17 00:00:00 2001 From: paulfd Date: Sat, 21 Sep 2019 01:06:47 +0200 Subject: [PATCH] Regexes get their own file --- sfizz/Parser.cpp | 2 ++ sfizz/Parser.h | 11 +---------- tests/RegexT.cpp | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/sfizz/Parser.cpp b/sfizz/Parser.cpp index e5b18ab4..307c0664 100644 --- a/sfizz/Parser.cpp +++ b/sfizz/Parser.cpp @@ -26,7 +26,9 @@ #include "StringViewHelpers.h" #include "absl/strings/str_join.h" #include "absl/strings/str_cat.h" +#include "Regexes.h" #include +#include #include using svregex_iterator = std::regex_iterator; diff --git a/sfizz/Parser.h b/sfizz/Parser.h index 7c300a25..481b6eb0 100644 --- a/sfizz/Parser.h +++ b/sfizz/Parser.h @@ -25,20 +25,11 @@ #include "Opcode.h" #include "compat/filesystem.h" #include -#include #include -#include +#include "absl/strings/string_view.h" #include namespace sfz { -namespace Regexes { - SFZ_INLINE static std::regex includes { R"V(#include\s*"(.*?)".*$)V", std::regex::optimize }; - SFZ_INLINE static std::regex defines { R"(#define\s*(\$[a-zA-Z0-9]+)\s+([a-zA-Z0-9]+)(?=\s|$))", std::regex::optimize }; - SFZ_INLINE static std::regex headers { R"(<(.*?)>(.*?)(?=<|$))", std::regex::optimize }; - SFZ_INLINE static std::regex members { R"(([a-zA-Z0-9_]+)=([a-zA-Z0-9-_#.&\/\s\\\(\),\*]+)(?![a-zA-Z0-9_]*=))", std::regex::optimize }; - SFZ_INLINE static std::regex opcodeParameters { R"(([a-zA-Z0-9_]+?)([0-9]+)$)", std::regex::optimize }; -} - class Parser { public: virtual bool loadSfzFile(const std::filesystem::path& file); diff --git a/tests/RegexT.cpp b/tests/RegexT.cpp index 50c79a06..836c7637 100644 --- a/tests/RegexT.cpp +++ b/tests/RegexT.cpp @@ -21,7 +21,7 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -#include "Parser.h" +#include "Regexes.h" #include "catch2/catch.hpp" using namespace Catch::literals;