aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/lex.zconf.c_shipped
diff options
context:
space:
mode:
authorRoman Zippel <zippel@linux-m68k.org>2005-11-09 00:34:53 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:55:54 -0500
commita02f0570ae201c495ee991b959bb974af18f35cc (patch)
tree363e06307b7355caa2435a006c5385a1149bb7cc /scripts/kconfig/lex.zconf.c_shipped
parent3370f9f0d9c7d14bf71aab27fa45c0537f130614 (diff)
[PATCH] kconfig: improve error handling in the parser
Add a few error tokens to the parser to catch common errors and print more descriptive error messages. Signed-off-by: Roman Zippel <zippel@linux-m68k.org> Cc: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'scripts/kconfig/lex.zconf.c_shipped')
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped57
1 files changed, 30 insertions, 27 deletions
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index bedba89a87c6..24e3c8cbb7ac 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -323,7 +323,7 @@ void zconffree (void * );
323 323
324/* Begin user sect3 */ 324/* Begin user sect3 */
325 325
326#define zconfwrap(n) 1 326#define zconfwrap() 1
327#define YY_SKIP_YYWRAP 327#define YY_SKIP_YYWRAP
328 328
329typedef unsigned char YY_CHAR; 329typedef unsigned char YY_CHAR;
@@ -686,10 +686,10 @@ struct yy_trans_info
686static yyconst flex_int16_t yy_accept[61] = 686static yyconst flex_int16_t yy_accept[61] =
687 { 0, 687 { 0,
688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
689 34, 5, 4, 3, 2, 7, 8, 6, 32, 29, 689 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20, 690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
691 22, 11, 12, 19, 19, 14, 22, 22, 4, 3, 691 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
692 2, 2, 1, 6, 32, 29, 31, 30, 24, 23, 692 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18 693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
694 } ; 694 } ;
695 695
@@ -753,6 +753,11 @@ char *zconftext;
753 753
754#define START_STRSIZE 16 754#define START_STRSIZE 16
755 755
756static struct {
757 struct file *file;
758 int lineno;
759} current_pos;
760
756static char *text; 761static char *text;
757static int text_size, text_asize; 762static int text_size, text_asize;
758 763
@@ -766,7 +771,7 @@ struct buffer *current_buf;
766static int last_ts, first_ts; 771static int last_ts, first_ts;
767 772
768static void zconf_endhelp(void); 773static void zconf_endhelp(void);
769static struct buffer *zconf_endfile(void); 774static void zconf_endfile(void);
770 775
771void new_string(void) 776void new_string(void)
772{ 777{
@@ -993,17 +998,17 @@ do_action: /* This label is used only to access EOF actions. */
993 { /* beginning of action switch */ 998 { /* beginning of action switch */
994case 1: 999case 1:
995/* rule 1 can match eol */ 1000/* rule 1 can match eol */
996YY_RULE_SETUP
997current_file->lineno++;
998 YY_BREAK
999case 2: 1001case 2:
1002/* rule 2 can match eol */
1000YY_RULE_SETUP 1003YY_RULE_SETUP
1001 1004{
1005 current_file->lineno++;
1006 return T_EOL;
1007}
1002 YY_BREAK 1008 YY_BREAK
1003case 3: 1009case 3:
1004/* rule 3 can match eol */
1005YY_RULE_SETUP 1010YY_RULE_SETUP
1006current_file->lineno++; return T_EOL; 1011
1007 YY_BREAK 1012 YY_BREAK
1008case 4: 1013case 4:
1009YY_RULE_SETUP 1014YY_RULE_SETUP
@@ -1023,8 +1028,10 @@ case 6:
1023YY_RULE_SETUP 1028YY_RULE_SETUP
1024{ 1029{
1025 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); 1030 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1031 BEGIN(PARAM);
1032 current_pos.file = current_file;
1033 current_pos.lineno = current_file->lineno;
1026 if (id && id->flags & TF_COMMAND) { 1034 if (id && id->flags & TF_COMMAND) {
1027 BEGIN(PARAM);
1028 zconflval.id = id; 1035 zconflval.id = id;
1029 return id->token; 1036 return id->token;
1030 } 1037 }
@@ -1040,7 +1047,11 @@ YY_RULE_SETUP
1040case 8: 1047case 8:
1041/* rule 8 can match eol */ 1048/* rule 8 can match eol */
1042YY_RULE_SETUP 1049YY_RULE_SETUP
1043current_file->lineno++; BEGIN(INITIAL); 1050{
1051 BEGIN(INITIAL);
1052 current_file->lineno++;
1053 return T_EOL;
1054 }
1044 YY_BREAK 1055 YY_BREAK
1045 1056
1046case 9: 1057case 9:
@@ -1246,9 +1257,9 @@ case YY_STATE_EOF(HELP):
1246case YY_STATE_EOF(INITIAL): 1257case YY_STATE_EOF(INITIAL):
1247case YY_STATE_EOF(COMMAND): 1258case YY_STATE_EOF(COMMAND):
1248{ 1259{
1249 if (current_buf) { 1260 if (current_file) {
1250 zconf_endfile(); 1261 zconf_endfile();
1251 return T_EOF; 1262 return T_EOL;
1252 } 1263 }
1253 fclose(zconfin); 1264 fclose(zconfin);
1254 yyterminate(); 1265 yyterminate();
@@ -1958,7 +1969,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1958 1969
1959/** Setup the input buffer state to scan a string. The next call to zconflex() will 1970/** Setup the input buffer state to scan a string. The next call to zconflex() will
1960 * scan from a @e copy of @a str. 1971 * scan from a @e copy of @a str.
1961 * @param str a NUL-terminated string to scan 1972 * @param yy_str a NUL-terminated string to scan
1962 * 1973 *
1963 * @return the newly allocated buffer state object. 1974 * @return the newly allocated buffer state object.
1964 * @note If you want to scan bytes that may contain NUL values, then use 1975 * @note If you want to scan bytes that may contain NUL values, then use
@@ -2276,7 +2287,7 @@ void zconf_nextfile(const char *name)
2276 current_file = file; 2287 current_file = file;
2277} 2288}
2278 2289
2279static struct buffer *zconf_endfile(void) 2290static void zconf_endfile(void)
2280{ 2291{
2281 struct buffer *parent; 2292 struct buffer *parent;
2282 2293
@@ -2292,23 +2303,15 @@ static struct buffer *zconf_endfile(void)
2292 } 2303 }
2293 free(current_buf); 2304 free(current_buf);
2294 current_buf = parent; 2305 current_buf = parent;
2295
2296 return parent;
2297} 2306}
2298 2307
2299int zconf_lineno(void) 2308int zconf_lineno(void)
2300{ 2309{
2301 if (current_buf) 2310 return current_pos.lineno;
2302 return current_file->lineno - 1;
2303 else
2304 return 0;
2305} 2311}
2306 2312
2307char *zconf_curname(void) 2313char *zconf_curname(void)
2308{ 2314{
2309 if (current_buf) 2315 return current_pos.file ? current_pos.file->name : "<none>";
2310 return current_file->name;
2311 else
2312 return "<none>";
2313} 2316}
2314 2317