chore: remove whitespaces

This commit is contained in:
2026-03-24 22:48:45 +01:00
parent b4e080c731
commit 1fd88c646d

19
cmeta.h
View File

@@ -17,7 +17,6 @@ typedef struct {
// AUTO GENERATED CODE // // AUTO GENERATED CODE //
// AUTO GENERATED CODE // // AUTO GENERATED CODE //
// #define CMETA_COMPTIME
#ifdef CMETA_COMPTIME #ifdef CMETA_COMPTIME
#include <ctype.h> #include <ctype.h>
@@ -101,7 +100,7 @@ bool lexer_expect_keyword(const char* expected) {
if (lexer.token != CLEX_id) { if (lexer.token != CLEX_id) {
// TODO: map lexer.token to readable name // TODO: map lexer.token to readable name
fprintf(stderr, "ERROR: expected `%s` but got `%ld`\n", expected, lexer.token); fprintf(stderr, "ERROR: expected `%s` but got `%ld`\n", expected, lexer.token);
return false; return false;
} }
if (strcmp(lexer.string, expected) != 0) { if (strcmp(lexer.string, expected) != 0) {
@@ -122,7 +121,7 @@ bool lexer_expect(long expected, const char* expected_str) {
} else { } else {
fprintf(stderr, "ERROR: expected `%ld` but got `%ld`\n", expected, lexer.token); fprintf(stderr, "ERROR: expected `%ld` but got `%ld`\n", expected, lexer.token);
} }
return false; return false;
} }
return true; return true;
@@ -256,7 +255,7 @@ void generate_struct_info(FILE* stream, Parsed_Struct_Info info) {
} }
gen(" },"); gen(" },");
gen("};"); gen("};");
free(lowercase_name); free(lowercase_name);
} }
@@ -266,7 +265,7 @@ bool read_entire_file(const char* file_path, char** content) {
if(file == NULL) goto fail; if(file == NULL) goto fail;
if(fseek(file, 0, SEEK_END) < 0) goto fail; if(fseek(file, 0, SEEK_END) < 0) goto fail;
long length = ftell(file); long length = ftell(file);
if(length < 0) goto fail; if(length < 0) goto fail;
@@ -295,7 +294,7 @@ bool generate_output_file(const char* output_path, Parsed_Struct_Infos struct_in
const size_t GENERATION_MARK_LEN = strlen(GENERATION_MARK); const size_t GENERATION_MARK_LEN = strlen(GENERATION_MARK);
bool result = false; bool result = false;
char* header_content; char* header_content;
if (!read_entire_file(__FILE__, &header_content)) goto fail; if (!read_entire_file(__FILE__, &header_content)) goto fail;
@@ -365,6 +364,8 @@ bool preprocess_file(const char* file_path, String_Builder* result) {
collecting_content = true; collecting_content = true;
continue; continue;
} }
// TODO: read original file at line_num, to check for comments (e.g annotations)
} else if(collecting_content) { } else if(collecting_content) {
sb_append(result, line); sb_append(result, line);
cursor += strlen(line); cursor += strlen(line);
@@ -397,9 +398,9 @@ bool process_file(const char* input_file) {
Parsed_Struct_Info struct_info = {0}; Parsed_Struct_Info struct_info = {0};
if (parse_struct(&struct_info)) { if (parse_struct(&struct_info)) {
da_append(&struct_infos, struct_info); da_append(&struct_infos, struct_info);
} }
} }
} }
if (!generate_output_file(__FILE__, struct_infos)) return false; if (!generate_output_file(__FILE__, struct_infos)) return false;
@@ -409,4 +410,4 @@ bool process_file(const char* input_file) {
#endif // CMETA_COMPTIME #endif // CMETA_COMPTIME
#endif // CMETA_H #endif // CMETA_H