add markdown dialect (WIP) & add strikethrough and underline font styles

This commit is contained in:
MihailRis
2024-12-06 17:35:03 +03:00
parent 605d7e7897
commit 80e809f97f
15 changed files with 296 additions and 58 deletions
+1
View File
@@ -5,6 +5,7 @@
#include "commons.hpp"
using namespace lua;
using namespace devtools;
static std::set<std::string_view> keywords {
"and", "break", "do", "else", "elseif", "end", "false", "for", "function",
+5 -26
View File
@@ -3,33 +3,12 @@
#include <string>
#include <vector>
#include "devtools/syntax.hpp"
namespace lua {
struct Location {
int pos;
int lineStart;
int line;
};
enum class TokenTag {
KEYWORD, NAME, INTEGER, NUMBER, OPEN_BRACKET, CLOSE_BRACKET, STRING,
OPERATOR, COMMA, SEMICOLON, UNEXPECTED, COMMENT
};
struct Token {
TokenTag tag;
std::string text;
Location start;
Location end;
Token(TokenTag tag, std::string text, Location start, Location end)
: tag(tag),
text(std::move(text)),
start(std::move(start)),
end(std::move(end)) {
}
};
bool is_lua_keyword(std::string_view view);
std::vector<Token> tokenize(std::string_view file, std::string_view source);
std::vector<devtools::Token> tokenize(
std::string_view file, std::string_view source
);
}