struct Node* __dw_duplicate_node(struct Node* node);
void __dw_free_node(struct Node* node);
void __dw_free_node2(struct Node* node, bool top);
-void __dw_print_node(struct Node* node, bool top);
+bool __dw_print_node(struct Node* node, bool top);
#ifdef __cplusplus
}
r->errnum = DW_ERR_PARSER_FAIL;
} else {
if(dolog) {
- __dw_print_node(node, true);
- printf("\n");
+ bool pr = __dw_print_node(node, true);
+ if(pr) printf("\n");
}
struct Node* ret = parser_process(db, node, dolog);
if(ret->errnum == DW_ERR_SUCCESS) {
- __dw_print_node(ret, true);
- printf("\n");
+ bool pr = __dw_print_node(ret, true);
+ if(pr) printf("\n");
} else {
r->error = true;
r->errnum = ret->errnum;
if(!top) free(node);
}
-void __dw_print_node(struct Node* node, bool top) {
+bool __dw_print_node(struct Node* node, bool top) {
if(node->type == 'N') {
printf("%f", node->number);
fflush(stdout);
+ return true;
} else if(node->string != NULL) {
printf("\"%s\"", node->string);
fflush(stdout);
+ return true;
} else if(node->ident != NULL) {
printf("%s(", node->ident);
fflush(stdout);
}
printf(")");
fflush(stdout);
+ return true;
}
+ return false;
}