MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / yaml_parse_line

Function yaml_parse_line

src/cli/config_yaml_edit.c:1034–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1032}
1033
1034static size_t yaml_parse_line(const yaml_doc_t *doc, size_t start, yaml_line_t *line) {
1035 size_t end = start;
1036 while (end < doc->len && doc->data[end] != '\n') {
1037 end++;
1038 }
1039 size_t full_end = end < doc->len ? end + YAML_UNIT : end;
1040 size_t text_end = end;
1041 if (text_end > start && doc->data[text_end - YAML_UNIT] == '\r') {
1042 text_end--;
1043 }
1044 size_t indent = start;
1045 while (indent < text_end && doc->data[indent] == ' ') {
1046 indent++;
1047 }
1048 line->start = start;
1049 line->text_end = text_end;
1050 line->end = full_end;
1051 line->indent = indent - start;
1052 line->blank = indent == text_end;
1053 line->comment = !line->blank && doc->data[indent] == '#';
1054 return full_end;
1055}
1056
1057static void yaml_detect_eol(yaml_doc_t *doc) {
1058 doc->eol = "\n";

Callers 1

yaml_build_linesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected