make h_pprint_char from cfgrammar public so LR pretty printers can use it
This commit is contained in:
parent
43fc07e67b
commit
373a7aef94
2 changed files with 5 additions and 4 deletions
|
|
@ -595,7 +595,7 @@ static void stringset_extend(HCFGrammar *g, HStringMap *ret,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void pprint_char(FILE *f, char c)
|
void h_pprint_char(FILE *f, char c)
|
||||||
{
|
{
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case '"': fputs("\\\"", f); break;
|
case '"': fputs("\\\"", f); break;
|
||||||
|
|
@ -619,7 +619,7 @@ static void pprint_charset_char(FILE *f, char c)
|
||||||
case '"': fputc(c, f); break;
|
case '"': fputc(c, f); break;
|
||||||
case '-': fputs("\\-", f); break;
|
case '-': fputs("\\-", f); break;
|
||||||
case ']': fputs("\\-", f); break;
|
case ']': fputs("\\-", f); break;
|
||||||
default: pprint_char(f, c);
|
default: h_pprint_char(f, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -667,7 +667,7 @@ static HCFChoice **pprint_string(FILE *f, HCFChoice **x)
|
||||||
for(; *x; x++) {
|
for(; *x; x++) {
|
||||||
if((*x)->type != HCF_CHAR)
|
if((*x)->type != HCF_CHAR)
|
||||||
break;
|
break;
|
||||||
pprint_char(f, (*x)->chr);
|
h_pprint_char(f, (*x)->chr);
|
||||||
}
|
}
|
||||||
fputc('"', f);
|
fputc('"', f);
|
||||||
return x;
|
return x;
|
||||||
|
|
@ -678,7 +678,7 @@ void h_pprint_symbol(FILE *f, const HCFGrammar *g, const HCFChoice *x)
|
||||||
switch(x->type) {
|
switch(x->type) {
|
||||||
case HCF_CHAR:
|
case HCF_CHAR:
|
||||||
fputc('"', f);
|
fputc('"', f);
|
||||||
pprint_char(f, x->chr);
|
h_pprint_char(f, x->chr);
|
||||||
fputc('"', f);
|
fputc('"', f);
|
||||||
break;
|
break;
|
||||||
case HCF_END:
|
case HCF_END:
|
||||||
|
|
|
||||||
|
|
@ -93,3 +93,4 @@ void h_pprint_sequence(FILE *f, const HCFGrammar *g, const HCFSequence *seq);
|
||||||
void h_pprint_symbol(FILE *f, const HCFGrammar *g, const HCFChoice *x);
|
void h_pprint_symbol(FILE *f, const HCFGrammar *g, const HCFChoice *x);
|
||||||
void h_pprint_symbolset(FILE *file, const HCFGrammar *g, const HHashSet *set, int indent);
|
void h_pprint_symbolset(FILE *file, const HCFGrammar *g, const HHashSet *set, int indent);
|
||||||
void h_pprint_stringset(FILE *file, const HStringMap *set, int indent);
|
void h_pprint_stringset(FILE *file, const HStringMap *set, int indent);
|
||||||
|
void h_pprint_char(FILE *file, char c);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue