array: allow omitting space after array dash when linebreak follows

This commit is contained in:
2020-09-27 16:48:08 +02:00
parent a13a8cfa8c
commit 67e8524b40
2 changed files with 4 additions and 3 deletions

View File

@@ -32,7 +32,8 @@ my_section
```
Keys cannot contain spaces. Indents are always two spaces. There is one space
between the hyphen and the value and an array. This is all.
between the hyphen and the value in an array, unless there is a linebreak
immediately after. This is all.
It is a simple format, some might think it is too simple. It is, however,
possible, to write a simple, fast implementation in a few hundred lines of C

4
cfg.h
View File

@@ -571,8 +571,8 @@ parsed_value config_parse_list(string* s, size_t* line, size_t* col, size_t inde
*l =new_list_config_value();
while(true) {
if (s->str[0] != ' ') return config_value_parse_error("expected space to start list element", *line, *col);
s->str++;
if (s->str[0] != ' ' && s->str[0] != '\n') return config_value_parse_error("expected space to start list element", *line, *col);
if (s->str[0] == ' ') s->str++;
consumed += 1;
elem = config_parse_value(s, line, col, indent);