|
|
|
@ -3,11 +3,12 @@ |
|
|
|
|
#include <iostream> |
|
|
|
|
|
|
|
|
|
namespace groove { |
|
|
|
|
|
|
|
|
|
std::vector<std::pair<std::regex, ncurses::Colors>> Highlighter::list = { |
|
|
|
|
std::unordered_map<Syntax, RulesList> Highlighter::Syntaxes = { |
|
|
|
|
std::make_pair(Syntax::CPP, |
|
|
|
|
RulesList { |
|
|
|
|
make_pair("([+-.<>,;=!:&*])", ncurses::Colors::CYAN), |
|
|
|
|
make_pair("([\\{\\}\\[\\]\\(\\)])", ncurses::Colors::GREEN), |
|
|
|
|
make_pair("(^|\\s)(while|if|try|catch|void|this|else|using|namespace|private|public|protected|friend|class|char|bool|unsigned|long|short|int|return)\\s+\\*?", ncurses::Colors::MAGENTA), |
|
|
|
|
make_pair("(^|\\s)(while|if|try|catch|void|this|else|using|namespace|private|public|protected|friend|class|char|bool|unsigned|long|short|int|return):?(\\s+|$)\\*?", ncurses::Colors::MAGENTA), |
|
|
|
|
make_pair("([a-zA-Z_][a-zA-Z_0-9]+)::", ncurses::Colors::GREEN), |
|
|
|
|
make_pair("::([a-zA-Z_][a-zA-Z_0-9]+)", ncurses::Colors::CYAN), |
|
|
|
|
make_pair("\\.([a-zA-Z_][a-zA-Z_0-9]+)", ncurses::Colors::CYAN), |
|
|
|
@ -15,8 +16,19 @@ namespace groove { |
|
|
|
|
make_pair("\\\".*\\\"", ncurses::Colors::ORANGE), |
|
|
|
|
make_pair("/\\*.*\\*//*", ncurses::Colors::COMMENTS), |
|
|
|
|
make_pair("(//.*)", ncurses::Colors::ORANGE) |
|
|
|
|
}), |
|
|
|
|
std::make_pair(Syntax::DEFAULT, |
|
|
|
|
RulesList { |
|
|
|
|
make_pair("([.,;!\\*])", ncurses::Colors::MAGENTA), |
|
|
|
|
make_pair("([\\{\\}\\[\\]\\(\\)])", ncurses::Colors::GREEN), |
|
|
|
|
make_pair("\\\".*\\\"", ncurses::Colors::ORANGE), |
|
|
|
|
make_pair("/\\*.*\\*//*", ncurses::Colors::COMMENTS), |
|
|
|
|
}) |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RulesList Highlighter::list = RulesList(); |
|
|
|
|
|
|
|
|
|
std::unordered_map<long, std::pair<long, ncurses::Colors>> groove::Highlighter::get() { |
|
|
|
|
std::unordered_map<long, std::pair<long, ncurses::Colors>> list; |
|
|
|
|
|
|
|
|
@ -47,3 +59,5 @@ namespace groove { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|