| 1083 | } |
| 1084 | |
| 1085 | static size_t yaml_parse_line(const yaml_doc_t *doc, size_t start, yaml_line_t *line) { |
| 1086 | size_t end = start; |
| 1087 | while (end < doc->len && doc->data[end] != '\n') { |
| 1088 | end++; |
| 1089 | } |
| 1090 | size_t full_end = end < doc->len ? end + YAML_UNIT : end; |
| 1091 | size_t text_end = end; |
| 1092 | if (text_end > start && doc->data[text_end - YAML_UNIT] == '\r') { |
| 1093 | text_end--; |
| 1094 | } |
| 1095 | size_t indent = start; |
| 1096 | while (indent < text_end && doc->data[indent] == ' ') { |
| 1097 | indent++; |
| 1098 | } |
| 1099 | line->start = start; |
| 1100 | line->text_end = text_end; |
| 1101 | line->end = full_end; |
| 1102 | line->indent = indent - start; |
| 1103 | line->blank = indent == text_end; |
| 1104 | line->comment = !line->blank && doc->data[indent] == '#'; |
| 1105 | return full_end; |
| 1106 | } |
| 1107 | |
| 1108 | static void yaml_detect_eol(yaml_doc_t *doc) { |
| 1109 | doc->eol = "\n"; |