Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3370f9f0 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds
Browse files

[PATCH] kconfig: simplify symbol type parsing



This simplifies the parser a bit by merging the various symbol types into a
single token and adds the type to the keyword hash.

Signed-off-by: default avatarRoman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7a88488b
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -1025,6 +1025,7 @@ YY_RULE_SETUP
		struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
		struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
		if (id && id->flags & TF_COMMAND) {
		if (id && id->flags & TF_COMMAND) {
			BEGIN(PARAM);
			BEGIN(PARAM);
			zconflval.id = id;
			return id->token;
			return id->token;
		}
		}
		alloc_string(zconftext, zconfleng);
		alloc_string(zconftext, zconfleng);
@@ -1091,8 +1092,10 @@ case 19:
YY_RULE_SETUP
YY_RULE_SETUP
{
{
		struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
		struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
		if (id && id->flags & TF_PARAM)
		if (id && id->flags & TF_PARAM) {
			zconflval.id = id;
			return id->token;
			return id->token;
		}
		alloc_string(zconftext, zconfleng);
		alloc_string(zconftext, zconfleng);
		zconflval.string = text;
		zconflval.string = text;
		return T_WORD;
		return T_WORD;
+1 −0
Original line number Original line Diff line number Diff line
@@ -45,6 +45,7 @@ struct kconf_id {
	int name;
	int name;
	int token;
	int token;
	unsigned int flags;
	unsigned int flags;
	enum symbol_type stype;
};
};


int zconfparse(void);
int zconfparse(void);
+10 −10
Original line number Original line Diff line number Diff line
@@ -25,17 +25,17 @@ endif, T_ENDIF, TF_COMMAND
depends,	T_DEPENDS,	TF_COMMAND
depends,	T_DEPENDS,	TF_COMMAND
requires,	T_REQUIRES,	TF_COMMAND
requires,	T_REQUIRES,	TF_COMMAND
optional,	T_OPTIONAL,	TF_COMMAND
optional,	T_OPTIONAL,	TF_COMMAND
default,	T_DEFAULT,	TF_COMMAND
default,	T_DEFAULT,	TF_COMMAND, S_UNKNOWN
prompt,		T_PROMPT,	TF_COMMAND
prompt,		T_PROMPT,	TF_COMMAND
tristate,	T_TRISTATE,	TF_COMMAND
tristate,	T_TYPE,		TF_COMMAND, S_TRISTATE
def_tristate,	T_DEF_TRISTATE,	TF_COMMAND
def_tristate,	T_DEFAULT,	TF_COMMAND, S_TRISTATE
bool,		T_BOOLEAN,	TF_COMMAND
bool,		T_TYPE,		TF_COMMAND, S_BOOLEAN
boolean,	T_BOOLEAN,	TF_COMMAND
boolean,	T_TYPE,		TF_COMMAND, S_BOOLEAN
def_bool,	T_DEF_BOOLEAN,	TF_COMMAND
def_bool,	T_DEFAULT,	TF_COMMAND, S_BOOLEAN
def_boolean,	T_DEF_BOOLEAN,	TF_COMMAND
def_boolean,	T_DEFAULT,	TF_COMMAND, S_BOOLEAN
int,		T_INT,		TF_COMMAND
int,		T_TYPE,		TF_COMMAND, S_INT
hex,		T_HEX,		TF_COMMAND
hex,		T_TYPE,		TF_COMMAND, S_HEX
string,		T_STRING,	TF_COMMAND
string,		T_TYPE,		TF_COMMAND, S_STRING
select,		T_SELECT,	TF_COMMAND
select,		T_SELECT,	TF_COMMAND
enable,		T_SELECT,	TF_COMMAND
enable,		T_SELECT,	TF_COMMAND
range,		T_RANGE,	TF_COMMAND
range,		T_RANGE,	TF_COMMAND
+10 −10
Original line number Original line Diff line number Diff line
@@ -172,27 +172,27 @@ kconf_id_lookup (register const char *str, register unsigned int len)
    {
    {
      {-1}, {-1},
      {-1}, {-1},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2,		T_IF,		TF_COMMAND|TF_PARAM},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2,		T_IF,		TF_COMMAND|TF_PARAM},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3,		T_INT,		TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3,		T_TYPE,		TF_COMMAND, S_INT},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str4,		T_HELP,		TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str4,		T_HELP,		TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5,		T_ENDIF,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5,		T_ENDIF,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6,		T_SELECT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6,		T_SELECT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7,	T_ENDMENU,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7,	T_ENDMENU,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8,	T_TRISTATE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8,	T_TYPE,		TF_COMMAND, S_TRISTATE},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9,	T_ENDCHOICE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9,	T_ENDCHOICE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10,		T_RANGE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10,		T_RANGE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11,		T_STRING,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11,		T_TYPE,		TF_COMMAND, S_STRING},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12,	T_DEFAULT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12,	T_DEFAULT,	TF_COMMAND, S_UNKNOWN},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13,	T_DEF_BOOLEAN,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13,	T_DEFAULT,	TF_COMMAND, S_BOOLEAN},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14,		T_MENU,		TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14,		T_MENU,		TF_COMMAND},
      {-1},
      {-1},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16,	T_DEF_BOOLEAN,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16,	T_DEFAULT,	TF_COMMAND, S_BOOLEAN},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17,	T_DEF_TRISTATE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17,	T_DEFAULT,	TF_COMMAND, S_TRISTATE},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18,	T_MAINMENU,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18,	T_MAINMENU,	TF_COMMAND},
      {-1},
      {-1},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20,	T_MENUCONFIG,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20,	T_MENUCONFIG,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21,		T_CONFIG,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21,		T_CONFIG,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22,		T_ON,		TF_PARAM},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22,		T_ON,		TF_PARAM},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23,		T_HEX,		TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23,		T_TYPE,		TF_COMMAND, S_HEX},
      {-1}, {-1},
      {-1}, {-1},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26,		T_SOURCE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26,		T_SOURCE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27,	T_DEPENDS,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27,	T_DEPENDS,	TF_COMMAND},
@@ -201,9 +201,9 @@ kconf_id_lookup (register const char *str, register unsigned int len)
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31,		T_SELECT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31,		T_SELECT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32,	T_COMMENT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32,	T_COMMENT,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33,	T_REQUIRES,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33,	T_REQUIRES,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34,		T_BOOLEAN,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34,		T_TYPE,		TF_COMMAND, S_BOOLEAN},
      {-1}, {-1},
      {-1}, {-1},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37,	T_BOOLEAN,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37,	T_TYPE,		TF_COMMAND, S_BOOLEAN},
      {-1}, {-1}, {-1},
      {-1}, {-1}, {-1},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41,		T_CHOICE,	TF_COMMAND},
      {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41,		T_CHOICE,	TF_COMMAND},
      {-1}, {-1}, {-1}, {-1},
      {-1}, {-1}, {-1}, {-1},
+4 −1
Original line number Original line Diff line number Diff line
@@ -90,6 +90,7 @@ n [A-Za-z0-9_]
		struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
		struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
		if (id && id->flags & TF_COMMAND) {
		if (id && id->flags & TF_COMMAND) {
			BEGIN(PARAM);
			BEGIN(PARAM);
			zconflval.id = id;
			return id->token;
			return id->token;
		}
		}
		alloc_string(yytext, yyleng);
		alloc_string(yytext, yyleng);
@@ -117,8 +118,10 @@ n [A-Za-z0-9_]
	---	/* ignore */
	---	/* ignore */
	({n}|[-/.])+	{
	({n}|[-/.])+	{
		struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
		struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
		if (id && id->flags & TF_PARAM)
		if (id && id->flags & TF_PARAM) {
			zconflval.id = id;
			return id->token;
			return id->token;
		}
		alloc_string(yytext, yyleng);
		alloc_string(yytext, yyleng);
		zconflval.string = text;
		zconflval.string = text;
		return T_WORD;
		return T_WORD;
Loading