struct dataworks_db_result* r = malloc(sizeof(*r));
r->error = false;
r->value = NULL;
- struct __dw_token* token = __dw_parser_parse(code);
+ struct __dw_token* token = __dw_parser_parse(code, true);
if(token != NULL) {
if(token->error) {
r->error = true;
struct __dw_token** token;
};
-struct __dw_token* __dw_parser_parse(const char* str);
+struct __dw_token* __dw_parser_parse(const char* str, bool top);
void __dw_parser_free(struct __dw_token* token);
void __dw_parser_print(struct __dw_token* token, int depth);
#include <stdlib.h>
#include <string.h>
-struct __dw_token* __dw_parser_parse(const char* str) {
+struct __dw_token* __dw_parser_parse(const char* str, bool top) {
struct __dw_token* token = malloc(sizeof(*token));
token->error = false;
token->errnum = DW_ERR_SUCCESS;
char* br = malloc(1);
bool has_brace = false;
br[0] = 0;
+ int start = 0;
for(i = 0; str[i] != 0; i++) {
cbuf[0] = str[i];
if(brace > 0) {
free(token->token);
}
token->token = newtokens;
- token->token[j] = __dw_parser_parse(comma);
+ token->token[j] = __dw_parser_parse(comma, false);
token->token[j + 1] = NULL;
free(comma);
comma = malloc(1);
free(tmp);
}
}
+ if(top) printf("%s(%s)\n", buf, br);
free(comma);
free(br);
br = malloc(1);