chore: remove whitespaces
This commit is contained in:
19
cmeta.h
19
cmeta.h
@@ -17,7 +17,6 @@ typedef struct {
|
||||
// AUTO GENERATED CODE //
|
||||
// AUTO GENERATED CODE //
|
||||
|
||||
// #define CMETA_COMPTIME
|
||||
#ifdef CMETA_COMPTIME
|
||||
|
||||
#include <ctype.h>
|
||||
@@ -101,7 +100,7 @@ bool lexer_expect_keyword(const char* expected) {
|
||||
if (lexer.token != CLEX_id) {
|
||||
// TODO: map lexer.token to readable name
|
||||
fprintf(stderr, "ERROR: expected `%s` but got `%ld`\n", expected, lexer.token);
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(lexer.string, expected) != 0) {
|
||||
@@ -122,7 +121,7 @@ bool lexer_expect(long expected, const char* expected_str) {
|
||||
} else {
|
||||
fprintf(stderr, "ERROR: expected `%ld` but got `%ld`\n", expected, lexer.token);
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -256,7 +255,7 @@ void generate_struct_info(FILE* stream, Parsed_Struct_Info info) {
|
||||
}
|
||||
gen(" },");
|
||||
gen("};");
|
||||
|
||||
|
||||
free(lowercase_name);
|
||||
}
|
||||
|
||||
@@ -266,7 +265,7 @@ bool read_entire_file(const char* file_path, char** content) {
|
||||
if(file == NULL) goto fail;
|
||||
|
||||
if(fseek(file, 0, SEEK_END) < 0) goto fail;
|
||||
|
||||
|
||||
long length = ftell(file);
|
||||
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);
|
||||
|
||||
bool result = false;
|
||||
|
||||
|
||||
char* header_content;
|
||||
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;
|
||||
continue;
|
||||
}
|
||||
|
||||
// TODO: read original file at line_num, to check for comments (e.g annotations)
|
||||
} else if(collecting_content) {
|
||||
sb_append(result, line);
|
||||
cursor += strlen(line);
|
||||
@@ -397,9 +398,9 @@ bool process_file(const char* input_file) {
|
||||
|
||||
Parsed_Struct_Info struct_info = {0};
|
||||
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;
|
||||
@@ -409,4 +410,4 @@ bool process_file(const char* input_file) {
|
||||
|
||||
#endif // CMETA_COMPTIME
|
||||
|
||||
#endif // CMETA_H
|
||||
#endif // CMETA_H
|
||||
|
||||
Reference in New Issue
Block a user