summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/parse/parse_c/bitbakescanner.cc')
-rw-r--r--bitbake/lib/bb/parse/parse_c/bitbakescanner.cc218
1 files changed, 113 insertions, 105 deletions
diff --git a/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc b/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc
index 43dad12d39..acc13f7c34 100644
--- a/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc
+++ b/bitbake/lib/bb/parse/parse_c/bitbakescanner.cc
@@ -8,7 +8,7 @@
8#define FLEX_SCANNER 8#define FLEX_SCANNER
9#define YY_FLEX_MAJOR_VERSION 2 9#define YY_FLEX_MAJOR_VERSION 2
10#define YY_FLEX_MINOR_VERSION 5 10#define YY_FLEX_MINOR_VERSION 5
11#define YY_FLEX_SUBMINOR_VERSION 31 11#define YY_FLEX_SUBMINOR_VERSION 33
12#if YY_FLEX_SUBMINOR_VERSION > 0 12#if YY_FLEX_SUBMINOR_VERSION > 0
13#define FLEX_BETA 13#define FLEX_BETA
14#endif 14#endif
@@ -30,7 +30,15 @@
30 30
31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32 32
33#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L 33#if __STDC_VERSION__ >= 199901L
34
35/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
37 */
38#ifndef __STDC_LIMIT_MACROS
39#define __STDC_LIMIT_MACROS 1
40#endif
41
34#include <inttypes.h> 42#include <inttypes.h>
35typedef int8_t flex_int8_t; 43typedef int8_t flex_int8_t;
36typedef uint8_t flex_uint8_t; 44typedef uint8_t flex_uint8_t;
@@ -153,6 +161,10 @@ int yylex_init (yyscan_t* scanner);
153#define YY_BUF_SIZE 16384 161#define YY_BUF_SIZE 16384
154#endif 162#endif
155 163
164/* The state buf must be large enough to hold one state per character in the main buffer.
165 */
166#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
167
156#ifndef YY_TYPEDEF_YY_BUFFER_STATE 168#ifndef YY_TYPEDEF_YY_BUFFER_STATE
157#define YY_TYPEDEF_YY_BUFFER_STATE 169#define YY_TYPEDEF_YY_BUFFER_STATE
158typedef struct yy_buffer_state *YY_BUFFER_STATE; 170typedef struct yy_buffer_state *YY_BUFFER_STATE;
@@ -493,7 +505,7 @@ static yyconst flex_int32_t yy_ec[256] =
493static yyconst flex_int32_t yy_meta[59] = 505static yyconst flex_int32_t yy_meta[59] =
494 { 0, 506 { 0,
495 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 507 1, 1, 2, 3, 1, 1, 4, 1, 1, 1,
496 5, 6, 5, 5, 7, 8, 1, 7, 1, 9, 508 5, 6, 5, 5, 5, 7, 1, 8, 1, 9,
497 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 509 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
498 9, 9, 10, 1, 11, 9, 9, 9, 9, 9, 510 9, 9, 10, 1, 11, 9, 9, 9, 9, 9,
499 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 511 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
@@ -565,18 +577,18 @@ static yyconst flex_int16_t yy_base[847] =
565 2077, 2072, 2066, 2069, 2056, 2067, 1398, 1343, 1408, 1404, 577 2077, 2072, 2066, 2069, 2056, 2067, 1398, 1343, 1408, 1404,
566 643, 1409, 2071, 2066, 2060, 2063, 2050, 2061, 2065, 2060, 578 643, 1409, 2071, 2066, 2060, 2063, 2050, 2061, 2065, 2060,
567 2054, 2057, 2044, 2055, 1420, 1445, 1413, 1447, 1453, 1454, 579 2054, 2057, 2044, 2055, 1420, 1445, 1413, 1447, 1453, 1454,
568 2059, 2054, 2047, 2050, 2035, 2043, 1455, 1459, 1460, 1461, 580 2059, 2053, 2047, 2049, 2032, 2043, 1455, 1459, 1460, 1461,
569 1462, 1463, 1471, 1436, 1430, 1192, 1433, 1479, 1482, 1492, 581 1462, 1463, 1471, 1436, 1430, 1192, 1433, 1479, 1482, 1492,
570 582
571 1506, 1519, 1520, 1528, 2047, 2040, 2031, 0, 2034, 2019, 583 1506, 1519, 1520, 1528, 2046, 2037, 2031, 0, 2033, 2016,
572 2027, 1486, 1496, 1505, 1506, 1510, 1516, 1524, 2044, 2018, 584 2027, 1486, 1496, 1505, 1506, 1510, 1516, 1524, 2043, 2015,
573 0, 0, 0, 0, 1281, 1517, 2043, 2042, 2039, 2035, 585 0, 0, 0, 0, 1281, 1517, 2043, 2041, 2036, 2034,
574 2023, 1994, 2309, 2309, 2309, 2309, 2005, 1981, 0, 0, 586 2024, 1995, 2309, 2309, 2309, 2309, 2005, 1981, 0, 0,
575 0, 0, 1538, 1528, 1530, 1534, 1537, 1540, 1981, 1957, 587 0, 0, 1538, 1528, 1530, 1534, 1537, 1540, 1981, 1957,
576 0, 0, 0, 0, 1557, 1558, 1559, 1560, 1561, 1563, 588 0, 0, 0, 0, 1557, 1558, 1559, 1560, 1561, 1563,
577 1568, 1547, 1988, 1959, 1954, 1948, 1580, 1581, 1582, 1590, 589 1568, 1547, 1988, 1959, 1955, 1948, 1580, 1581, 1582, 1590,
578 1592, 1594, 1923, 1863, 0, 0, 0, 0, 1598, 1599, 590 1592, 1594, 1924, 1863, 0, 0, 0, 0, 1598, 1599,
579 1600, 1874, 1858, 1350, 1584, 1803, 1792, 1801, 1790, 1603, 591 1600, 1875, 1859, 1350, 1584, 1803, 1792, 1801, 1790, 1603,
580 1601, 1799, 1788, 1604, 1602, 1610, 1609, 1643, 1644, 1797, 592 1601, 1799, 1788, 1604, 1602, 1610, 1609, 1643, 1644, 1797,
581 593
582 1786, 1611, 1630, 1800, 1773, 1010, 1606, 1798, 1771, 1795, 594 1786, 1611, 1630, 1800, 1773, 1010, 1606, 1798, 1771, 1795,
@@ -593,8 +605,8 @@ static yyconst flex_int16_t yy_base[847] =
593 1768, 0, 742, 2309, 0, 1764, 0, 1778, 678, 1801, 605 1768, 0, 742, 2309, 0, 1764, 0, 1778, 678, 1801,
594 0, 2309, 1835, 1847, 1859, 1871, 1883, 550, 1892, 1898, 606 0, 2309, 1835, 1847, 1859, 1871, 1883, 550, 1892, 1898,
595 1907, 1919, 1931, 1939, 1945, 1950, 1956, 1965, 1977, 1989, 607 1907, 1919, 1931, 1939, 1945, 1950, 1956, 1965, 1977, 1989,
596 2001, 2013, 2025, 2033, 2039, 2042, 306, 304, 301, 2049, 608 2001, 2013, 2025, 2033, 2039, 2043, 306, 304, 301, 2050,
597 213, 2057, 136, 2065, 2073, 2081 609 213, 2058, 136, 2066, 2074, 2082
598 } ; 610 } ;
599 611
600static yyconst flex_int16_t yy_def[847] = 612static yyconst flex_int16_t yy_def[847] =
@@ -903,14 +915,14 @@ static yyconst flex_int16_t yy_nxt[2368] =
903 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 915 112, 112, 112, 112, 112, 112, 112, 112, 112, 112,
904 112, 128, 128, 128, 128, 128, 128, 128, 128, 128, 916 112, 128, 128, 128, 128, 128, 128, 128, 128, 128,
905 128, 128, 128, 155, 155, 155, 155, 155, 155, 155, 917 128, 128, 128, 155, 155, 155, 155, 155, 155, 155,
906 155, 155, 155, 155, 155, 167, 167, 167, 705, 167, 918 155, 155, 155, 155, 155, 167, 167, 167, 167, 705,
907 919
908 167, 167, 177, 177, 704, 177, 177, 183, 701, 183, 920 167, 167, 177, 177, 177, 704, 177, 183, 701, 183,
909 183, 183, 183, 183, 183, 183, 183, 183, 183, 187, 921 183, 183, 183, 183, 183, 183, 183, 183, 183, 187,
910 187, 187, 187, 187, 187, 187, 187, 187, 187, 187, 922 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
911 187, 201, 201, 201, 201, 201, 201, 201, 201, 201, 923 187, 201, 201, 201, 201, 201, 201, 201, 201, 201,
912 201, 201, 201, 209, 209, 700, 209, 209, 217, 217, 924 201, 201, 201, 209, 209, 209, 700, 209, 217, 217,
913 238, 217, 217, 217, 223, 223, 238, 223, 223, 231, 925 238, 217, 217, 217, 223, 223, 223, 238, 223, 231,
914 231, 238, 231, 231, 231, 237, 237, 237, 237, 237, 926 231, 238, 231, 231, 231, 237, 237, 237, 237, 237,
915 237, 237, 237, 237, 237, 237, 237, 239, 239, 239, 927 237, 237, 237, 237, 237, 237, 237, 239, 239, 239,
916 239, 239, 239, 239, 239, 239, 239, 239, 239, 256, 928 239, 239, 239, 239, 239, 239, 239, 239, 239, 256,
@@ -919,13 +931,13 @@ static yyconst flex_int16_t yy_nxt[2368] =
919 256, 261, 693, 692, 261, 261, 261, 261, 261, 261, 931 256, 261, 693, 692, 261, 261, 261, 261, 261, 261,
920 261, 261, 261, 264, 264, 264, 264, 264, 264, 264, 932 261, 261, 261, 264, 264, 264, 264, 264, 264, 264,
921 264, 264, 264, 264, 264, 267, 689, 688, 267, 267, 933 264, 264, 264, 264, 264, 267, 689, 688, 267, 267,
922 267, 267, 267, 267, 267, 267, 267, 284, 284, 687, 934 267, 267, 267, 267, 267, 267, 267, 284, 284, 284,
923 284, 284, 292, 292, 292, 686, 292, 292, 292, 296, 935 687, 284, 292, 292, 292, 292, 686, 292, 292, 296,
924 296, 184, 296, 418, 418, 184, 418, 418, 184, 184, 936 184, 296, 184, 296, 418, 418, 418, 184, 418, 184,
925 418, 433, 433, 683, 433, 433, 682, 678, 433, 465, 937 683, 418, 433, 433, 433, 682, 433, 678, 677, 433,
926 465, 677, 465, 465, 676, 675, 465, 500, 500, 674, 938 465, 465, 465, 676, 465, 675, 674, 465, 500, 500,
927 500, 500, 673, 654, 500, 514, 514, 653, 514, 514, 939 500, 673, 500, 654, 653, 500, 514, 514, 514, 652,
928 652, 651, 514, 650, 649, 642, 641, 640, 639, 638, 940 514, 651, 650, 514, 649, 642, 641, 640, 639, 638,
929 941
930 637, 636, 635, 634, 633, 632, 631, 624, 623, 622, 942 637, 636, 635, 634, 633, 632, 631, 624, 623, 622,
931 621, 620, 619, 611, 610, 609, 608, 607, 606, 605, 943 621, 620, 619, 611, 610, 609, 608, 607, 606, 605,
@@ -1167,14 +1179,14 @@ static yyconst flex_int16_t yy_chk[2368] =
1167 815, 815, 815, 815, 815, 815, 815, 815, 815, 815, 1179 815, 815, 815, 815, 815, 815, 815, 815, 815, 815,
1168 815, 816, 816, 816, 816, 816, 816, 816, 816, 816, 1180 815, 816, 816, 816, 816, 816, 816, 816, 816, 816,
1169 816, 816, 816, 817, 817, 817, 817, 817, 817, 817, 1181 816, 816, 816, 817, 817, 817, 817, 817, 817, 817,
1170 817, 817, 817, 817, 817, 819, 819, 819, 683, 819, 1182 817, 817, 817, 817, 817, 819, 819, 819, 819, 683,
1171 1183
1172 819, 819, 820, 820, 682, 820, 820, 821, 674, 821, 1184 819, 819, 820, 820, 820, 682, 820, 821, 674, 821,
1173 821, 821, 821, 821, 821, 821, 821, 821, 821, 822, 1185 821, 821, 821, 821, 821, 821, 821, 821, 821, 822,
1174 822, 822, 822, 822, 822, 822, 822, 822, 822, 822, 1186 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
1175 822, 823, 823, 823, 823, 823, 823, 823, 823, 823, 1187 822, 823, 823, 823, 823, 823, 823, 823, 823, 823,
1176 823, 823, 823, 824, 824, 673, 824, 824, 825, 825, 1188 823, 823, 823, 824, 824, 824, 673, 824, 825, 825,
1177 666, 825, 825, 825, 826, 826, 665, 826, 826, 827, 1189 666, 825, 825, 825, 826, 826, 826, 665, 826, 827,
1178 827, 664, 827, 827, 827, 828, 828, 828, 828, 828, 1190 827, 664, 827, 827, 827, 828, 828, 828, 828, 828,
1179 828, 828, 828, 828, 828, 828, 828, 829, 829, 829, 1191 828, 828, 828, 828, 828, 828, 828, 829, 829, 829,
1180 829, 829, 829, 829, 829, 829, 829, 829, 829, 830, 1192 829, 829, 829, 829, 829, 829, 829, 829, 829, 830,
@@ -1183,13 +1195,13 @@ static yyconst flex_int16_t yy_chk[2368] =
1183 830, 831, 650, 649, 831, 831, 831, 831, 831, 831, 1195 830, 831, 650, 649, 831, 831, 831, 831, 831, 831,
1184 831, 831, 831, 832, 832, 832, 832, 832, 832, 832, 1196 831, 831, 831, 832, 832, 832, 832, 832, 832, 832,
1185 832, 832, 832, 832, 832, 833, 638, 637, 833, 833, 1197 832, 832, 832, 832, 832, 833, 638, 637, 833, 833,
1186 833, 833, 833, 833, 833, 833, 833, 834, 834, 632, 1198 833, 833, 833, 833, 833, 833, 833, 834, 834, 834,
1187 834, 834, 835, 835, 835, 631, 835, 835, 835, 836, 1199 632, 834, 835, 835, 835, 835, 631, 835, 835, 836,
1188 836, 630, 836, 840, 840, 629, 840, 840, 628, 627, 1200 630, 836, 629, 836, 840, 840, 840, 628, 840, 627,
1189 840, 842, 842, 620, 842, 842, 619, 611, 842, 844, 1201 620, 840, 842, 842, 842, 619, 842, 611, 610, 842,
1190 844, 610, 844, 844, 609, 607, 844, 845, 845, 606, 1202 844, 844, 844, 609, 844, 607, 606, 844, 845, 845,
1191 845, 845, 605, 586, 845, 846, 846, 585, 846, 846, 1203 845, 605, 845, 586, 585, 845, 846, 846, 846, 584,
1192 584, 583, 846, 582, 581, 574, 573, 572, 571, 570, 1204 846, 583, 582, 846, 581, 574, 573, 572, 571, 570,
1193 1205
1194 569, 568, 567, 566, 565, 564, 563, 556, 555, 554, 1206 569, 568, 567, 566, 565, 564, 563, 556, 555, 554,
1195 553, 552, 551, 541, 540, 539, 538, 536, 535, 534, 1207 553, 552, 551, 541, 540, 539, 538, 536, 535, 534,
@@ -1323,7 +1335,7 @@ int errorParse;
1323enum { 1335enum {
1324 errorNone = 0, 1336 errorNone = 0,
1325 errorUnexpectedInput, 1337 errorUnexpectedInput,
1326 errorUnsupportedFeature, 1338 errorUnsupportedFeature,
1327}; 1339};
1328 1340
1329} 1341}
@@ -1351,7 +1363,7 @@ static const char* fixup_escapes (const char* sz);
1351 1363
1352 1364
1353 1365
1354#line 1355 "<stdout>" 1366#line 1367 "<stdout>"
1355 1367
1356#define INITIAL 0 1368#define INITIAL 0
1357#define S_DEF 1 1369#define S_DEF 1
@@ -1587,11 +1599,11 @@ YY_DECL
1587#line 164 "bitbakescanner.l" 1599#line 164 "bitbakescanner.l"
1588 1600
1589 1601
1590#line 1591 "<stdout>" 1602#line 1603 "<stdout>"
1591 1603
1592 if ( yyg->yy_init ) 1604 if ( !yyg->yy_init )
1593 { 1605 {
1594 yyg->yy_init = 0; 1606 yyg->yy_init = 1;
1595 1607
1596#ifdef YY_USER_INIT 1608#ifdef YY_USER_INIT
1597 YY_USER_INIT; 1609 YY_USER_INIT;
@@ -1972,7 +1984,7 @@ YY_RULE_SETUP
1972#line 254 "bitbakescanner.l" 1984#line 254 "bitbakescanner.l"
1973ECHO; 1985ECHO;
1974 YY_BREAK 1986 YY_BREAK
1975#line 1976 "<stdout>" 1987#line 1988 "<stdout>"
1976 1988
1977 case YY_END_OF_BUFFER: 1989 case YY_END_OF_BUFFER:
1978 { 1990 {
@@ -2274,7 +2286,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
2274 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) 2286 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2275{ 2287{
2276 register int yy_is_jam; 2288 register int yy_is_jam;
2277 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 2289 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
2278 register char *yy_cp = yyg->yy_c_buf_p; 2290 register char *yy_cp = yyg->yy_c_buf_p;
2279 2291
2280 register YY_CHAR yy_c = 1; 2292 register YY_CHAR yy_c = 1;
@@ -2730,10 +2742,10 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann
2730 * @note If you want to scan bytes that may contain NUL values, then use 2742 * @note If you want to scan bytes that may contain NUL values, then use
2731 * yy_scan_bytes() instead. 2743 * yy_scan_bytes() instead.
2732 */ 2744 */
2733YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner) 2745YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
2734{ 2746{
2735 2747
2736 return yy_scan_bytes(yy_str,strlen(yy_str) ,yyscanner); 2748 return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
2737} 2749}
2738 2750
2739/** Setup the input buffer state to scan the given bytes. The next call to yylex() will 2751/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
@@ -2743,7 +2755,7 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str , yyscan_t yyscanner)
2743 * @param yyscanner The scanner object. 2755 * @param yyscanner The scanner object.
2744 * @return the newly allocated buffer state object. 2756 * @return the newly allocated buffer state object.
2745 */ 2757 */
2746YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner) 2758YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2747{ 2759{
2748 YY_BUFFER_STATE b; 2760 YY_BUFFER_STATE b;
2749 char *buf; 2761 char *buf;
@@ -2751,15 +2763,15 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscan
2751 int i; 2763 int i;
2752 2764
2753 /* Get memory for full buffer, including space for trailing EOB's. */ 2765 /* Get memory for full buffer, including space for trailing EOB's. */
2754 n = len + 2; 2766 n = _yybytes_len + 2;
2755 buf = (char *) yyalloc(n ,yyscanner ); 2767 buf = (char *) yyalloc(n ,yyscanner );
2756 if ( ! buf ) 2768 if ( ! buf )
2757 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 2769 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2758 2770
2759 for ( i = 0; i < len; ++i ) 2771 for ( i = 0; i < _yybytes_len; ++i )
2760 buf[i] = bytes[i]; 2772 buf[i] = yybytes[i];
2761 2773
2762 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; 2774 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2763 2775
2764 b = yy_scan_buffer(buf,n ,yyscanner); 2776 b = yy_scan_buffer(buf,n ,yyscanner);
2765 if ( ! b ) 2777 if ( ! b )
@@ -2987,21 +2999,51 @@ void yyset_debug (int bdebug , yyscan_t yyscanner)
2987 2999
2988/* Accessor methods for yylval and yylloc */ 3000/* Accessor methods for yylval and yylloc */
2989 3001
3002/* User-visible API */
3003
3004/* yylex_init is special because it creates the scanner itself, so it is
3005 * the ONLY reentrant function that doesn't take the scanner as the last argument.
3006 * That's why we explicitly handle the declaration, instead of using our macros.
3007 */
3008
3009int yylex_init(yyscan_t* ptr_yy_globals)
3010
3011{
3012 if (ptr_yy_globals == NULL){
3013 errno = EINVAL;
3014 return 1;
3015 }
3016
3017 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
3018
3019 if (*ptr_yy_globals == NULL){
3020 errno = ENOMEM;
3021 return 1;
3022 }
3023
3024 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
3025 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
3026
3027 return yy_init_globals ( *ptr_yy_globals );
3028}
3029
2990static int yy_init_globals (yyscan_t yyscanner) 3030static int yy_init_globals (yyscan_t yyscanner)
2991{ 3031{
2992 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; 3032 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2993 /* Initialization is the same as for the non-reentrant scanner. 3033 /* Initialization is the same as for the non-reentrant scanner.
2994 This function is called once per scanner lifetime. */ 3034 * This function is called from yylex_destroy(), so don't allocate here.
3035 */
2995 3036
2996 yyg->yy_buffer_stack = 0; 3037 yyg->yy_buffer_stack = 0;
2997 yyg->yy_buffer_stack_top = 0; 3038 yyg->yy_buffer_stack_top = 0;
2998 yyg->yy_buffer_stack_max = 0; 3039 yyg->yy_buffer_stack_max = 0;
2999 yyg->yy_c_buf_p = (char *) 0; 3040 yyg->yy_c_buf_p = (char *) 0;
3000 yyg->yy_init = 1; 3041 yyg->yy_init = 0;
3001 yyg->yy_start = 0; 3042 yyg->yy_start = 0;
3043
3002 yyg->yy_start_stack_ptr = 0; 3044 yyg->yy_start_stack_ptr = 0;
3003 yyg->yy_start_stack_depth = 0; 3045 yyg->yy_start_stack_depth = 0;
3004 yyg->yy_start_stack = (int *) 0; 3046 yyg->yy_start_stack = NULL;
3005 3047
3006/* Defined in main.c */ 3048/* Defined in main.c */
3007#ifdef YY_STDINIT 3049#ifdef YY_STDINIT
@@ -3018,33 +3060,6 @@ static int yy_init_globals (yyscan_t yyscanner)
3018 return 0; 3060 return 0;
3019} 3061}
3020 3062
3021/* User-visible API */
3022
3023/* yylex_init is special because it creates the scanner itself, so it is
3024 * the ONLY reentrant function that doesn't take the scanner as the last argument.
3025 * That's why we explicitly handle the declaration, instead of using our macros.
3026 */
3027
3028int yylex_init(yyscan_t* ptr_yy_globals)
3029
3030{
3031 if (ptr_yy_globals == NULL){
3032 errno = EINVAL;
3033 return 1;
3034 }
3035
3036 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
3037
3038 if (*ptr_yy_globals == NULL){
3039 errno = ENOMEM;
3040 return 1;
3041 }
3042
3043 memset(*ptr_yy_globals,0,sizeof(struct yyguts_t));
3044
3045 return yy_init_globals ( *ptr_yy_globals );
3046}
3047
3048/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 3063/* yylex_destroy is for both reentrant and non-reentrant scanners. */
3049int yylex_destroy (yyscan_t yyscanner) 3064int yylex_destroy (yyscan_t yyscanner)
3050{ 3065{
@@ -3065,8 +3080,13 @@ int yylex_destroy (yyscan_t yyscanner)
3065 yyfree(yyg->yy_start_stack ,yyscanner ); 3080 yyfree(yyg->yy_start_stack ,yyscanner );
3066 yyg->yy_start_stack = NULL; 3081 yyg->yy_start_stack = NULL;
3067 3082
3083 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3084 * yylex() is called, initialization will occur. */
3085 yy_init_globals( yyscanner);
3086
3068 /* Destroy the main struct (reentrant only). */ 3087 /* Destroy the main struct (reentrant only). */
3069 yyfree ( yyscanner , yyscanner ); 3088 yyfree ( yyscanner , yyscanner );
3089 yyscanner = NULL;
3070 return 0; 3090 return 0;
3071} 3091}
3072 3092
@@ -3078,7 +3098,6 @@ int yylex_destroy (yyscan_t yyscanner)
3078static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) 3098static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
3079{ 3099{
3080 register int i; 3100 register int i;
3081 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3082 for ( i = 0; i < n; ++i ) 3101 for ( i = 0; i < n; ++i )
3083 s1[i] = s2[i]; 3102 s1[i] = s2[i];
3084} 3103}
@@ -3088,7 +3107,6 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
3088static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) 3107static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
3089{ 3108{
3090 register int n; 3109 register int n;
3091 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3092 for ( n = 0; s[n]; ++n ) 3110 for ( n = 0; s[n]; ++n )
3093 ; 3111 ;
3094 3112
@@ -3120,18 +3138,6 @@ void yyfree (void * ptr , yyscan_t yyscanner)
3120 3138
3121#define YYTABLES_NAME "yytables" 3139#define YYTABLES_NAME "yytables"
3122 3140
3123#undef YY_NEW_FILE
3124#undef YY_FLUSH_BUFFER
3125#undef yy_set_bol
3126#undef yy_new_buffer
3127#undef yy_set_interactive
3128#undef yytext_ptr
3129#undef YY_DO_BEFORE_ACTION
3130
3131#ifdef YY_DECL_IS_OURS
3132#undef YY_DECL_IS_OURS
3133#undef YY_DECL
3134#endif
3135#line 254 "bitbakescanner.l" 3141#line 254 "bitbakescanner.l"
3136 3142
3137 3143
@@ -3148,47 +3154,49 @@ void lex_t::accept (int token, const char* sz)
3148 3154
3149void lex_t::input (char *buf, int *result, int max_size) 3155void lex_t::input (char *buf, int *result, int max_size)
3150{ 3156{
3151 printf("lex_t::input %p %d\n", buf, max_size); 3157 /* printf("lex_t::input %p %d\n", buf, max_size); */
3152 *result = fread(buf, 1, max_size, file); 3158 *result = fread(buf, 1, max_size, file);
3153 printf("lex_t::input result %d\n", *result); 3159 /* printf("lex_t::input result %d\n", *result); */
3154} 3160}
3155 3161
3156int lex_t::line ()const 3162int lex_t::line ()const
3157{ 3163{
3158 printf("lex_t::line\n"); 3164 /* printf("lex_t::line\n"); */
3159 return yyget_lineno (scanner); 3165 return yyget_lineno (scanner);
3160} 3166}
3161 3167
3162 3168
3163extern "C" { 3169extern "C" {
3164 3170
3165 void parse (FILE* file, PyObject* data) 3171 void parse (FILE* file, char* name, PyObject* data, int config)
3166 { 3172 {
3167 printf("parse bbparseAlloc\n"); 3173 /* printf("parse bbparseAlloc\n"); */
3168 void* parser = bbparseAlloc (malloc); 3174 void* parser = bbparseAlloc (malloc);
3169 yyscan_t scanner; 3175 yyscan_t scanner;
3170 lex_t lex; 3176 lex_t lex;
3171 3177
3172 printf("parse yylex_init\n"); 3178 /* printf("parse yylex_init\n"); */
3173 yylex_init (&scanner); 3179 yylex_init (&scanner);
3174 3180
3175 lex.parser = parser; 3181 lex.parser = parser;
3176 lex.scanner = scanner; 3182 lex.scanner = scanner;
3177 lex.file = file; 3183 lex.file = file;
3184 lex.name = name;
3178 lex.data = data; 3185 lex.data = data;
3186 lex.config = config;
3179 lex.parse = bbparse; 3187 lex.parse = bbparse;
3180 printf("parse yyset_extra\n"); 3188 /*printf("parse yyset_extra\n"); */
3181 yyset_extra (&lex, scanner); 3189 yyset_extra (&lex, scanner);
3182 3190
3183 printf("parse yylex\n"); 3191 /* printf("parse yylex\n"); */
3184 int result = yylex (scanner); 3192 int result = yylex (scanner);
3185 3193
3186 printf("parse result %d\n", result); 3194 /* printf("parse result %d\n", result); */
3187 3195
3188 lex.accept (0); 3196 lex.accept (0);
3189 printf("parse lex.accept\n"); 3197 /* printf("parse lex.accept\n"); */
3190 bbparseTrace (NULL, NULL); 3198 bbparseTrace (NULL, NULL);
3191 printf("parse bbparseTrace\n"); 3199 /* printf("parse bbparseTrace\n"); */
3192 3200
3193 if (result != T_EOF) 3201 if (result != T_EOF)
3194 printf ("premature end of file\n"); 3202 printf ("premature end of file\n");