summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/ast-tree.c2
-rw-r--r--src/compiler/ast-tree.h2
-rw-r--r--src/compiler/lexer.c2
-rw-r--r--src/compiler/lexer.h2
-rw-r--r--src/compiler/parser.c2
-rw-r--r--src/compiler/parser.h2
6 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/ast-tree.c b/src/compiler/ast-tree.c
index b770098..2201b4a 100644
--- a/src/compiler/ast-tree.c
+++ b/src/compiler/ast-tree.c
@@ -195,6 +195,7 @@ AstTreeRoots AST_TREE_ROOTS_ERROR = {
.size = -1ULL,
};
+#ifdef PRINT_COMPILE_TREE
void astTreePrint(const AstTree *tree, int indent) {
for (int i = 0; i < indent; ++i)
printf(" ");
@@ -600,6 +601,7 @@ void astTreeRootPrint(const AstTreeRoot *root) {
printf("\n");
}
}
+#endif
void astTreeDestroy(AstTree tree) {
if (tree.type != NULL) {
diff --git a/src/compiler/ast-tree.h b/src/compiler/ast-tree.h
index d60088d..68b8ec6 100644
--- a/src/compiler/ast-tree.h
+++ b/src/compiler/ast-tree.h
@@ -259,9 +259,11 @@ typedef struct AstTreeBuiltin {
AstTreeBuiltinToken token;
} AstTreeBuiltin;
+#ifdef PRINT_COMPILE_TREE
void astTreePrint(const AstTree *tree, int indent);
void astTreeVariablePrint(const AstTreeVariable *variable, int indent);
void astTreeRootPrint(const AstTreeRoot *root);
+#endif
void astTreeDestroy(AstTree tree);
void astTreeVariableDestroy(AstTreeVariable variable);
diff --git a/src/compiler/lexer.c b/src/compiler/lexer.c
index fa96203..8cf0cc3 100644
--- a/src/compiler/lexer.c
+++ b/src/compiler/lexer.c
@@ -180,6 +180,7 @@ bool lexerNodeArrayIsError(LexerNodeArray array) {
return LEXER_NODE_ARRAY_ERROR.size == array.size;
}
+#ifdef PRINT_COMPILE_TREE
void lexerNodeArrayPrint(LexerNodeArray array) {
for (size_t i = 0; i < array.size; ++i) {
LexerNode node = array.data[i];
@@ -187,6 +188,7 @@ void lexerNodeArrayPrint(LexerNodeArray array) {
node.str_begin, LEXER_TOKEN_STRINGS[node.token]);
}
}
+#endif
void lexerNodeArrayDestroy(LexerNodeArray array) { free(array.data); }
diff --git a/src/compiler/lexer.h b/src/compiler/lexer.h
index 71d9640..862efe7 100644
--- a/src/compiler/lexer.h
+++ b/src/compiler/lexer.h
@@ -138,7 +138,9 @@ typedef struct LexerNodeArray {
extern const LexerNodeArray LEXER_NODE_ARRAY_ERROR;
extern bool lexerNodeArrayIsError(LexerNodeArray array);
+#ifdef PRINT_COMPILE_TREE
extern void lexerNodeArrayPrint(LexerNodeArray array);
+#endif
extern void lexerNodeArrayDestroy(LexerNodeArray array);
extern LexerNodeArray lexer(char *str);
diff --git a/src/compiler/parser.c b/src/compiler/parser.c
index 956b834..7265c60 100644
--- a/src/compiler/parser.c
+++ b/src/compiler/parser.c
@@ -171,6 +171,7 @@ static const ParserOrder PARSER_ORDER[] = {
static const size_t PARSER_ORDER_SIZE =
sizeof(PARSER_ORDER) / sizeof(*PARSER_ORDER);
+#ifdef PRINT_COMPILE_TREE
void parserNodePrint(const ParserNode *node, int indent) {
for (int i = 0; i < indent; ++i)
printf(" ");
@@ -475,6 +476,7 @@ void parserNodePrint(const ParserNode *node, int indent) {
RETURN_SUCCESS:
printf("}");
}
+#endif
void parserNodeDelete(ParserNode *node) {
if (node == NULL) {
diff --git a/src/compiler/parser.h b/src/compiler/parser.h
index 25e9a21..0ee59a6 100644
--- a/src/compiler/parser.h
+++ b/src/compiler/parser.h
@@ -173,7 +173,9 @@ typedef struct ParserNodeBracketMetadata {
ParserNodeArray *params;
} ParserNodeBracketMetadata;
+#ifdef PRINT_COMPILE_TREE
void parserNodePrint(const ParserNode *node, int indent);
+#endif
void parserNodeDelete(ParserNode *node);
ParserNode *parserFromPath(const char *filePath);