Reorganize repo.

This commit is contained in:
Joshua Bemenderfer
2022-11-01 14:55:57 -04:00
parent 403b6d1768
commit 0196cd5c87
21 changed files with 7 additions and 27 deletions

23
packages/c/parser.c Normal file
View File

@@ -0,0 +1,23 @@
struct terrace_linedata_s {
char type;
unsigned int level;
unsigned int offset;
};
typedef struct terrace_linedata_s terrace_linedata_t;
void terrace_parse_line(char* line, terrace_linedata_t *lineData) {
char type = 0;
unsigned int level = 0;
if (line[0] == '\n') {
if (lineData->type == 1) level++;
if (lineData->type == 0) level = lineData->level;
} else {
type = 1;
while(line[level] == ' ' && level <= lineData->level + 1) ++level;
}
lineData->type = type;
lineData->level = level;
}