Commit 765f4cde authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: use default 'yy' prefix for lexer and parser

Flex and Bison provide an option to change the prefix of globally-
visible symbols.  This is useful to link multiple lexers and/or
parsers into the same executable.  However, Kconfig (and any other
host programs in kernel) uses a single lexer and parser.  I do not
see a good reason to change the default 'yy' prefix.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: default avatarUlf Magnusson <ulfalizer@gmail.com>
parent 84dd95d4
...@@ -211,9 +211,6 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) ...@@ -211,9 +211,6 @@ HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC)
HOSTCFLAGS_zconf.lex.o := -I$(src) HOSTCFLAGS_zconf.lex.o := -I$(src)
HOSTCFLAGS_zconf.tab.o := -I$(src) HOSTCFLAGS_zconf.tab.o := -I$(src)
LEX_PREFIX_zconf := zconf
YACC_PREFIX_zconf := zconf
HOSTLOADLIBES_qconf = $(KC_QT_LIBS) HOSTLOADLIBES_qconf = $(KC_QT_LIBS)
HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS)
......
...@@ -106,11 +106,11 @@ n [A-Za-z0-9_-] ...@@ -106,11 +106,11 @@ n [A-Za-z0-9_-]
current_pos.file = current_file; current_pos.file = current_file;
current_pos.lineno = current_file->lineno; current_pos.lineno = current_file->lineno;
if (id && id->flags & TF_COMMAND) { if (id && id->flags & TF_COMMAND) {
zconflval.id = id; yylval.id = id;
return id->token; return id->token;
} }
alloc_string(yytext, yyleng); alloc_string(yytext, yyleng);
zconflval.string = text; yylval.string = text;
return T_WORD; return T_WORD;
} }
. warn_ignored_character(*yytext); . warn_ignored_character(*yytext);
...@@ -142,11 +142,11 @@ n [A-Za-z0-9_-] ...@@ -142,11 +142,11 @@ n [A-Za-z0-9_-]
({n}|[/.])+ { ({n}|[/.])+ {
const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
if (id && id->flags & TF_PARAM) { if (id && id->flags & TF_PARAM) {
zconflval.id = id; yylval.id = id;
return id->token; return id->token;
} }
alloc_string(yytext, yyleng); alloc_string(yytext, yyleng);
zconflval.string = text; yylval.string = text;
return T_WORD; return T_WORD;
} }
#.* /* comment */ #.* /* comment */
...@@ -161,7 +161,7 @@ n [A-Za-z0-9_-] ...@@ -161,7 +161,7 @@ n [A-Za-z0-9_-]
<STRING>{ <STRING>{
[^'"\\\n]+/\n { [^'"\\\n]+/\n {
append_string(yytext, yyleng); append_string(yytext, yyleng);
zconflval.string = text; yylval.string = text;
return T_WORD_QUOTE; return T_WORD_QUOTE;
} }
[^'"\\\n]+ { [^'"\\\n]+ {
...@@ -169,7 +169,7 @@ n [A-Za-z0-9_-] ...@@ -169,7 +169,7 @@ n [A-Za-z0-9_-]
} }
\\.?/\n { \\.?/\n {
append_string(yytext + 1, yyleng - 1); append_string(yytext + 1, yyleng - 1);
zconflval.string = text; yylval.string = text;
return T_WORD_QUOTE; return T_WORD_QUOTE;
} }
\\.? { \\.? {
...@@ -178,7 +178,7 @@ n [A-Za-z0-9_-] ...@@ -178,7 +178,7 @@ n [A-Za-z0-9_-]
\'|\" { \'|\" {
if (str == yytext[0]) { if (str == yytext[0]) {
BEGIN(PARAM); BEGIN(PARAM);
zconflval.string = text; yylval.string = text;
return T_WORD_QUOTE; return T_WORD_QUOTE;
} else } else
append_string(yytext, 1); append_string(yytext, 1);
...@@ -261,7 +261,7 @@ void zconf_starthelp(void) ...@@ -261,7 +261,7 @@ void zconf_starthelp(void)
static void zconf_endhelp(void) static void zconf_endhelp(void)
{ {
zconflval.string = text; yylval.string = text;
BEGIN(INITIAL); BEGIN(INITIAL);
} }
......
...@@ -20,10 +20,10 @@ ...@@ -20,10 +20,10 @@
int cdebug = PRINTD; int cdebug = PRINTD;
extern int zconflex(void); int yylex(void);
static void yyerror(const char *err);
static void zconfprint(const char *err, ...); static void zconfprint(const char *err, ...);
static void zconf_error(const char *err, ...); static void zconf_error(const char *err, ...);
static void zconferror(const char *err);
static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken);
struct symbol *symbol_hash[SYMBOL_HASHSIZE]; struct symbol *symbol_hash[SYMBOL_HASHSIZE];
...@@ -531,9 +531,9 @@ void conf_parse(const char *name) ...@@ -531,9 +531,9 @@ void conf_parse(const char *name)
_menu_init(); _menu_init();
if (getenv("ZCONF_DEBUG")) if (getenv("ZCONF_DEBUG"))
zconfdebug = 1; yydebug = 1;
zconfparse(); yyparse();
if (zconfnerrs) if (yynerrs)
exit(1); exit(1);
if (!modules_sym) if (!modules_sym)
modules_sym = sym_find( "n" ); modules_sym = sym_find( "n" );
...@@ -546,9 +546,9 @@ void conf_parse(const char *name) ...@@ -546,9 +546,9 @@ void conf_parse(const char *name)
menu_finalize(&rootmenu); menu_finalize(&rootmenu);
for_all_symbols(i, sym) { for_all_symbols(i, sym) {
if (sym_check_deps(sym)) if (sym_check_deps(sym))
zconfnerrs++; yynerrs++;
} }
if (zconfnerrs) if (yynerrs)
exit(1); exit(1);
sym_set_change_count(1); sym_set_change_count(1);
} }
...@@ -573,7 +573,7 @@ static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok ...@@ -573,7 +573,7 @@ static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok
if (id->token != endtoken) { if (id->token != endtoken) {
zconf_error("unexpected '%s' within %s block", zconf_error("unexpected '%s' within %s block",
id->name, zconf_tokenname(starttoken)); id->name, zconf_tokenname(starttoken));
zconfnerrs++; yynerrs++;
return false; return false;
} }
if (current_menu->file != current_file) { if (current_menu->file != current_file) {
...@@ -582,7 +582,7 @@ static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok ...@@ -582,7 +582,7 @@ static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtok
fprintf(stderr, "%s:%d: location of the '%s'\n", fprintf(stderr, "%s:%d: location of the '%s'\n",
current_menu->file->name, current_menu->lineno, current_menu->file->name, current_menu->lineno,
zconf_tokenname(starttoken)); zconf_tokenname(starttoken));
zconfnerrs++; yynerrs++;
return false; return false;
} }
return true; return true;
...@@ -603,7 +603,7 @@ static void zconf_error(const char *err, ...) ...@@ -603,7 +603,7 @@ static void zconf_error(const char *err, ...)
{ {
va_list ap; va_list ap;
zconfnerrs++; yynerrs++;
fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno());
va_start(ap, err); va_start(ap, err);
vfprintf(stderr, err, ap); vfprintf(stderr, err, ap);
...@@ -611,7 +611,7 @@ static void zconf_error(const char *err, ...) ...@@ -611,7 +611,7 @@ static void zconf_error(const char *err, ...)
fprintf(stderr, "\n"); fprintf(stderr, "\n");
} }
static void zconferror(const char *err) static void yyerror(const char *err)
{ {
fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment