mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:17:34 +00:00
LibCpp: Include CPP_DEBUG in AK/Debug.h
This commit is contained in:
parent
8ed65d7b48
commit
2d2b3ba5ed
2 changed files with 11 additions and 6 deletions
|
@ -66,6 +66,10 @@
|
||||||
#cmakedefine01 CPP_LANGUAGE_SERVER_DEBUG
|
#cmakedefine01 CPP_LANGUAGE_SERVER_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef CPP_DEBUG
|
||||||
|
#cmakedefine01 CPP_DEBUG
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CRYPTO_DEBUG
|
#ifndef CRYPTO_DEBUG
|
||||||
#cmakedefine01 CRYPTO_DEBUG
|
#cmakedefine01 CRYPTO_DEBUG
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define CPP_DEBUG
|
|
||||||
|
|
||||||
#ifdef CPP_DEBUG
|
#ifdef CPP_DEBUG
|
||||||
# define DEBUG_SPAM
|
# define DEBUG_SPAM
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,6 +31,7 @@
|
||||||
#include "Parser.h"
|
#include "Parser.h"
|
||||||
#include "AK/LogStream.h"
|
#include "AK/LogStream.h"
|
||||||
#include "AST.h"
|
#include "AST.h"
|
||||||
|
#include <AK/Debug.h>
|
||||||
#include <AK/ScopeGuard.h>
|
#include <AK/ScopeGuard.h>
|
||||||
#include <AK/ScopeLogger.h>
|
#include <AK/ScopeLogger.h>
|
||||||
#include <LibCpp/Lexer.h>
|
#include <LibCpp/Lexer.h>
|
||||||
|
@ -49,7 +48,7 @@ Parser::Parser(const StringView& program)
|
||||||
continue;
|
continue;
|
||||||
m_tokens.append(move(token));
|
m_tokens.append(move(token));
|
||||||
}
|
}
|
||||||
#ifdef CPP_DEBUG
|
#if CPP_DEBUG
|
||||||
dbgln("Program:");
|
dbgln("Program:");
|
||||||
dbgln("{}", m_program);
|
dbgln("{}", m_program);
|
||||||
dbgln("Tokens:");
|
dbgln("Tokens:");
|
||||||
|
@ -229,10 +228,12 @@ bool Parser::match_variable_declaration()
|
||||||
save_state();
|
save_state();
|
||||||
ScopeGuard state_guard = [this] { load_state(); };
|
ScopeGuard state_guard = [this] { load_state(); };
|
||||||
|
|
||||||
|
// Type
|
||||||
if (!peek(Token::Type::KnownType).has_value() && !peek(Token::Type::Identifier).has_value())
|
if (!peek(Token::Type::KnownType).has_value() && !peek(Token::Type::Identifier).has_value())
|
||||||
return false;
|
return false;
|
||||||
consume();
|
consume();
|
||||||
|
|
||||||
|
// Identifier
|
||||||
if (!peek(Token::Type::Identifier).has_value())
|
if (!peek(Token::Type::Identifier).has_value())
|
||||||
return false;
|
return false;
|
||||||
consume();
|
consume();
|
||||||
|
@ -243,9 +244,10 @@ bool Parser::match_variable_declaration()
|
||||||
error("initial value of variable is not an expression");
|
error("initial value of variable is not an expression");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return match(Token::Type::Semicolon);
|
||||||
}
|
}
|
||||||
|
|
||||||
NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(ASTNode& parent)
|
NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(ASTNode& parent)
|
||||||
|
@ -706,7 +708,7 @@ void Parser::error(StringView message)
|
||||||
m_tokens[m_state.token_index].m_start.column);
|
m_tokens[m_state.token_index].m_start.column);
|
||||||
}
|
}
|
||||||
m_errors.append(formatted_message);
|
m_errors.append(formatted_message);
|
||||||
dbgln("{}", formatted_message);
|
dbgln<CPP_DEBUG>("{}", formatted_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Parser::match_expression()
|
bool Parser::match_expression()
|
||||||
|
@ -1019,5 +1021,4 @@ NonnullRefPtr<IfStatement> Parser::parse_if_statement(ASTNode& parent)
|
||||||
}
|
}
|
||||||
return if_statement;
|
return if_statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue