1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

add list_of_lists to config and more error messages

This commit is contained in:
Ailin Nemui 2021-01-04 09:15:01 +01:00 committed by Ailin Nemui
parent b988b2925b
commit 8d7449d26f
2 changed files with 9 additions and 2 deletions

View File

@ -62,6 +62,8 @@ struct _CONFIG_REC {
GIOChannel *handle;
int tmp_indent_level; /* indentation position */
int tmp_last_lf; /* last character was a line feed */
int list_of_lists : 1; /* list of lists allowed */
};
/* Open configuration. The file is created if it doesn't exist, unless

View File

@ -170,8 +170,10 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
case '{':
/* block */
if (key == NULL && node->type != NODE_TYPE_LIST)
if (key == NULL && node->type != NODE_TYPE_LIST) {
g_scanner_error(rec->scanner, "Missing key");
return G_TOKEN_ERROR;
}
newnode = config_node_section(rec, node, key, NODE_TYPE_BLOCK);
config_parse_loop(rec, newnode, (GTokenType) '}');
@ -186,8 +188,11 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
case '(':
/* list */
if (key == NULL)
if (key == NULL && !rec->list_of_lists) {
g_scanner_error(rec->scanner, "List of lists not allowed");
return G_TOKEN_ERROR;
}
newnode = config_node_section(rec, node, key, NODE_TYPE_LIST);
config_parse_loop(rec, newnode, (GTokenType) ')');
g_free_not_null(key);