Regexes get their own file

This commit is contained in:
paulfd 2019-09-21 01:06:47 +02:00
parent 144916bd39
commit 32865b5841
3 changed files with 4 additions and 11 deletions

View file

@ -26,7 +26,9 @@
#include "StringViewHelpers.h"
#include "absl/strings/str_join.h"
#include "absl/strings/str_cat.h"
#include "Regexes.h"
#include <algorithm>
#include <regex>
#include <fstream>
using svregex_iterator = std::regex_iterator<absl::string_view::const_iterator>;

View file

@ -25,20 +25,11 @@
#include "Opcode.h"
#include "compat/filesystem.h"
#include <map>
#include <regex>
#include <string>
#include <string_view>
#include "absl/strings/string_view.h"
#include <vector>
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);

View file

@ -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;