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 "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);
};
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;
};
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;
buffer << file.rdbuf();
content = buffer.str();
auto res = Transpile(content, true);
auto res = transpile(content, true);
for (auto question: questions) {
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 end;
Result<ParseInfo> Transpile(std::string fileContent, bool isDebug) {
Result<ParseInfo> transpile(std::string fileContent, bool isDebug) {
start = std::chrono::high_resolution_clock::now();
end = std::chrono::high_resolution_clock::now();
debug = isDebug;
auto lexRes = TokenizeMdem(fileContent);
auto lexRes = tokenizeMdem(fileContent);
auto tokens = lexRes.value;
if (lexRes.error.length() > 0) {
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;
if (parseRes.error.length() > 0) {
return {
@@ -46,6 +46,6 @@ Result<ParseInfo> Transpile(std::string fileContent, bool isDebug) {
}
end = std::chrono::high_resolution_clock::now();
ShowTime("Transpilation time");
showTime("Transpilation time");
return {questions};
}

View File

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

View File

@@ -47,9 +47,9 @@ int main(int argc, char* argv[]) {
try {
std::string fileContent = readFile(filePath);
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;
if (res.error.length() > 0) {
std::cout << std::format(

View File

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

View File

@@ -3,7 +3,7 @@
#include "time.h"
void ShowTime(std::string label) {
void showTime(std::string label) {
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start);
double_t msDuration = (double_t) duration.count() / 1000;
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 end;
void ShowTime(std::string label);
void showTime(std::string label);