mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 19:41:51 +00:00
feat: custom languages syntax (WIP)
This commit is contained in:
parent
4360cd408b
commit
5253be6c56
18 changed files with 278 additions and 88 deletions
29
src/devtools/SyntaxProcessor.hpp
Normal file
29
src/devtools/SyntaxProcessor.hpp
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#pragma once
|
||||
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
struct FontStylesScheme;
|
||||
|
||||
namespace devtools {
|
||||
struct Syntax;
|
||||
|
||||
enum SyntaxStyles {
|
||||
DEFAULT, KEYWORD, LITERAL, COMMENT, ERROR
|
||||
};
|
||||
|
||||
class SyntaxProcessor {
|
||||
public:
|
||||
std::unique_ptr<FontStylesScheme> highlight(
|
||||
const std::string& ext, std::wstring_view source
|
||||
) const;
|
||||
|
||||
void addSyntax(std::unique_ptr<Syntax> syntax);
|
||||
private:
|
||||
std::vector<std::unique_ptr<Syntax>> langs;
|
||||
std::unordered_map<std::string, const Syntax*> langsExtensions;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue