aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordx <aryadevchavali1@gmail.com>2020-05-23 19:56:28 +0100
committerdx <aryadevchavali1@gmail.com>2020-05-23 20:08:19 +0100
commit664fa86acd90acaf1c5f54a336f5894f21415282 (patch)
tree07144158c9eed08179cd9d5c5e69e1ee96936eb5
parentcc3e5131c9b39fc6422576b6bf1bff5fedeb6169 (diff)
downloadmdhtml-664fa86acd90acaf1c5f54a336f5894f21415282.tar.gz
mdhtml-664fa86acd90acaf1c5f54a336f5894f21415282.tar.bz2
mdhtml-664fa86acd90acaf1c5f54a336f5894f21415282.zip
+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).
-rw-r--r--Compiler/src/compiler.cpp12
1 files changed, 12 insertions, 0 deletions
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>"};
+