From 664fa86acd90acaf1c5f54a336f5894f21415282 Mon Sep 17 00:00:00 2001 From: dx <aryadevchavali1@gmail.com> Date: Sat, 23 May 2020 19:56:28 +0100 Subject: +compiler c++ file implementation file for compiler.hpp. Currently I have regexes and replacement strings that use the Type enum to access the correct ones (Italic (the first enum item) has its regex and replacement at 0). --- Compiler/src/compiler.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Compiler/src/compiler.cpp (limited to 'Compiler/src') diff --git a/Compiler/src/compiler.cpp b/Compiler/src/compiler.cpp new file mode 100644 index 0000000..fd45e78 --- /dev/null +++ b/Compiler/src/compiler.cpp @@ -0,0 +1,12 @@ +#include "../includes/compiler.hpp" +#include <regex> + +/* Encoded regexes using the Type enum (convert to integer) */ +static const std::regex REGEXES[] = { + std::regex("\\*(.*?)\\*"), std::regex("\\*\\*(.*?)\\*\\*"), + std::regex("_(.*?)_"), std::regex("~(.*?)~"), std::regex("-(.*)")}; + +/* Encoded replacement strings using the Type enum (convert to integer) */ +static const char *REPLACEMENTS[] = {"<i>$1</i>", "<strong>$1</strong>", + "<u>$1</u>", "<s>$1</s>", "<li>$1</li>"}; + -- cgit v1.2.3-13-gbd6f