#ifndef source_h #define source_h #include typedef struct source source_t; typedef struct { int line; int col; size_t idx; } pos_t; source_t *source_alloc_from_file(char* file_name); // takes ownership of the file contents string. source_t *source_alloc(const char* file_name, char* contents); pos_t source_next_pos(source_t *source, pos_t pos); void source_print_pos(source_t *source, pos_t pos); void source_print_line(source_t *source, pos_t pos, int highlight_len); const char* source_contents_from(source_t* source, pos_t pos); void source_dealloc(source_t* source); #endif