all methods in camelCase

This commit is contained in:
jorenchik
2024-10-06 12:54:44 +03:00
parent 1c6e28468e
commit 1622283323
10 changed files with 14 additions and 14 deletions

View File

@@ -1,4 +1,4 @@
#include "result.h" #include "result.h"
#include "parser.h" #include "parser.h"
Result<ParseInfo> Transpile(std::string fileContent, bool isDebug); Result<ParseInfo> transpile(std::string fileContent, bool isDebug);

View File

@@ -29,4 +29,4 @@ struct Token {
static std::string ToString(const TokenType* ttype); static std::string ToString(const TokenType* ttype);
}; };
Result<std::vector<Token>> TokenizeMdem(const std::string& fileRunes); Result<std::vector<Token>> tokenizeMdem(const std::string& fileRunes);

View File

@@ -50,4 +50,4 @@ struct ParseInfo {
time_t lastTrainedAt; time_t lastTrainedAt;
}; };
Result<ParseInfo> ParseQuestions(const std::vector<Token>& tokens); Result<ParseInfo> parseQuestions(const std::vector<Token>& tokens);

View File

@@ -394,7 +394,7 @@ void loadMdem() {
std::stringstream buffer; std::stringstream buffer;
buffer << file.rdbuf(); buffer << file.rdbuf();
content = buffer.str(); content = buffer.str();
auto res = Transpile(content, true); auto res = transpile(content, true);
for (auto question: questions) { for (auto question: questions) {
delete question; delete question;
} }

View File

@@ -12,12 +12,12 @@ bool debug;
std::chrono::high_resolution_clock::time_point start; std::chrono::high_resolution_clock::time_point start;
std::chrono::high_resolution_clock::time_point end; std::chrono::high_resolution_clock::time_point end;
Result<ParseInfo> Transpile(std::string fileContent, bool isDebug) { Result<ParseInfo> transpile(std::string fileContent, bool isDebug) {
start = std::chrono::high_resolution_clock::now(); start = std::chrono::high_resolution_clock::now();
end = std::chrono::high_resolution_clock::now(); end = std::chrono::high_resolution_clock::now();
debug = isDebug; debug = isDebug;
auto lexRes = TokenizeMdem(fileContent); auto lexRes = tokenizeMdem(fileContent);
auto tokens = lexRes.value; auto tokens = lexRes.value;
if (lexRes.error.length() > 0) { if (lexRes.error.length() > 0) {
return { return {
@@ -31,7 +31,7 @@ Result<ParseInfo> Transpile(std::string fileContent, bool isDebug) {
}; };
} }
auto parseRes = ParseQuestions(tokens); auto parseRes = parseQuestions(tokens);
auto questions = parseRes.value; auto questions = parseRes.value;
if (parseRes.error.length() > 0) { if (parseRes.error.length() > 0) {
return { return {
@@ -46,6 +46,6 @@ Result<ParseInfo> Transpile(std::string fileContent, bool isDebug) {
} }
end = std::chrono::high_resolution_clock::now(); end = std::chrono::high_resolution_clock::now();
ShowTime("Transpilation time"); showTime("Transpilation time");
return {questions}; return {questions};
} }

View File

@@ -91,7 +91,7 @@ void makeTokenWithTokenBuffer(
buffer.clear(); buffer.clear();
} }
Result<std::vector<Token>> TokenizeMdem(const std::string& fileRunes) { Result<std::vector<Token>> tokenizeMdem(const std::string& fileRunes) {
row = 1; row = 1;
column = 1; column = 1;
previousRow = 1; previousRow = 1;

View File

@@ -47,9 +47,9 @@ int main(int argc, char* argv[]) {
try { try {
std::string fileContent = readFile(filePath); std::string fileContent = readFile(filePath);
end = std::chrono::high_resolution_clock::now(); end = std::chrono::high_resolution_clock::now();
ShowTime("I/O time"); showTime("I/O time");
auto res = Transpile(fileContent, debug); auto res = transpile(fileContent, debug);
auto questions = res.value.questions; auto questions = res.value.questions;
if (res.error.length() > 0) { if (res.error.length() > 0) {
std::cout << std::format( std::cout << std::format(

View File

@@ -141,7 +141,7 @@ Result<NoneType> ValidateGrammar(const std::vector<Token>& tokens) {
return {}; return {};
} }
Result<ParseInfo> ParseQuestions(const std::vector<Token>& tokens) { Result<ParseInfo> parseQuestions(const std::vector<Token>& tokens) {
auto questions = std::vector<Question*>(); auto questions = std::vector<Question*>();
time_t time = 0; time_t time = 0;

View File

@@ -3,7 +3,7 @@
#include "time.h" #include "time.h"
void ShowTime(std::string label) { void showTime(std::string label) {
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start); auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
double_t msDuration = (double_t) duration.count() / 1000; double_t msDuration = (double_t) duration.count() / 1000;
std::cout << std::format("{}: {:.3f} ms", label, msDuration) << std::endl; std::cout << std::format("{}: {:.3f} ms", label, msDuration) << std::endl;

View File

@@ -5,4 +5,4 @@
extern std::chrono::high_resolution_clock::time_point start; extern std::chrono::high_resolution_clock::time_point start;
extern std::chrono::high_resolution_clock::time_point end; extern std::chrono::high_resolution_clock::time_point end;
void ShowTime(std::string label); void showTime(std::string label);