- Replace `scc_probe_stream_consume` with `scc_probe_stream_next` for consistent stream advancement - Remove redundant `scc_probe_stream_reset` calls before peeking, as `next` and `peek` handle state - Update `scc_cstring_new` to `scc_cstring_create` and `scc_pos_init` to `scc_pos_create` for naming consistency - Change `scc_pp_macro_get` parameter to `const scc_cstring_t*` for better const-correctness - Improves code clarity and maintains proper stream position tracking
29 lines
545 B
C
29 lines
545 B
C
#ifndef __SCC_CORE_POS_H__
|
|
#define __SCC_CORE_POS_H__
|
|
|
|
#include "core_str.h"
|
|
#include "core_type.h"
|
|
typedef struct scc_pos {
|
|
scc_cstring_t name;
|
|
usize line;
|
|
usize col;
|
|
usize offset;
|
|
} scc_pos_t;
|
|
|
|
static inline scc_pos_t scc_pos_create() {
|
|
return (scc_pos_t){scc_cstring_create(), 1, 1, 0};
|
|
}
|
|
|
|
static inline void scc_pos_next(scc_pos_t *pos) {
|
|
pos->offset++;
|
|
pos->col++;
|
|
}
|
|
|
|
static inline void scc_pos_next_line(scc_pos_t *pos) {
|
|
pos->offset++;
|
|
pos->line++;
|
|
pos->col = 1;
|
|
}
|
|
|
|
#endif /* __SCC_CORE_POS_H__ */
|