added a way to show the call stack of the functions
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "ast/expressions/prefix.hpp"
|
||||
#include "token/token.hpp"
|
||||
#include "token/type.hpp"
|
||||
#include "utils/tracer.hpp"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@@ -108,6 +109,7 @@ namespace parser {
|
||||
}
|
||||
|
||||
ast::expression* parser::parse_expression(precedence prec) {
|
||||
// TRACE_FUNCTION;
|
||||
auto prefix_it = prefix_parse_fns.find(current.type);
|
||||
if (prefix_it == prefix_parse_fns.end()) {
|
||||
unkown_prefix_error(current);
|
||||
@@ -166,6 +168,7 @@ namespace parser {
|
||||
}
|
||||
|
||||
ast::expression_stmt* parser::parse_expression_stmt() {
|
||||
// TRACE_FUNCTION;
|
||||
ast::expression_stmt* stmt = new ast::expression_stmt(current);
|
||||
|
||||
stmt->expression = parse_expression();
|
||||
@@ -216,10 +219,12 @@ namespace parser {
|
||||
};
|
||||
|
||||
ast::expression* parser::parse_integer() {
|
||||
// TRACE_FUNCTION;
|
||||
return new ast::integer_literal(current, std::stoi(current.literal));
|
||||
};
|
||||
|
||||
ast::expression* parser::parse_prefix_expr() {
|
||||
// TRACE_FUNCTION;
|
||||
ast::prefix_expr* ret = new ast::prefix_expr(current, current.literal);
|
||||
next_token();
|
||||
ret->right = parse_expression(precedence::PREFIX);
|
||||
@@ -227,6 +232,7 @@ namespace parser {
|
||||
};
|
||||
|
||||
ast::expression* parser::parse_infix_expr(ast::expression* left) {
|
||||
// TRACE_FUNCTION;
|
||||
ast::infix_expr* ret =
|
||||
new ast::infix_expr(current, current.literal, left);
|
||||
precedence prec = precedence_for(current.type);
|
||||
|
Reference in New Issue
Block a user