From 4457a711cd1b7682acdc04e00d9f25d1cf9c5c5a Mon Sep 17 00:00:00 2001 From: Riyyi Date: Fri, 1 Jul 2022 11:28:43 +0200 Subject: [PATCH] Util: Remove debugging printf() statements --- src/util/json/lexer.cpp | 12 ------------ src/util/json/lexer.h | 2 +- src/util/json/parser.cpp | 11 ----------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/src/util/json/lexer.cpp b/src/util/json/lexer.cpp index 9fb7089..627739b 100644 --- a/src/util/json/lexer.cpp +++ b/src/util/json/lexer.cpp @@ -26,35 +26,24 @@ Lexer::~Lexer() void Lexer::analyze() { - printf("---------\n"); - printf("Input JSON:\n%s\n", m_job->input().c_str()); - printf("---------\n"); - printf("Lexing:\n"); - while (m_index < m_job->input().length()) { switch (peek()) { case '{': - printf("Pushing -> BraceOpen: \"{\"\t%zu[%zu]\n", m_line, m_column); m_tokens->push_back({ Token::Type::BraceOpen, m_line, m_column, "{" }); break; case '}': - printf("Pushing -> BraceClose: \"}\"\t%zu[%zu]\n", m_line, m_column); m_tokens->push_back({ Token::Type::BraceClose, m_line, m_column, "}" }); break; case '[': - printf("Pushing -> BracketOpen: \"[\"\t%zu[%zu]\n", m_line, m_column); m_tokens->push_back({ Token::Type::BracketOpen, m_line, m_column, "[" }); break; case ']': - printf("Pushing -> BracketClose: \"]\"\t%zu[%zu]\n", m_line, m_column); m_tokens->push_back({ Token::Type::BracketClose, m_line, m_column, "]" }); break; case ':': - printf("Pushing -> Colon: \":\"\t%zu[%zu]\n", m_line, m_column); m_tokens->push_back({ Token::Type::Colon, m_line, m_column, ":" }); break; case ',': - printf("Pushing -> Comma: \",\"\t%zu[%zu]\n", m_line, m_column); m_tokens->push_back({ Token::Type::Comma, m_line, m_column, "," }); break; case '"': @@ -207,7 +196,6 @@ bool Lexer::getString() } } - printf("Pushing -> String: \"%s\"\t%zu[%zu]\n", symbol.c_str(), m_line, column); m_tokens->push_back({ Token::Type::String, m_line, column, symbol }); if (character != '"') { diff --git a/src/util/json/lexer.h b/src/util/json/lexer.h index e6a46c2..23d4dac 100644 --- a/src/util/json/lexer.h +++ b/src/util/json/lexer.h @@ -8,7 +8,7 @@ #define JSON_LEXER_H // The JavaScript Object Notation (JSON) Data Interchange Format -// home/rick/code/cpp/manafiles/ https://www.rfc-editor.org/rfc/pdfrfc/rfc8259.txt.pdf +// https://www.rfc-editor.org/rfc/pdfrfc/rfc8259.txt.pdf #include // size_t #include // shared_ptr diff --git a/src/util/json/parser.cpp b/src/util/json/parser.cpp index 3c2eb9a..f1ec12f 100644 --- a/src/util/json/parser.cpp +++ b/src/util/json/parser.cpp @@ -33,9 +33,6 @@ Parser::~Parser() Value Parser::parse() { - printf("---------\n"); - printf("Parsing:\n"); - Value result; Token token; @@ -320,15 +317,12 @@ Value Parser::getArray() token = peek(); if (token.type == Token::Type::Literal) { - printf("Adding literal to array.. v:{%s}, t:{%d}\n", token.symbol.c_str(), (int)token.type); array.emplace_back(getLiteral()); } else if (token.type == Token::Type::Number) { - printf("Adding number to array.. v:{%s}, t:{%d} -> %f\n", token.symbol.c_str(), (int)token.type, std::stod(token.symbol)); array.emplace_back(getNumber()); } else if (token.type == Token::Type::String) { - printf("Adding string to array.. v:{%s}, t:{%d}\n", token.symbol.c_str(), (int)token.type); array.emplace_back(getString()); } else if (token.type == Token::Type::BracketOpen) { @@ -424,17 +418,12 @@ Value Parser::getObject() // Add member (name:value pair) to object token = peek(); if (token.type == Token::Type::Literal) { - printf("Adding literal to object.. k:{%s}, v:{%s}, t:{%d}\n", name.c_str(), token.symbol.c_str(), (int)token.type); object[name] = getLiteral(); } else if (token.type == Token::Type::Number) { - printf("Adding number to object.. k:{%s}, v:{%s}, t:{%d} -> %f\n", name.c_str(), token.symbol.c_str(), (int)token.type, std::stod(token.symbol)); object[name] = getNumber(); } else if (token.type == Token::Type::String) { -#ifdef JSON_DEBUG - printf("Adding string to object.. k:{%s}, v:{%s}, t:{%d}\n", name.c_str(), token.symbol.c_str(), (int)token.type); -#endif object[name] = getString(); } else if (token.type == Token::Type::BracketOpen) {