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;
|
GIOChannel *handle;
|
||||||
int tmp_indent_level; /* indentation position */
|
int tmp_indent_level; /* indentation position */
|
||||||
int tmp_last_lf; /* last character was a line feed */
|
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
|
/* 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 '{':
|
case '{':
|
||||||
/* block */
|
/* 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;
|
return G_TOKEN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
newnode = config_node_section(rec, node, key, NODE_TYPE_BLOCK);
|
newnode = config_node_section(rec, node, key, NODE_TYPE_BLOCK);
|
||||||
config_parse_loop(rec, newnode, (GTokenType) '}');
|
config_parse_loop(rec, newnode, (GTokenType) '}');
|
||||||
@ -186,8 +188,11 @@ static GTokenType config_parse_symbol(CONFIG_REC *rec, CONFIG_NODE *node)
|
|||||||
|
|
||||||
case '(':
|
case '(':
|
||||||
/* list */
|
/* 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;
|
return G_TOKEN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
newnode = config_node_section(rec, node, key, NODE_TYPE_LIST);
|
newnode = config_node_section(rec, node, key, NODE_TYPE_LIST);
|
||||||
config_parse_loop(rec, newnode, (GTokenType) ')');
|
config_parse_loop(rec, newnode, (GTokenType) ')');
|
||||||
g_free_not_null(key);
|
g_free_not_null(key);
|
||||||
|
Loading…
Reference in New Issue
Block a user