static expr parse_struct_expr_core(parser & p, pos_info const & pos, bool curly_bar) { expr t = p.parse_expr(); buffer<name> field_names; buffer<expr> field_values; buffer<expr> using_exprs; while (p.curr_is_token(get_comma_tk())) { p.next(); pair<optional<name>, expr> id_e = p.parse_optional_assignment(); if (id_e.first) { field_names.push_back(*id_e.first); field_values.push_back(id_e.second); } else { using_exprs.push_back(id_e.second); } } if (curly_bar) p.check_token_next(get_rcurlybar_tk(), "invalid structure expression, '|}' expected"); else p.check_token_next(get_rdcurly_tk(), "invalid structure expression, '⦄' expected"); buffer<expr> args; args.push_back(t); args.append(field_values); args.append(using_exprs); return p.save_pos(mk_structure_instance(to_list(field_names), args.size(), args.data()), pos); }
static void parse_filters(parser & p, buffer<std::string> & pos_names, buffer<std::string> & neg_names) { name plus("+"); name minus("-"); while (p.curr_is_token(get_comma_tk())) { p.next(); if (p.curr_is_token(plus)) { p.next(); pos_names.push_back(p.check_id_next("invalid find_decl command, identifier expected").to_string()); } else if (p.curr_is_token(minus)) { p.next(); neg_names.push_back(p.check_id_next("invalid find_decl command, identifier expected").to_string()); } else { pos_names.push_back(p.check_id_next("invalid find_decl command, '+', '-', or identifier expected").to_string()); } } }