add declarations to translator

This commit is contained in:
2025-06-14 04:13:14 +01:00
parent f2dd133e7d
commit 3a19b1519f
12 changed files with 86 additions and 24 deletions

View File

@@ -82,7 +82,7 @@ ParsedValue *parse_token_full(char *file, DArray *tokens, size_t *index,
break;
case TOKEN_STRING:
(*index)++;
output = parse_string(file,token);
output = parse_string(token);
break;
case TOKEN_NEW_LINE:
(*index)++;

View File

@@ -100,7 +100,7 @@ char *unquote_json_string(const char *input, size_t *out_len) {
size_t input_len = end - (input + 1); // length inside quotes
const char *src = input + 1;
// Allocate max output size = input_len, decoded string cannot be longer than input_len
char *outbuf = (char *)malloc(input_len + 1);
char *outbuf = (char *)checked_malloc(input_len + 1);
if (!outbuf) return NULL;
char *dst = outbuf;
@@ -245,7 +245,7 @@ char *unquote(char *str, size_t *decoded_len) {
return unescaped;
}
ParsedValue *parse_string(char*file,Token* token) {
ParsedValue *parse_string(Token* token) {
ParsedValue *parsedValue = checked_malloc(sizeof(ParsedValue));
parsedValue->type = AST_STRING;
ParsedString *parsedString = checked_malloc(sizeof(ParsedString));

View File

@@ -15,6 +15,6 @@ char *swap_quotes(char *input, char quote);
char *unquote(char *str, size_t *decoded_len);
ParsedValue *parse_string(char*file,Token* token);
ParsedValue *parse_string(Token* token);
#endif // STRING_UTILS_H