@@ -323,7 +323,7 @@ void zconffree (void * );
323323
324324/* Begin user sect3 */
325325
326- #define zconfwrap(n ) 1
326+ #define zconfwrap() 1
327327#define YY_SKIP_YYWRAP
328328
329329typedef unsigned char YY_CHAR;
@@ -686,10 +686,10 @@ struct yy_trans_info
686686static yyconst flex_int16_t yy_accept[61] =
687687 { 0,
688688 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,
690690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
691- 22, 11, 12, 19, 19, 14, 22, 22, 4, 3 ,
692- 2 , 2 , 1, 6, 32, 29, 31, 30, 24, 23,
691+ 22, 11, 12, 19, 19, 14, 22, 22, 4, 2 ,
692+ 3 , 3 , 1, 6, 32, 29, 31, 30, 24, 23,
693693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
694694 } ;
695695
@@ -753,6 +753,11 @@ char *zconftext;
753753
754754#define START_STRSIZE 16
755755
756+ static struct {
757+ struct file *file;
758+ int lineno;
759+ } current_pos;
760+
756761static char *text;
757762static int text_size, text_asize;
758763
@@ -766,7 +771,7 @@ struct buffer *current_buf;
766771static int last_ts, first_ts;
767772
768773static void zconf_endhelp(void);
769- static struct buffer * zconf_endfile(void);
774+ static void zconf_endfile(void);
770775
771776void new_string(void)
772777{
@@ -993,17 +998,17 @@ do_action: /* This label is used only to access EOF actions. */
993998 { /* beginning of action switch */
994999case 1:
9951000/* rule 1 can match eol */
996- YY_RULE_SETUP
997- current_file->lineno++;
998- YY_BREAK
9991001case 2:
1002+ /* rule 2 can match eol */
10001003YY_RULE_SETUP
1001-
1004+ {
1005+ current_file->lineno++;
1006+ return T_EOL;
1007+ }
10021008 YY_BREAK
10031009case 3:
1004- /* rule 3 can match eol */
10051010YY_RULE_SETUP
1006- current_file->lineno++; return T_EOL;
1011+
10071012 YY_BREAK
10081013case 4:
10091014YY_RULE_SETUP
@@ -1023,8 +1028,10 @@ case 6:
10231028YY_RULE_SETUP
10241029{
10251030 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;
10261034 if (id && id->flags & TF_COMMAND) {
1027- BEGIN(PARAM);
10281035 zconflval.id = id;
10291036 return id->token;
10301037 }
@@ -1040,7 +1047,11 @@ YY_RULE_SETUP
10401047case 8:
10411048/* rule 8 can match eol */
10421049YY_RULE_SETUP
1043- current_file->lineno++; BEGIN(INITIAL);
1050+ {
1051+ BEGIN(INITIAL);
1052+ current_file->lineno++;
1053+ return T_EOL;
1054+ }
10441055 YY_BREAK
10451056
10461057case 9:
@@ -1246,9 +1257,9 @@ case YY_STATE_EOF(HELP):
12461257case YY_STATE_EOF(INITIAL):
12471258case YY_STATE_EOF(COMMAND):
12481259{
1249- if (current_buf ) {
1260+ if (current_file ) {
12501261 zconf_endfile();
1251- return T_EOF ;
1262+ return T_EOL ;
12521263 }
12531264 fclose(zconfin);
12541265 yyterminate();
@@ -1958,7 +1969,7 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
19581969
19591970/** Setup the input buffer state to scan a string. The next call to zconflex() will
19601971 * 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
19621973 *
19631974 * @return the newly allocated buffer state object.
19641975 * @note If you want to scan bytes that may contain NUL values, then use
@@ -2276,7 +2287,7 @@ void zconf_nextfile(const char *name)
22762287 current_file = file;
22772288}
22782289
2279- static struct buffer * zconf_endfile(void)
2290+ static void zconf_endfile(void)
22802291{
22812292 struct buffer *parent;
22822293
@@ -2292,23 +2303,15 @@ static struct buffer *zconf_endfile(void)
22922303 }
22932304 free(current_buf);
22942305 current_buf = parent;
2295-
2296- return parent;
22972306}
22982307
22992308int zconf_lineno(void)
23002309{
2301- if (current_buf)
2302- return current_file->lineno - 1;
2303- else
2304- return 0;
2310+ return current_pos.lineno;
23052311}
23062312
23072313char *zconf_curname(void)
23082314{
2309- if (current_buf)
2310- return current_file->name;
2311- else
2312- return "<none>";
2315+ return current_pos.file ? current_pos.file->name : "<none>";
23132316}
23142317
0 commit comments