4502. [func] Report multiple and experimental options when printing

grammar. [RT #43134]
This commit is contained in:
Mark Andrews
2016-11-02 10:04:57 +11:00
parent e1c93a0f58
commit 89286906dc
5 changed files with 46 additions and 38 deletions

View File

@@ -1113,7 +1113,7 @@ static void
doc_btext(cfg_printer_t *pctx, const cfg_type_t *type) {
UNUSED(type);
cfg_print_cstr(pctx, "{ <unspecified text> }");
cfg_print_cstr(pctx, "{ <unspecified-text> }");
}
@@ -1953,27 +1953,6 @@ cfg_print_mapbody(cfg_printer_t *pctx, const cfg_obj_t *obj) {
}
}
void
cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) {
const cfg_clausedef_t * const *clauseset;
const cfg_clausedef_t *clause;
REQUIRE(pctx != NULL);
REQUIRE(type != NULL);
for (clauseset = type->of; *clauseset != NULL; clauseset++) {
for (clause = *clauseset;
clause->name != NULL;
clause++) {
cfg_print_cstr(pctx, clause->name);
cfg_print_cstr(pctx, " ");
cfg_doc_obj(pctx, clause->type);
/* XXX print flags here? */
cfg_print_cstr(pctx, ";\n\n");
}
}
}
static struct flagtext {
unsigned int flag;
const char *text;
@@ -1984,23 +1963,11 @@ static struct flagtext {
{ CFG_CLAUSEFLAG_NEWDEFAULT, "default changed" },
{ CFG_CLAUSEFLAG_TESTONLY, "test only" },
{ CFG_CLAUSEFLAG_NOTCONFIGURED, "not configured" },
{ CFG_CLAUSEFLAG_MULTI, "may occur multiple times" },
{ CFG_CLAUSEFLAG_EXPERIMENTAL, "experimental" },
{ 0, NULL }
};
void
cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) {
REQUIRE(pctx != NULL);
REQUIRE(obj != NULL);
if (obj->value.map.id != NULL) {
cfg_print_obj(pctx, obj->value.map.id);
cfg_print_cstr(pctx, " ");
}
print_open(pctx);
cfg_print_mapbody(pctx, obj);
print_close(pctx);
}
static void
print_clause_flags(cfg_printer_t *pctx, unsigned int flags) {
struct flagtext *p;
@@ -2017,6 +1984,42 @@ print_clause_flags(cfg_printer_t *pctx, unsigned int flags) {
}
}
void
cfg_doc_mapbody(cfg_printer_t *pctx, const cfg_type_t *type) {
const cfg_clausedef_t * const *clauseset;
const cfg_clausedef_t *clause;
REQUIRE(pctx != NULL);
REQUIRE(type != NULL);
for (clauseset = type->of; *clauseset != NULL; clauseset++) {
for (clause = *clauseset;
clause->name != NULL;
clause++) {
cfg_print_cstr(pctx, clause->name);
cfg_print_cstr(pctx, " ");
cfg_doc_obj(pctx, clause->type);
cfg_print_cstr(pctx, ";");
print_clause_flags(pctx, clause->flags);
cfg_print_cstr(pctx, "\n\n");
}
}
}
void
cfg_print_map(cfg_printer_t *pctx, const cfg_obj_t *obj) {
REQUIRE(pctx != NULL);
REQUIRE(obj != NULL);
if (obj->value.map.id != NULL) {
cfg_print_obj(pctx, obj->value.map.id);
cfg_print_cstr(pctx, " ");
}
print_open(pctx);
cfg_print_mapbody(pctx, obj);
print_close(pctx);
}
void
cfg_doc_map(cfg_printer_t *pctx, const cfg_type_t *type) {
const cfg_clausedef_t * const *clauseset;