+static uns
+closing_brace(struct item_stack *st, int number, byte **msg)
+{
+ *msg = NULL;
+ if (!st->sec) { // dummy run on unknown section
+ level--;
+ return 1;
+ }
+ if (st->op == OP_CLOSE) { // top-level
+ *msg = "Unmatched } parenthese";
+ return 1;
+ }
+ if (st->op & OP_2ND) // finished the 2nd phase; only for lists
+ {
+list_op:
+ add_to_list(st->list, st->base_ptr, st->op & OP_MASK);
+ level--;
+ if (number)
+ *msg = "No parameters expected after the }";
+ else if (st->op & OP_OPEN)
+ *msg = "No { is expected";
+ return 1;
+ } else { // constructed the query
+ st->op = (st->op | OP_2ND) & ~OP_1ST;
+ st->list = find_list_node(st->list, st->base_ptr, st->sec, st->mask);
+ if (!st->list) {
+ *msg = "Cannot find a node matching the query";
+ return 1;
+ }
+ enum operation op = st->op & OP_MASK;
+ if (op == OP_REMOVE)
+ goto list_op;
+ else if (op == OP_EDIT)
+ st->base_ptr = st->list;
+ else if (op == OP_AFTER || op == OP_BEFORE)
+ cf_init_section(st->item->name, st->sec, st->base_ptr);
+ else
+ ASSERT(0);
+ }
+ if (st->op & OP_OPEN) // stay in the same recursion level
+ return 1;
+ return 0; // continue with immediate data
+}
+