refactor: rename coders/lua_parsing to coders/syntax_parser
This commit is contained in:
parent
d888ddec4c
commit
4360cd408b
@ -1,10 +1,9 @@
|
||||
#include "lua_parsing.hpp"
|
||||
#include "syntax_parser.hpp"
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "BasicParser.hpp"
|
||||
|
||||
using namespace lua;
|
||||
using namespace devtools;
|
||||
|
||||
static std::set<std::wstring_view> keywords {
|
||||
@ -188,6 +187,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<Token> lua::tokenize(std::string_view file, std::wstring_view source) {
|
||||
std::vector<Token> devtools::tokenize(
|
||||
std::string_view file, std::wstring_view source
|
||||
) {
|
||||
return Tokenizer(file, source).tokenize();
|
||||
}
|
||||
@ -5,8 +5,8 @@
|
||||
|
||||
#include "devtools/syntax.hpp"
|
||||
|
||||
namespace lua {
|
||||
std::vector<devtools::Token> tokenize(
|
||||
namespace devtools {
|
||||
std::vector<Token> tokenize(
|
||||
std::string_view file, std::wstring_view source
|
||||
);
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
#include "syntax_highlighting.hpp"
|
||||
|
||||
#include "coders/commons.hpp"
|
||||
#include "coders/lua_parsing.hpp"
|
||||
#include "coders/syntax_parser.hpp"
|
||||
#include "graphics/core/Font.hpp"
|
||||
|
||||
using namespace devtools;
|
||||
@ -60,7 +60,7 @@ std::unique_ptr<FontStylesScheme> devtools::syntax_highlight(
|
||||
) {
|
||||
try {
|
||||
if (lang == "lua") {
|
||||
auto tokens = lua::tokenize("<string>", source);
|
||||
auto tokens = tokenize("<string>", source);
|
||||
return build_styles(tokens);
|
||||
} else {
|
||||
return nullptr;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "coders/lua_parsing.hpp"
|
||||
#include "coders/syntax_parser.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
@ -14,7 +14,7 @@ TEST(lua_parsing, Tokenizer) {
|
||||
auto filename = "res:scripts/stdlib.lua";
|
||||
auto source = io::read_string(filename);
|
||||
try {
|
||||
auto tokens = lua::tokenize(filename, util::str2wstr_utf8(source));
|
||||
auto tokens = devtools::tokenize(filename, util::str2wstr_utf8(source));
|
||||
for (const auto& token : tokens) {
|
||||
std::cout << (int)token.tag << " "
|
||||
<< util::quote(util::wstr2str_utf8(token.text))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user