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:
parent
b988b2925b
commit
8d7449d26f
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user