#ifndef __SMCC_CORE_POS_H__ #define __SMCC_CORE_POS_H__ #include "core_str.h" #include "core_type.h" typedef struct { cstring_t name; usize line; usize col; usize offset; } core_pos_t; static inline core_pos_t core_pos_init() { return (core_pos_t){cstring_new(), 1, 1, 0}; } static inline void core_pos_next(core_pos_t *pos) { pos->offset++; pos->col++; } static inline void core_pos_next_line(core_pos_t *pos) { pos->offset++; pos->line++; pos->col = 1; } #endif /* __SMCC_CORE_POS_H__ */