mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-23 19:36:26 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
33 lines
736 B
C++
33 lines
736 B
C++
#pragma once
|
|
#include <sstream>
|
|
|
|
#include "TokenList.h"
|
|
#include <vector>
|
|
#include <map>
|
|
#include <optional>
|
|
|
|
class LanguageTree;
|
|
struct Grammar;
|
|
|
|
struct RematchOptions
|
|
{
|
|
std::string token;
|
|
size_t reach;
|
|
int j;
|
|
};
|
|
|
|
class SyntaxHighlighter
|
|
{
|
|
public:
|
|
SyntaxHighlighter(const std::string& languages);
|
|
|
|
TokenList tokenize(const std::string& text, const std::string& language);
|
|
|
|
std::map<std::string, std::string> languages() const;
|
|
|
|
private:
|
|
TokenList tokenize(std::string_view text, const Grammar* grammar);
|
|
void matchGrammar(std::string_view text, TokenList& tokenList, const Grammar* grammar, TokenListPtr startNode, size_t startPos, RematchOptions* rematch);
|
|
|
|
std::shared_ptr<LanguageTree> m_tree;
|
|
}; |