Compare commits
3 Commits
41441ba0a1
...
4c79cf6808
Author | SHA1 | Date |
---|---|---|
Brett | 4c79cf6808 | |
Brett | e79741d448 | |
Brett | 033068ff74 |
Binary file not shown.
|
@ -1,10 +1,10 @@
|
||||||
# ninja log v5
|
# ninja log v5
|
||||||
3 1437 1703269248001211383 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o 7372d87554025941
|
3 1437 1703269248001211383 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/string.cpp.o 7372d87554025941
|
||||||
1 1383 1703299843831973242 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
1 1319 1703313187097385701 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||||
3 3035 1703269249601195503 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 6b34ee1aa4557b8
|
3 3035 1703269249601195503 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/system.cpp.o 6b34ee1aa4557b8
|
||||||
4 6430 1703269252993161839 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler_v2.cpp.o f7d76198a6666d0a
|
4 6430 1703269252993161839 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler_v2.cpp.o f7d76198a6666d0a
|
||||||
3 4901 1703269251465177003 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 98c3613a268835f7
|
3 4901 1703269251465177003 libraries/BLT/CMakeFiles/BLT.dir/src/blt/profiling/profiler.cpp.o 98c3613a268835f7
|
||||||
0 552 1703299907953718140 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
1 505 1703313186281395730 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||||
2 4864 1703269251429177360 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 86854dbc10b97205
|
2 4864 1703269251429177360 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/format.cpp.o 86854dbc10b97205
|
||||||
5 6828 1703269253393157869 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o c25a8a66b746b95f
|
5 6828 1703269253393157869 libraries/BLT/CMakeFiles/BLT.dir/src/blt/parse/argparse.cpp.o c25a8a66b746b95f
|
||||||
6829 6962 1703269253521156599 libraries/BLT/libBLT.a f5b601d9b774b003
|
6829 6962 1703269253521156599 libraries/BLT/libBLT.a f5b601d9b774b003
|
||||||
|
@ -12,18 +12,13 @@
|
||||||
2 2026 1703269248589205547 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o c1e2cebc92cff5ff
|
2 2026 1703269248589205547 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/loader.cpp.o c1e2cebc92cff5ff
|
||||||
4 891 1703269247453216823 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o c189cbf7574512a
|
4 891 1703269247453216823 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt_block.cpp.o c189cbf7574512a
|
||||||
4 3961 1703269250525186332 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 439363bdbfdd4452
|
4 3961 1703269250525186332 libraries/BLT/CMakeFiles/BLT.dir/src/blt/nbt/nbt.cpp.o 439363bdbfdd4452
|
||||||
552 591 1703299907989719007 gl_doc_generator 7126d327cf7747a5
|
1319 1357 1703313187133385258 gl_doc_generator 7126d327cf7747a5
|
||||||
1 1470 1703269248033211066 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 1c0fd59b23c040f5
|
1 1470 1703269248033211066 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/filesystem.cpp.o 1c0fd59b23c040f5
|
||||||
1 2400 1703269248965201816 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 8c3d34b2a042cd0c
|
1 2400 1703269248965201816 libraries/BLT/CMakeFiles/BLT.dir/src/blt/std/assert.cpp.o 8c3d34b2a042cd0c
|
||||||
1 553 1703299929682218495 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
1 634 1703316313529228992 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||||
553 593 1703299929722219376 gl_doc_generator 7126d327cf7747a5
|
1 1475 1703316327113168829 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||||
1 1387 1703299942986503590 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
1475 1531 1703316327169168575 gl_doc_generator 7126d327cf7747a5
|
||||||
1387 1440 1703299943038504672 gl_doc_generator 7126d327cf7747a5
|
1 1448 1703316339001113988 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
||||||
0 1394 1703299946414574483 CMakeFiles/gl_doc_generator.dir/src/main.cpp.o f2846e1dc111dd8
|
1448 1500 1703316339049113762 gl_doc_generator 7126d327cf7747a5
|
||||||
1394 1435 1703299946454575304 gl_doc_generator 7126d327cf7747a5
|
1 603 1703316356065031799 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
||||||
1 543 1703299973027090309 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
603 652 1703316356113031561 gl_doc_generator 7126d327cf7747a5
|
||||||
543 587 1703299973071091110 gl_doc_generator 7126d327cf7747a5
|
|
||||||
0 523 1703299995183474531 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
|
||||||
523 565 1703299995223475188 gl_doc_generator 7126d327cf7747a5
|
|
||||||
1 528 1703300016059800637 CMakeFiles/gl_doc_generator.dir/src/load_file.cpp.o e3be46751e904b25
|
|
||||||
528 566 1703300016095801169 gl_doc_generator 7126d327cf7747a5
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -1,3 +1,3 @@
|
||||||
Start testing: Dec 22 21:53 EST
|
Start testing: Dec 23 02:25 EST
|
||||||
----------------------------------------------------------
|
----------------------------------------------------------
|
||||||
End testing: Dec 22 21:53 EST
|
End testing: Dec 23 02:25 EST
|
||||||
|
|
Binary file not shown.
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
#include "load_file.h"
|
#include "load_file.h"
|
||||||
#include <blt/std/loader.h>
|
#include <blt/std/loader.h>
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
namespace blt
|
namespace blt
|
||||||
{
|
{
|
||||||
|
@ -59,7 +60,7 @@ namespace blt
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
BLT_TRACE("We have '%c' with '%s' at index %d state %d", c, data.c_str(), index, state);
|
//BLT_TRACE("We have '%c' with '%s' at index %d state %d", c, data.c_str(), index, state);
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -74,14 +75,14 @@ namespace blt
|
||||||
auto s3 = full_data.find(' ', s2);
|
auto s3 = full_data.find(' ', s2);
|
||||||
if (s3 == std::string_view::npos)
|
if (s3 == std::string_view::npos)
|
||||||
s3 = full_data.size();
|
s3 = full_data.size();
|
||||||
if (blt::string::starts_with(full_data, "#define"))
|
if (blt::string::starts_with(full_data, "#define gl"))
|
||||||
process_gl_func(std::string_view(&full_data[s1], s3 - s1));
|
process_gl_func(std::string_view(&full_data[s1], s3 - s1));
|
||||||
reset();
|
reset();
|
||||||
} else if (c == '\n')
|
} else if (c == '\n')
|
||||||
last = false;
|
last = false;
|
||||||
else if (c == '\\')
|
else if (c == '\\')
|
||||||
last = true;
|
last = true;
|
||||||
else if (!(std::isalpha(c) || c == '_' || std::isspace(c)))
|
else if (!(is_ident(c) || std::isspace(c)))
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case state_type::IDENTIFIER:
|
case state_type::IDENTIFIER:
|
||||||
|
@ -89,47 +90,78 @@ namespace blt
|
||||||
state = state_type::FUNCTION;
|
state = state_type::FUNCTION;
|
||||||
else if (std::isspace(c))
|
else if (std::isspace(c))
|
||||||
state = state_type::POSSIBLE_FUNC;
|
state = state_type::POSSIBLE_FUNC;
|
||||||
else if (!(std::isalnum(c) || c == '_'))
|
else if (!is_ident(c))
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case state_type::POSSIBLE_FUNC:
|
case state_type::POSSIBLE_FUNC:
|
||||||
if (c == '(')
|
if (c == '(')
|
||||||
state = state_type::POSSIBLE_FUNC;
|
state = state_type::FUNCTION;
|
||||||
else if (!std::isspace(c))
|
else if (!std::isspace(c))
|
||||||
|
{
|
||||||
|
if (is_ident(c))
|
||||||
|
state = state_type::FUNCTION;
|
||||||
|
else
|
||||||
reset();
|
reset();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case state_type::FUNCTION:
|
case state_type::FUNCTION:
|
||||||
if (c == '{')
|
if (c == ')')
|
||||||
{
|
{
|
||||||
// state = state_type::OTHER;
|
// Jacob if you're actually reading this, this is all ugly & hacky code :3
|
||||||
// state_container con;
|
// please dm that you've read to here <3
|
||||||
// con.type = state_type::FUNCTION;
|
// enjoy trying to understand it.
|
||||||
// con.full_data = data;
|
auto end = data.find('(') - 1;
|
||||||
// data = "";
|
// gotta remove whitespace
|
||||||
// con.data = std::string_view(con.full_data.data(), con.full_data.find('('));
|
while (end > 0 && std::isspace(data[end]))
|
||||||
BLT_DEBUG(data);
|
end--;
|
||||||
|
// end isn't inclusive
|
||||||
|
end += 1;
|
||||||
|
// begin is
|
||||||
|
auto begin = end - 1;
|
||||||
|
while (begin > 0 && is_ident(data[begin]))
|
||||||
|
begin--;
|
||||||
|
// skip the ws
|
||||||
|
begin += 1;
|
||||||
|
auto sv = std::string_view(&data[begin], end - begin);
|
||||||
|
if (blt::string::starts_with(sv, "gl"))
|
||||||
|
process_gl_func(sv);
|
||||||
reset();
|
reset();
|
||||||
} else if (!(c == ')' || std::isalnum(c) || c == ',' || std::isblank(c)))
|
} else if (!(c == '(' || is_ident(c) || c == ',' || std::isspace(c)))
|
||||||
reset();
|
reset();
|
||||||
break;
|
break;
|
||||||
case state_type::OTHER:
|
case state_type::OTHER:
|
||||||
if (c == '#')
|
if (c == '#')
|
||||||
state = state_type::PREPROCESSOR_DEFINE;
|
state = state_type::PREPROCESSOR_DEFINE;
|
||||||
else if (c == '\n')
|
else if (std::isspace(c))
|
||||||
reset();
|
reset();
|
||||||
else if (data.size() <= 1 && (std::isalpha(c) || c == '_'))
|
else if (data.size() <= 1 && is_ident_b(c))
|
||||||
state = state_type::IDENTIFIER;
|
state = state_type::IDENTIFIER;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BLT_DEBUG("Finished in state %d", (int) state);
|
// BLT_DEBUG("Finished in state %d", (int) state);
|
||||||
// BLT_DEBUG("With data %s", parsed.c_str());
|
// BLT_DEBUG("With data %s", parsed.c_str());
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parser::process_gl_func(std::string_view func_name)
|
void parser::process_gl_func(std::string_view func_name)
|
||||||
{
|
{
|
||||||
BLT_INFO("Running on function %s", std::string(func_name).c_str());
|
// std::string reference_link = "https://registry.khronos.org/OpenGL-Refpages/gl4/html/";
|
||||||
|
// reference_link.reserve(func_name.length() + 6);
|
||||||
|
// reference_link += func_name;
|
||||||
|
// reference_link += ".xhtml";
|
||||||
|
// auto pid = popen(pythonPath + " " + generatorPath + " " + reference_link, "r");
|
||||||
|
// BLT_INFO("Running on function %s", std::string(func_name).c_str());
|
||||||
|
std::cout << std::string(func_name) << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string parser::strip_func(std::string_view func)
|
||||||
|
{
|
||||||
|
std::string f (func);
|
||||||
|
|
||||||
|
std::regex matrx(R"(((Matrix)(\d|\w)+)|(\d|I|L)+(i|u|f|d|v|s|N|b|I)+)");
|
||||||
|
|
||||||
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -22,6 +22,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <blt/std/logging.h>
|
#include <blt/std/logging.h>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
namespace blt
|
namespace blt
|
||||||
{
|
{
|
||||||
|
@ -31,7 +32,7 @@ namespace blt
|
||||||
OTHER, // literally anything else (we do not care about it)
|
OTHER, // literally anything else (we do not care about it)
|
||||||
PREPROCESSOR_DEFINE, // #define
|
PREPROCESSOR_DEFINE, // #define
|
||||||
IDENTIFIER, // either a variable or a type (void / thisismyvar)
|
IDENTIFIER, // either a variable or a type (void / thisismyvar)
|
||||||
POSSIBLE_FUNC,
|
POSSIBLE_FUNC, // we had an identifier and found a space
|
||||||
FUNCTION // myfunctioname(
|
FUNCTION // myfunctioname(
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,6 +50,9 @@ namespace blt
|
||||||
std::string file;
|
std::string file;
|
||||||
std::string data;
|
std::string data;
|
||||||
std::string parsed;
|
std::string parsed;
|
||||||
|
|
||||||
|
std::string pythonPath;
|
||||||
|
std::string generatorPath;
|
||||||
state_type state = state_type::OTHER;
|
state_type state = state_type::OTHER;
|
||||||
std::vector<state_container> parsed_tokens;
|
std::vector<state_container> parsed_tokens;
|
||||||
|
|
||||||
|
@ -59,10 +63,22 @@ namespace blt
|
||||||
data.clear();
|
data.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline static bool is_ident_b(char c)
|
||||||
|
{
|
||||||
|
return std::isalpha(c) || c == '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
inline static bool is_ident(char c)
|
||||||
|
{
|
||||||
|
return std::isalnum(c) || c == '_';
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string strip_func(std::string_view func);
|
||||||
void process_gl_func(std::string_view func_name);
|
void process_gl_func(std::string_view func_name);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit parser(std::string_view path): path(path)
|
explicit parser(std::string_view path, std::string_view pythonPath, std::string_view generatorPath):
|
||||||
|
path(path), pythonPath(pythonPath), generatorPath(generatorPath)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
parser& load_file();
|
parser& load_file();
|
||||||
|
|
|
@ -25,11 +25,11 @@ int main(int argc, const char** argv)
|
||||||
|
|
||||||
BLT_INFO("Using %s on file %s", generatorPath.c_str(), filePath.c_str());
|
BLT_INFO("Using %s on file %s", generatorPath.c_str(), filePath.c_str());
|
||||||
|
|
||||||
blt::parser file_parser(filePath);
|
blt::parser file_parser(filePath, pythonPath, generatorPath);
|
||||||
file_parser.load_file().parse();
|
file_parser.load_file().parse();
|
||||||
auto vec = file_parser.get();
|
auto vec = file_parser.get();
|
||||||
|
|
||||||
BLT_DEBUG("Result:\n%s", vec.c_str());
|
//BLT_DEBUG("Result:\n%s", vec.c_str());
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue