zconf.y (bf7ab1e70fd7621fea5dea07b6975c576119b86e) zconf.y (e91610da7c8a9fe42f3e5a75f06c3d1a0cb5f815)
1%{
2/*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 * Released under the terms of the GNU GPL v2.0.
5 */
6
7#include <ctype.h>
8#include <stdarg.h>

--- 6 unchanged lines hidden (view full) ---

15
16#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
17
18#define PRINTD 0x0001
19#define DEBUG_PARSE 0x0002
20
21int cdebug = PRINTD;
22
1%{
2/*
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
4 * Released under the terms of the GNU GPL v2.0.
5 */
6
7#include <ctype.h>
8#include <stdarg.h>

--- 6 unchanged lines hidden (view full) ---

15
16#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
17
18#define PRINTD 0x0001
19#define DEBUG_PARSE 0x0002
20
21int cdebug = PRINTD;
22
23extern int zconflex(void);
23int yylex(void);
24static void yyerror(const char *err);
24static void zconfprint(const char *err, ...);
25static void zconf_error(const char *err, ...);
25static void zconfprint(const char *err, ...);
26static void zconf_error(const char *err, ...);
26static void zconferror(const char *err);
27static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
28
29struct symbol *symbol_hash[SYMBOL_HASHSIZE];
30
31static struct menu *current_menu, *current_entry;
32
33%}
34%expect 32

--- 45 unchanged lines hidden (view full) ---

80
81%left T_OR
82%left T_AND
83%left T_EQUAL T_UNEQUAL
84%left T_LESS T_LESS_EQUAL T_GREATER T_GREATER_EQUAL
85%nonassoc T_NOT
86
87%type <string> prompt
27static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
28
29struct symbol *symbol_hash[SYMBOL_HASHSIZE];
30
31static struct menu *current_menu, *current_entry;
32
33%}
34%expect 32

--- 45 unchanged lines hidden (view full) ---

80
81%left T_OR
82%left T_AND
83%left T_EQUAL T_UNEQUAL
84%left T_LESS T_LESS_EQUAL T_GREATER T_GREATER_EQUAL
85%nonassoc T_NOT
86
87%type <string> prompt
88%type <symbol> nonconst_symbol
88%type <symbol> symbol
89%type <expr> expr
90%type <expr> if_expr
91%type <id> end
92%type <id> option_name
93%type <menu> if_entry menu_entry choice_entry
94%type <string> symbol_option_arg word_opt
95
96%destructor {
97 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
98 $$->file->name, $$->lineno);
99 if (current_menu == $$)
100 menu_end_menu();
101} if_entry menu_entry choice_entry
102
103%{
89%type <symbol> symbol
90%type <expr> expr
91%type <expr> if_expr
92%type <id> end
93%type <id> option_name
94%type <menu> if_entry menu_entry choice_entry
95%type <string> symbol_option_arg word_opt
96
97%destructor {
98 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
99 $$->file->name, $$->lineno);
100 if (current_menu == $$)
101 menu_end_menu();
102} if_entry menu_entry choice_entry
103
104%{
104/* Include zconf.hash.c here so it can see the token constants. */
105#include "zconf.hash.c"
105/* Include kconf_id.c here so it can see the token constants. */
106#include "kconf_id.c"
106%}
107
108%%
109input: nl start | start;
110
107%}
108
109%%
110input: nl start | start;
111
111start: mainmenu_stmt stmt_list | stmt_list;
112start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list;
112
113
114/* mainmenu entry */
115
116mainmenu_stmt: T_MAINMENU prompt nl
117{
118 menu_add_prompt(P_MENU, $2, NULL);
119};
120
121/* Default main menu, if there's no mainmenu entry */
122
123no_mainmenu_stmt: /* empty */
124{
125 /*
126 * Hack: Keep the main menu title on the heap so we can safely free it
127 * later regardless of whether it comes from the 'prompt' in
128 * mainmenu_stmt or here
129 */
130 menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL);
131};
132
133
113stmt_list:
114 /* empty */
115 | stmt_list common_stmt
116 | stmt_list choice_stmt
117 | stmt_list menu_stmt
118 | stmt_list end { zconf_error("unexpected end statement"); }
119 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
120 | stmt_list option_name error T_EOL
121{
134stmt_list:
135 /* empty */
136 | stmt_list common_stmt
137 | stmt_list choice_stmt
138 | stmt_list menu_stmt
139 | stmt_list end { zconf_error("unexpected end statement"); }
140 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
141 | stmt_list option_name error T_EOL
142{
122 zconf_error("unexpected option \"%s\"", kconf_id_strings + $2->name);
143 zconf_error("unexpected option \"%s\"", $2->name);
123}
124 | stmt_list error T_EOL { zconf_error("invalid statement"); }
125;
126
127option_name:
128 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
129;
130

--- 9 unchanged lines hidden (view full) ---

140option_error:
141 T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); }
142 | error T_EOL { zconf_error("invalid option"); }
143;
144
145
146/* config/menuconfig entry */
147
144}
145 | stmt_list error T_EOL { zconf_error("invalid statement"); }
146;
147
148option_name:
149 T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE
150;
151

--- 9 unchanged lines hidden (view full) ---

161option_error:
162 T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); }
163 | error T_EOL { zconf_error("invalid option"); }
164;
165
166
167/* config/menuconfig entry */
168
148config_entry_start: T_CONFIG T_WORD T_EOL
169config_entry_start: T_CONFIG nonconst_symbol T_EOL
149{
170{
150 struct symbol *sym = sym_lookup($2, 0);
151 sym->flags |= SYMBOL_OPTIONAL;
152 menu_add_entry(sym);
153 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2);
171 $2->flags |= SYMBOL_OPTIONAL;
172 menu_add_entry($2);
173 printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2->name);
154};
155
156config_stmt: config_entry_start config_option_list
157{
174};
175
176config_stmt: config_entry_start config_option_list
177{
158 menu_end_entry();
159 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
160};
161
178 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
179};
180
162menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL
181menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL
163{
182{
164 struct symbol *sym = sym_lookup($2, 0);
165 sym->flags |= SYMBOL_OPTIONAL;
166 menu_add_entry(sym);
167 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
183 $2->flags |= SYMBOL_OPTIONAL;
184 menu_add_entry($2);
185 printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2->name);
168};
169
170menuconfig_stmt: menuconfig_entry_start config_option_list
171{
172 if (current_entry->prompt)
173 current_entry->prompt->type = P_MENU;
174 else
175 zconfprint("warning: menuconfig statement without prompt");
186};
187
188menuconfig_stmt: menuconfig_entry_start config_option_list
189{
190 if (current_entry->prompt)
191 current_entry->prompt->type = P_MENU;
192 else
193 zconfprint("warning: menuconfig statement without prompt");
176 menu_end_entry();
177 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
178};
179
180config_option_list:
181 /* empty */
182 | config_option_list config_option
183 | config_option_list symbol_option
184 | config_option_list depends

--- 21 unchanged lines hidden (view full) ---

206 menu_add_expr(P_DEFAULT, $2, $3);
207 if ($1->stype != S_UNKNOWN)
208 menu_set_type($1->stype);
209 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
210 zconf_curname(), zconf_lineno(),
211 $1->stype);
212};
213
194 printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
195};
196
197config_option_list:
198 /* empty */
199 | config_option_list config_option
200 | config_option_list symbol_option
201 | config_option_list depends

--- 21 unchanged lines hidden (view full) ---

223 menu_add_expr(P_DEFAULT, $2, $3);
224 if ($1->stype != S_UNKNOWN)
225 menu_set_type($1->stype);
226 printd(DEBUG_PARSE, "%s:%d:default(%u)\n",
227 zconf_curname(), zconf_lineno(),
228 $1->stype);
229};
230
214config_option: T_SELECT T_WORD if_expr T_EOL
231config_option: T_SELECT nonconst_symbol if_expr T_EOL
215{
232{
216 menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3);
233 menu_add_symbol(P_SELECT, $2, $3);
217 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
218};
219
234 printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno());
235};
236
220config_option: T_IMPLY T_WORD if_expr T_EOL
237config_option: T_IMPLY nonconst_symbol if_expr T_EOL
221{
238{
222 menu_add_symbol(P_IMPLY, sym_lookup($2, 0), $3);
239 menu_add_symbol(P_IMPLY, $2, $3);
223 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
224};
225
226config_option: T_RANGE symbol symbol if_expr T_EOL
227{
228 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
229 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
230};
231
232symbol_option: T_OPTION symbol_option_list T_EOL
233;
234
235symbol_option_list:
236 /* empty */
237 | symbol_option_list T_WORD symbol_option_arg
238{
239 const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
240 printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno());
241};
242
243config_option: T_RANGE symbol symbol if_expr T_EOL
244{
245 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4);
246 printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno());
247};
248
249symbol_option: T_OPTION symbol_option_list T_EOL
250;
251
252symbol_option_list:
253 /* empty */
254 | symbol_option_list T_WORD symbol_option_arg
255{
256 const struct kconf_id *id = kconf_id_lookup($2, strlen($2));
240 if (id && id->flags & TF_OPTION)
257 if (id && id->flags & TF_OPTION) {
241 menu_add_option(id->token, $3);
258 menu_add_option(id->token, $3);
259 free($3);
260 }
242 else
243 zconfprint("warning: ignoring unknown option %s", $2);
244 free($2);
245};
246
247symbol_option_arg:
248 /* empty */ { $$ = NULL; }
249 | T_EQUAL prompt { $$ = $2; }
250;
251
252/* choice entry */
253
254choice: T_CHOICE word_opt T_EOL
255{
256 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
257 sym->flags |= SYMBOL_AUTO;
258 menu_add_entry(sym);
259 menu_add_expr(P_CHOICE, NULL, NULL);
261 else
262 zconfprint("warning: ignoring unknown option %s", $2);
263 free($2);
264};
265
266symbol_option_arg:
267 /* empty */ { $$ = NULL; }
268 | T_EQUAL prompt { $$ = $2; }
269;
270
271/* choice entry */
272
273choice: T_CHOICE word_opt T_EOL
274{
275 struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
276 sym->flags |= SYMBOL_AUTO;
277 menu_add_entry(sym);
278 menu_add_expr(P_CHOICE, NULL, NULL);
279 free($2);
260 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
261};
262
263choice_entry: choice choice_option_list
264{
265 $$ = menu_add_menu();
266};
267

--- 35 unchanged lines hidden (view full) ---

303};
304
305choice_option: T_OPTIONAL T_EOL
306{
307 current_entry->sym->flags |= SYMBOL_OPTIONAL;
308 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
309};
310
280 printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
281};
282
283choice_entry: choice choice_option_list
284{
285 $$ = menu_add_menu();
286};
287

--- 35 unchanged lines hidden (view full) ---

323};
324
325choice_option: T_OPTIONAL T_EOL
326{
327 current_entry->sym->flags |= SYMBOL_OPTIONAL;
328 printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno());
329};
330
311choice_option: T_DEFAULT T_WORD if_expr T_EOL
331choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL
312{
313 if ($1->stype == S_UNKNOWN) {
332{
333 if ($1->stype == S_UNKNOWN) {
314 menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3);
334 menu_add_symbol(P_DEFAULT, $2, $3);
315 printd(DEBUG_PARSE, "%s:%d:default\n",
316 zconf_curname(), zconf_lineno());
317 } else
318 YYERROR;
319};
320
321choice_block:
322 /* empty */

--- 23 unchanged lines hidden (view full) ---

346
347if_block:
348 /* empty */
349 | if_block common_stmt
350 | if_block menu_stmt
351 | if_block choice_stmt
352;
353
335 printd(DEBUG_PARSE, "%s:%d:default\n",
336 zconf_curname(), zconf_lineno());
337 } else
338 YYERROR;
339};
340
341choice_block:
342 /* empty */

--- 23 unchanged lines hidden (view full) ---

366
367if_block:
368 /* empty */
369 | if_block common_stmt
370 | if_block menu_stmt
371 | if_block choice_stmt
372;
373
354/* mainmenu entry */
355
356mainmenu_stmt: T_MAINMENU prompt nl
357{
358 menu_add_prompt(P_MENU, $2, NULL);
359};
360
361/* menu entry */
362
363menu: T_MENU prompt T_EOL
364{
365 menu_add_entry(NULL);
366 menu_add_prompt(P_MENU, $2, NULL);
367 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
368};

--- 20 unchanged lines hidden (view full) ---

389 | menu_block menu_stmt
390 | menu_block choice_stmt
391;
392
393source_stmt: T_SOURCE prompt T_EOL
394{
395 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
396 zconf_nextfile($2);
374/* menu entry */
375
376menu: T_MENU prompt T_EOL
377{
378 menu_add_entry(NULL);
379 menu_add_prompt(P_MENU, $2, NULL);
380 printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno());
381};

--- 20 unchanged lines hidden (view full) ---

402 | menu_block menu_stmt
403 | menu_block choice_stmt
404;
405
406source_stmt: T_SOURCE prompt T_EOL
407{
408 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2);
409 zconf_nextfile($2);
410 free($2);
397};
398
399/* comment entry */
400
401comment: T_COMMENT prompt T_EOL
402{
403 menu_add_entry(NULL);
404 menu_add_prompt(P_COMMENT, $2, NULL);
405 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
406};
407
408comment_stmt: comment depends_list
411};
412
413/* comment entry */
414
415comment: T_COMMENT prompt T_EOL
416{
417 menu_add_entry(NULL);
418 menu_add_prompt(P_COMMENT, $2, NULL);
419 printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno());
420};
421
422comment_stmt: comment depends_list
409{
410 menu_end_entry();
411};
423;
412
413/* help option */
414
415help_start: T_HELP T_EOL
416{
417 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
418 zconf_starthelp();
419};
420
421help: help_start T_HELPTEXT
422{
424
425/* help option */
426
427help_start: T_HELP T_EOL
428{
429 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
430 zconf_starthelp();
431};
432
433help: help_start T_HELPTEXT
434{
435 if (current_entry->help) {
436 free(current_entry->help);
437 zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
438 current_entry->sym->name ?: "<choice>");
439 }
440
441 /* Is the help text empty or all whitespace? */
442 if ($2[strspn($2, " \f\n\r\t\v")] == '\0')
443 zconfprint("warning: '%s' defined with blank help text",
444 current_entry->sym->name ?: "<choice>");
445
423 current_entry->help = $2;
424};
425
426/* depends option */
427
428depends_list:
429 /* empty */
430 | depends_list depends

--- 55 unchanged lines hidden (view full) ---

486 | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); }
487 | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); }
488 | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; }
489 | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); }
490 | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); }
491 | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); }
492;
493
446 current_entry->help = $2;
447};
448
449/* depends option */
450
451depends_list:
452 /* empty */
453 | depends_list depends

--- 55 unchanged lines hidden (view full) ---

509 | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); }
510 | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); }
511 | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; }
512 | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); }
513 | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); }
514 | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); }
515;
516
494symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); }
517/* For symbol definitions, selects, etc., where quotes are not accepted */
518nonconst_symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); };
519
520symbol: nonconst_symbol
495 | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
496;
497
498word_opt: /* empty */ { $$ = NULL; }
499 | T_WORD
500
501%%
502
503void conf_parse(const char *name)
504{
521 | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
522;
523
524word_opt: /* empty */ { $$ = NULL; }
525 | T_WORD
526
527%%
528
529void conf_parse(const char *name)
530{
531 const char *tmp;
505 struct symbol *sym;
506 int i;
507
508 zconf_initscan(name);
509
510 sym_init();
511 _menu_init();
532 struct symbol *sym;
533 int i;
534
535 zconf_initscan(name);
536
537 sym_init();
538 _menu_init();
512 rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
513
514 if (getenv("ZCONF_DEBUG"))
539
540 if (getenv("ZCONF_DEBUG"))
515 zconfdebug = 1;
516 zconfparse();
517 if (zconfnerrs)
541 yydebug = 1;
542 yyparse();
543 if (yynerrs)
518 exit(1);
519 if (!modules_sym)
520 modules_sym = sym_find( "n" );
521
544 exit(1);
545 if (!modules_sym)
546 modules_sym = sym_find( "n" );
547
548 tmp = rootmenu.prompt->text;
522 rootmenu.prompt->text = _(rootmenu.prompt->text);
523 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
549 rootmenu.prompt->text = _(rootmenu.prompt->text);
550 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
551 free((char*)tmp);
524
525 menu_finalize(&rootmenu);
526 for_all_symbols(i, sym) {
527 if (sym_check_deps(sym))
552
553 menu_finalize(&rootmenu);
554 for_all_symbols(i, sym) {
555 if (sym_check_deps(sym))
528 zconfnerrs++;
556 yynerrs++;
529 }
557 }
530 if (zconfnerrs)
558 if (yynerrs)
531 exit(1);
532 sym_set_change_count(1);
533}
534
535static const char *zconf_tokenname(int token)
536{
537 switch (token) {
538 case T_MENU: return "menu";

--- 7 unchanged lines hidden (view full) ---

546 }
547 return "<token>";
548}
549
550static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
551{
552 if (id->token != endtoken) {
553 zconf_error("unexpected '%s' within %s block",
559 exit(1);
560 sym_set_change_count(1);
561}
562
563static const char *zconf_tokenname(int token)
564{
565 switch (token) {
566 case T_MENU: return "menu";

--- 7 unchanged lines hidden (view full) ---

574 }
575 return "<token>";
576}
577
578static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken)
579{
580 if (id->token != endtoken) {
581 zconf_error("unexpected '%s' within %s block",
554 kconf_id_strings + id->name, zconf_tokenname(starttoken));
555 zconfnerrs++;
582 id->name, zconf_tokenname(starttoken));
583 yynerrs++;
556 return false;
557 }
558 if (current_menu->file != current_file) {
559 zconf_error("'%s' in different file than '%s'",
584 return false;
585 }
586 if (current_menu->file != current_file) {
587 zconf_error("'%s' in different file than '%s'",
560 kconf_id_strings + id->name, zconf_tokenname(starttoken));
588 id->name, zconf_tokenname(starttoken));
561 fprintf(stderr, "%s:%d: location of the '%s'\n",
562 current_menu->file->name, current_menu->lineno,
563 zconf_tokenname(starttoken));
589 fprintf(stderr, "%s:%d: location of the '%s'\n",
590 current_menu->file->name, current_menu->lineno,
591 zconf_tokenname(starttoken));
564 zconfnerrs++;
592 yynerrs++;
565 return false;
566 }
567 return true;
568}
569
570static void zconfprint(const char *err, ...)
571{
572 va_list ap;

--- 4 unchanged lines hidden (view full) ---

577 va_end(ap);
578 fprintf(stderr, "\n");
579}
580
581static void zconf_error(const char *err, ...)
582{
583 va_list ap;
584
593 return false;
594 }
595 return true;
596}
597
598static void zconfprint(const char *err, ...)
599{
600 va_list ap;

--- 4 unchanged lines hidden (view full) ---

605 va_end(ap);
606 fprintf(stderr, "\n");
607}
608
609static void zconf_error(const char *err, ...)
610{
611 va_list ap;
612
585 zconfnerrs++;
613 yynerrs++;
586 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
587 va_start(ap, err);
588 vfprintf(stderr, err, ap);
589 va_end(ap);
590 fprintf(stderr, "\n");
591}
592
614 fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
615 va_start(ap, err);
616 vfprintf(stderr, err, ap);
617 va_end(ap);
618 fprintf(stderr, "\n");
619}
620
593static void zconferror(const char *err)
621static void yyerror(const char *err)
594{
595 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
596}
597
598static void print_quoted_string(FILE *out, const char *str)
599{
600 const char *p;
601 int len;

--- 16 unchanged lines hidden (view full) ---

618 struct property *prop;
619
620 if (sym_is_choice(sym))
621 fprintf(out, "\nchoice\n");
622 else
623 fprintf(out, "\nconfig %s\n", sym->name);
624 switch (sym->type) {
625 case S_BOOLEAN:
622{
623 fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
624}
625
626static void print_quoted_string(FILE *out, const char *str)
627{
628 const char *p;
629 int len;

--- 16 unchanged lines hidden (view full) ---

646 struct property *prop;
647
648 if (sym_is_choice(sym))
649 fprintf(out, "\nchoice\n");
650 else
651 fprintf(out, "\nconfig %s\n", sym->name);
652 switch (sym->type) {
653 case S_BOOLEAN:
626 fputs(" boolean\n", out);
654 fputs(" bool\n", out);
627 break;
628 case S_TRISTATE:
629 fputs(" tristate\n", out);
630 break;
631 case S_STRING:
632 fputs(" string\n", out);
633 break;
634 case S_INT:

--- 120 unchanged lines hidden ---
655 break;
656 case S_TRISTATE:
657 fputs(" tristate\n", out);
658 break;
659 case S_STRING:
660 fputs(" string\n", out);
661 break;
662 case S_INT:

--- 120 unchanged lines hidden ---