175 |
|
|
176 |
extern struct rule_s *rules; |
extern struct rule_s *rules; |
177 |
|
|
178 |
|
/* A function that selects a rule. */ |
179 |
|
typedef bool (*rule_filter_t) PARAMS ((rule_t *r)); |
180 |
|
|
181 |
|
/* Return true IFF the rule has a `number' smaller than NRULES. */ |
182 |
|
bool rule_useful_p PARAMS ((rule_t *r)); |
183 |
|
|
184 |
|
/* Return true IFF the rule has a `number' higher than NRULES. */ |
185 |
|
bool rule_useless_p PARAMS ((rule_t *r)); |
186 |
|
|
187 |
|
/* Return true IFF the rule is not flagged as useful *and* is useful. |
188 |
|
In other words, it was discarded because of conflicts. */ |
189 |
|
bool rule_never_reduced_p PARAMS ((rule_t *r)); |
190 |
|
|
191 |
|
/* Print this RULE's number and lhs on OUT. If a PREVIOUS_LHS was |
192 |
|
already displayed (by a previous call for another rule), avoid |
193 |
|
useless repetitions. */ |
194 |
|
void rule_lhs_print PARAMS ((rule_t *rule, symbol_t *previous_lhs, FILE *out)); |
195 |
|
|
196 |
|
/* Return the length of the RHS. */ |
197 |
|
int rule_rhs_length PARAMS ((rule_t *rule)); |
198 |
|
|
199 |
|
/* Print this RULE's RHS on OUT. */ |
200 |
|
void rule_rhs_print PARAMS ((rule_t *rule, FILE *out)); |
201 |
|
|
202 |
|
/* Print this RULE on OUT. */ |
203 |
|
void rule_print PARAMS ((rule_t *rule, FILE *out)); |
204 |
|
|
205 |
|
|
206 |
|
|
207 |
|
|
208 |
/* Table of the symbols, indexed by the symbol number. */ |
/* Table of the symbols, indexed by the symbol number. */ |
209 |
extern symbol_t **symbols; |
extern symbol_t **symbols; |
210 |
|
|
215 |
extern int max_user_token_number; |
extern int max_user_token_number; |
216 |
|
|
217 |
|
|
218 |
|
|
219 |
/* GLR_PARSER is nonzero if the input file says to use the GLR |
/* GLR_PARSER is nonzero if the input file says to use the GLR |
220 |
(Generalized LR) parser, and to output some additional |
(Generalized LR) parser, and to output some additional |
221 |
information used by the GLR algorithm. */ |
information used by the GLR algorithm. */ |
227 |
|
|
228 |
extern int pure_parser; |
extern int pure_parser; |
229 |
|
|
|
/* Print this RULE's number and lhs on OUT. If a PREVIOUS_LHS was |
|
|
already displayed (by a previous call for another rule), avoid |
|
|
useless repetitions. */ |
|
|
void rule_lhs_print PARAMS ((rule_t *rule, symbol_t *previous_lhs, FILE *out)); |
|
|
|
|
|
/* Return the length of the RHS. */ |
|
|
int rule_rhs_length PARAMS ((rule_t *rule)); |
|
|
|
|
|
/* Print this RULE's RHS on OUT. */ |
|
|
void rule_rhs_print PARAMS ((rule_t *rule, FILE *out)); |
|
|
|
|
|
/* Print this RULE on OUT. */ |
|
|
void rule_print PARAMS ((rule_t *rule, FILE *out)); |
|
|
|
|
230 |
/* Dump RITEM for traces. */ |
/* Dump RITEM for traces. */ |
231 |
void ritem_print PARAMS ((FILE *out)); |
void ritem_print PARAMS ((FILE *out)); |
232 |
|
|
236 |
/* Print the grammar's rules numbers from BEGIN (inclusive) to END |
/* Print the grammar's rules numbers from BEGIN (inclusive) to END |
237 |
(exclusive) on OUT under TITLE. */ |
(exclusive) on OUT under TITLE. */ |
238 |
void grammar_rules_partial_print PARAMS ((FILE *out, const char *title, |
void grammar_rules_partial_print PARAMS ((FILE *out, const char *title, |
239 |
rule_number_t begin, |
rule_filter_t filter)); |
|
rule_number_t end)); |
|
240 |
|
|
241 |
/* Print the grammar's rules on OUT. */ |
/* Print the grammar's rules on OUT. */ |
242 |
void grammar_rules_print PARAMS ((FILE *out)); |
void grammar_rules_print PARAMS ((FILE *out)); |
244 |
/* Dump the grammar. */ |
/* Dump the grammar. */ |
245 |
void grammar_dump PARAMS ((FILE *out, const char *title)); |
void grammar_dump PARAMS ((FILE *out, const char *title)); |
246 |
|
|
247 |
|
/* Report on STDERR the rules that are not flagged USEFUL, using the |
248 |
|
MESSAGE (which can be `useless rule' when invoked after grammar |
249 |
|
reduction, or `never reduced' after conflicts were taken into |
250 |
|
account). */ |
251 |
|
void grammar_rules_never_reduced_report PARAMS ((const char *message)); |
252 |
|
|
253 |
/* Free the packed grammar. */ |
/* Free the packed grammar. */ |
254 |
void grammar_free PARAMS ((void)); |
void grammar_free PARAMS ((void)); |
255 |
|
|