diff options
author | Roman Zippel <zippel@linux-m68k.org> | 2005-11-09 00:34:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 10:55:54 -0500 |
commit | a02f0570ae201c495ee991b959bb974af18f35cc (patch) | |
tree | 363e06307b7355caa2435a006c5385a1149bb7cc /scripts/kconfig/lex.zconf.c_shipped | |
parent | 3370f9f0d9c7d14bf71aab27fa45c0537f130614 (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_shipped | 57 |
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 | ||
329 | typedef unsigned char YY_CHAR; | 329 | typedef unsigned char YY_CHAR; |
@@ -686,10 +686,10 @@ struct yy_trans_info | |||
686 | static yyconst flex_int16_t yy_accept[61] = | 686 | static 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 | ||
756 | static struct { | ||
757 | struct file *file; | ||
758 | int lineno; | ||
759 | } current_pos; | ||
760 | |||
756 | static char *text; | 761 | static char *text; |
757 | static int text_size, text_asize; | 762 | static int text_size, text_asize; |
758 | 763 | ||
@@ -766,7 +771,7 @@ struct buffer *current_buf; | |||
766 | static int last_ts, first_ts; | 771 | static int last_ts, first_ts; |
767 | 772 | ||
768 | static void zconf_endhelp(void); | 773 | static void zconf_endhelp(void); |
769 | static struct buffer *zconf_endfile(void); | 774 | static void zconf_endfile(void); |
770 | 775 | ||
771 | void new_string(void) | 776 | void 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 */ |
994 | case 1: | 999 | case 1: |
995 | /* rule 1 can match eol */ | 1000 | /* rule 1 can match eol */ |
996 | YY_RULE_SETUP | ||
997 | current_file->lineno++; | ||
998 | YY_BREAK | ||
999 | case 2: | 1001 | case 2: |
1002 | /* rule 2 can match eol */ | ||
1000 | YY_RULE_SETUP | 1003 | YY_RULE_SETUP |
1001 | 1004 | { | |
1005 | current_file->lineno++; | ||
1006 | return T_EOL; | ||
1007 | } | ||
1002 | YY_BREAK | 1008 | YY_BREAK |
1003 | case 3: | 1009 | case 3: |
1004 | /* rule 3 can match eol */ | ||
1005 | YY_RULE_SETUP | 1010 | YY_RULE_SETUP |
1006 | current_file->lineno++; return T_EOL; | 1011 | |
1007 | YY_BREAK | 1012 | YY_BREAK |
1008 | case 4: | 1013 | case 4: |
1009 | YY_RULE_SETUP | 1014 | YY_RULE_SETUP |
@@ -1023,8 +1028,10 @@ case 6: | |||
1023 | YY_RULE_SETUP | 1028 | YY_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 | |||
1040 | case 8: | 1047 | case 8: |
1041 | /* rule 8 can match eol */ | 1048 | /* rule 8 can match eol */ |
1042 | YY_RULE_SETUP | 1049 | YY_RULE_SETUP |
1043 | current_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 | ||
1046 | case 9: | 1057 | case 9: |
@@ -1246,9 +1257,9 @@ case YY_STATE_EOF(HELP): | |||
1246 | case YY_STATE_EOF(INITIAL): | 1257 | case YY_STATE_EOF(INITIAL): |
1247 | case YY_STATE_EOF(COMMAND): | 1258 | case 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 | ||
2279 | static struct buffer *zconf_endfile(void) | 2290 | static 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 | ||
2299 | int zconf_lineno(void) | 2308 | int 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 | ||
2307 | char *zconf_curname(void) | 2313 | char *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 | ||