summaryrefslogtreecommitdiff
path: root/src/glsl
diff options
context:
space:
mode:
Diffstat (limited to 'src/glsl')
-rw-r--r--src/glsl/glcpp/glcpp-lex.c400
-rw-r--r--src/glsl/glcpp/glcpp-lex.l10
-rw-r--r--src/glsl/glcpp/glcpp-parse.c968
-rw-r--r--src/glsl/glcpp/glcpp-parse.h37
-rw-r--r--src/glsl/glcpp/glcpp-parse.y73
5 files changed, 774 insertions, 714 deletions
diff --git a/src/glsl/glcpp/glcpp-lex.c b/src/glsl/glcpp/glcpp-lex.c
index edf98a4afd..40db2c27c5 100644
--- a/src/glsl/glcpp/glcpp-lex.c
+++ b/src/glsl/glcpp/glcpp-lex.c
@@ -358,8 +358,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 40
-#define YY_END_OF_BUFFER 41
+#define YY_NUM_RULES 41
+#define YY_END_OF_BUFFER 42
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -367,26 +367,26 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_acclist[132] =
+static yyconst flex_int16_t yy_acclist[133] =
{ 0,
- 3, 3, 41, 36, 40, 37, 40, 38, 40, 40,
- 35, 40, 40, 35, 40, 35, 40, 35, 40, 22,
- 36, 40, 21, 36, 40, 35, 40, 35, 40, 35,
- 40, 34, 36, 40, 34, 36, 40, 35, 40, 37,
- 40, 20, 40, 40, 3, 40, 4, 40, 5, 40,
- 39, 40, 36, 15, 37, 29, 32, 30, 2, 22,
- 36, 22, 36, 36, 21, 36, 21, 36, 24, 26,
- 28, 27, 25, 34, 36, 34, 36, 31, 37, 20,
- 20, 3, 4, 5, 6, 5, 7, 1, 15, 23,
- 36, 34, 36,16395, 23, 36, 34, 36, 15, 34,
-
- 36,16396,16397, 8203, 15, 8203, 34, 36, 8204, 15,
- 8205, 15,16398, 16,16393, 19, 33, 34, 36, 18,
- 8206, 15, 16, 8201, 15,16394,16401, 8202, 15, 8,
- 8209
+ 3, 3, 42, 37, 41, 38, 41, 39, 41, 41,
+ 36, 41, 41, 36, 41, 36, 41, 36, 41, 23,
+ 37, 41, 22, 37, 41, 36, 41, 36, 41, 36,
+ 41, 35, 37, 41, 35, 37, 41, 36, 41, 38,
+ 41, 21, 41, 41, 3, 41, 4, 41, 5, 41,
+ 40, 41, 37, 16, 38, 30, 33, 31, 2, 23,
+ 37, 23, 37, 37, 22, 37, 22, 37, 25, 27,
+ 29, 28, 26, 35, 37, 35, 37, 32, 38, 21,
+ 21, 3, 4, 5, 6, 5, 7, 1, 16, 24,
+ 37, 35, 37,16396, 24, 37, 35, 37, 16, 35,
+
+ 37,16397,16398, 8204, 16, 8204, 35, 37, 8205, 16,
+ 8206, 16,16399, 17,16394, 20, 34, 35, 37, 19,
+ 8207, 16, 17, 8202, 16,16395,16402, 8203, 16, 9,
+ 8, 8210
} ;
-static yyconst flex_int16_t yy_accept[151] =
+static yyconst flex_int16_t yy_accept[152] =
{ 0,
1, 1, 1, 1, 1, 2, 3, 3, 3, 4,
6, 8, 10, 11, 13, 14, 16, 18, 20, 23,
@@ -403,7 +403,8 @@ static yyconst flex_int16_t yy_accept[151] =
107, 107, 107, 107, 107, 109, 109, 109, 111, 111,
113, 114, 115, 115, 116, 116, 116, 117, 117, 120,
121, 121, 123, 124, 124, 124, 126, 127, 127, 127,
- 128, 128, 128, 130, 131, 131, 131, 132, 132, 132
+ 128, 128, 128, 130, 131, 132, 132, 132, 133, 133,
+ 133
} ;
static yyconst flex_int32_t yy_ec[256] =
@@ -446,48 +447,48 @@ static yyconst flex_int32_t yy_meta[40] =
1, 1, 1, 1, 1, 1, 1, 1, 1
} ;
-static yyconst flex_int16_t yy_base[169] =
+static yyconst flex_int16_t yy_base[170] =
{ 0,
- 0, 38, 0, 0, 38, 39, 426, 425, 427, 48,
- 43, 549, 423, 44, 63, 422, 59, 65, 87, 125,
- 58, 67, 68, 164, 203, 40, 75, 241, 549, 421,
- 549, 140, 549, 140, 420, 549, 144, 419, 418, 417,
- 415, 414, 156, 179, 267, 0, 209, 413, 412, 411,
- 410, 409, 387, 124, 407, 153, 403, 402, 154, 198,
- 159, 155, 160, 192, 404, 549, 186, 549, 214, 549,
- 359, 549, 162, 159, 227, 229, 230, 234, 199, 303,
+ 0, 38, 0, 0, 38, 39, 427, 426, 428, 48,
+ 43, 549, 424, 44, 63, 423, 59, 65, 87, 125,
+ 58, 67, 68, 164, 203, 40, 75, 241, 549, 422,
+ 549, 140, 549, 140, 421, 549, 144, 420, 419, 418,
+ 417, 415, 156, 179, 267, 0, 209, 414, 413, 412,
+ 411, 410, 388, 124, 408, 153, 404, 403, 154, 198,
+ 159, 155, 160, 192, 405, 549, 186, 549, 214, 549,
+ 404, 549, 162, 159, 227, 229, 230, 234, 199, 303,
232, 235, 236, 262, 56, 243, 237, 247, 245, 252,
- 291, 358, 357, 292, 238, 296, 293, 254, 335, 256,
-
- 355, 354, 298, 294, 263, 352, 549, 350, 549, 299,
- 297, 322, 325, 257, 306, 328, 346, 549, 345, 549,
- 344, 343, 329, 342, 331, 332, 341, 333, 319, 335,
- 337, 549, 248, 338, 246, 549, 197, 184, 336, 366,
- 403, 182, 549, 141, 434, 416, 79, 473, 549, 512,
- 514, 516, 518, 520, 522, 71, 524, 526, 528, 530,
- 532, 534, 536, 538, 540, 542, 544, 546
+ 291, 359, 358, 292, 238, 296, 293, 254, 336, 256,
+
+ 356, 355, 298, 294, 263, 354, 549, 352, 549, 299,
+ 297, 322, 325, 257, 306, 328, 350, 549, 346, 549,
+ 345, 344, 329, 343, 331, 332, 342, 333, 320, 335,
+ 340, 549, 337, 338, 248, 549, 246, 197, 336, 366,
+ 403, 184, 549, 182, 141, 434, 416, 79, 473, 549,
+ 512, 514, 516, 518, 520, 522, 71, 524, 526, 528,
+ 530, 532, 534, 536, 538, 540, 542, 544, 546
} ;
-static yyconst flex_int16_t yy_def[169] =
+static yyconst flex_int16_t yy_def[170] =
{ 0,
- 149, 1, 150, 150, 151, 151, 152, 152, 149, 153,
- 154, 149, 154, 154, 154, 154, 154, 154, 149, 153,
- 154, 154, 154, 155, 155, 154, 154, 154, 149, 156,
- 149, 157, 149, 20, 154, 149, 154, 154, 154, 154,
- 154, 158, 19, 20, 20, 20, 20, 154, 154, 154,
- 154, 154, 25, 25, 154, 154, 28, 28, 154, 154,
- 154, 154, 154, 154, 156, 149, 157, 149, 157, 149,
- 158, 149, 45, 25, 154, 154, 154, 154, 154, 154,
- 154, 154, 154, 20, 25, 154, 154, 154, 154, 154,
- 154, 159, 160, 154, 154, 154, 154, 154, 25, 154,
-
- 161, 162, 154, 154, 154, 159, 149, 160, 149, 154,
- 154, 154, 154, 154, 25, 154, 161, 149, 162, 149,
- 163, 164, 154, 165, 154, 154, 154, 154, 25, 154,
- 163, 149, 164, 154, 165, 149, 166, 167, 154, 149,
- 154, 166, 149, 167, 168, 154, 154, 168, 0, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149
+ 150, 1, 151, 151, 152, 152, 153, 153, 150, 154,
+ 155, 150, 155, 155, 155, 155, 155, 155, 150, 154,
+ 155, 155, 155, 156, 156, 155, 155, 155, 150, 157,
+ 150, 158, 150, 20, 155, 150, 155, 155, 155, 155,
+ 155, 159, 19, 20, 20, 20, 20, 155, 155, 155,
+ 155, 155, 25, 25, 155, 155, 28, 28, 155, 155,
+ 155, 155, 155, 155, 157, 150, 158, 150, 158, 150,
+ 159, 150, 45, 25, 155, 155, 155, 155, 155, 155,
+ 155, 155, 155, 20, 25, 155, 155, 155, 155, 155,
+ 155, 160, 161, 155, 155, 155, 155, 155, 25, 155,
+
+ 162, 163, 155, 155, 155, 160, 150, 161, 150, 155,
+ 155, 155, 155, 155, 25, 155, 162, 150, 163, 150,
+ 164, 165, 155, 166, 155, 155, 155, 155, 25, 155,
+ 164, 150, 165, 155, 166, 150, 167, 168, 155, 150,
+ 155, 167, 150, 168, 155, 169, 155, 155, 169, 0,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150
} ;
static yyconst flex_int16_t yy_nxt[589] =
@@ -511,15 +512,15 @@ static yyconst flex_int16_t yy_nxt[589] =
70, 34, 34, 34, 56, 36, 36, 36, 57, 34,
47, 36, 36, 35, 34, 35, 36, 35, 35, 35,
35, 35, 35, 35, 35, 34, 34, 75, 35, 35,
- 35, 84, 53, 80, 143, 85, 36, 81, 68, 82,
- 34, 34, 34, 34, 36, 149, 149, 84, 34, 143,
+ 35, 84, 53, 80, 36, 85, 143, 81, 68, 82,
+ 34, 34, 34, 34, 36, 150, 150, 84, 34, 36,
36, 36, 35, 34, 35, 36, 35, 35, 35, 35,
35, 35, 35, 35, 34, 83, 68, 35, 35, 35,
34, 34, 34, 69, 70, 76, 54, 77, 34, 36,
78, 36, 36, 91, 36, 79, 36, 36, 36, 36,
- 36, 35, 58, 36, 34, 36, 39, 36, 136, 36,
- 36, 86, 89, 96, 36, 87, 36, 97, 36, 36,
+ 36, 35, 58, 36, 34, 36, 39, 36, 143, 36,
+ 136, 86, 89, 96, 36, 87, 36, 97, 36, 36,
111, 101, 88, 59, 60, 36, 90, 61, 98, 100,
102, 103, 62, 34, 34, 34, 63, 64, 73, 73,
73, 34, 104, 128, 73, 116, 34, 114, 73, 73,
@@ -528,34 +529,34 @@ static yyconst flex_int16_t yy_nxt[589] =
36, 36, 34, 92, 92, 93, 92, 92, 92, 92,
92, 92, 92, 92, 105, 110, 113, 92, 92, 92,
125, 112, 121, 124, 36, 94, 122, 36, 129, 53,
- 36, 36, 95, 36, 36, 36, 140, 36, 36, 132,
- 36, 92, 53, 36, 136, 36, 132, 120, 118, 127,
- 126, 130, 109, 138, 107, 137, 120, 118, 115, 109,
- 107, 72, 134, 139, 141, 138, 35, 140, 36, 35,
+ 36, 36, 95, 36, 36, 36, 140, 36, 36, 36,
+ 36, 92, 132, 53, 36, 136, 36, 132, 120, 127,
+ 126, 130, 118, 138, 109, 137, 107, 120, 118, 115,
+ 109, 107, 134, 139, 141, 145, 35, 140, 36, 35,
35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
- 35, 35, 35, 145, 145, 145, 145, 145, 145, 145,
- 145, 145, 145, 145, 145, 145, 145, 145, 145, 145,
-
- 145, 145, 145, 145, 35, 36, 66, 35, 35, 36,
- 53, 36, 36, 36, 36, 36, 72, 36, 36, 36,
- 36, 36, 36, 66, 36, 36, 149, 29, 29, 149,
- 149, 149, 149, 146, 35, 35, 36, 35, 35, 35,
- 35, 35, 147, 35, 35, 138, 149, 149, 35, 35,
- 35, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 35, 35, 35, 36, 35, 35, 35, 35,
- 35, 147, 35, 35, 149, 149, 149, 35, 35, 35,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
-
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 35, 29, 29, 30, 30, 33, 33, 34, 34,
+ 35, 35, 35, 146, 146, 146, 146, 146, 146, 146,
+ 146, 146, 146, 146, 146, 146, 146, 146, 146, 146,
+
+ 146, 146, 146, 146, 35, 36, 72, 66, 35, 35,
+ 36, 53, 36, 36, 36, 36, 36, 72, 36, 36,
+ 36, 36, 36, 36, 66, 36, 36, 150, 29, 29,
+ 150, 150, 150, 147, 35, 35, 36, 35, 35, 35,
+ 35, 35, 148, 35, 35, 138, 150, 150, 35, 35,
+ 35, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 35, 35, 35, 36, 35, 35, 35, 35,
+ 35, 148, 35, 35, 150, 150, 150, 35, 35, 35,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 35, 29, 29, 30, 30, 33, 33, 34, 34,
35, 35, 53, 53, 67, 67, 71, 71, 106, 106,
108, 108, 117, 117, 119, 119, 131, 131, 133, 133,
- 135, 135, 142, 142, 144, 144, 148, 148, 9, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149
+ 135, 135, 142, 142, 144, 144, 149, 149, 9, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150
} ;
static yyconst flex_int16_t yy_chk[589] =
@@ -567,27 +568,27 @@ static yyconst flex_int16_t yy_chk[589] =
5, 6, 26, 2, 11, 11, 14, 5, 6, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 14,
21, 17, 10, 10, 10, 15, 17, 18, 15, 22,
- 23, 156, 21, 21, 18, 18, 27, 27, 26, 85,
- 27, 147, 22, 23, 23, 85, 10, 19, 19, 19,
+ 23, 157, 21, 21, 18, 18, 27, 27, 26, 85,
+ 27, 148, 22, 23, 23, 85, 10, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
19, 19, 19, 19, 19, 19, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
- 20, 20, 32, 144, 20, 37, 37, 54, 54, 32,
+ 20, 20, 32, 145, 20, 37, 37, 54, 54, 32,
32, 34, 34, 34, 56, 56, 59, 62, 56, 34,
20, 61, 63, 20, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 34, 43, 59, 24, 24,
- 24, 73, 74, 61, 142, 74, 138, 62, 67, 63,
- 44, 44, 44, 43, 64, 67, 67, 73, 44, 137,
+ 24, 73, 74, 61, 144, 74, 142, 62, 67, 63,
+ 44, 44, 44, 43, 64, 67, 67, 73, 44, 138,
60, 79, 24, 25, 25, 25, 25, 25, 25, 25,
25, 25, 25, 25, 44, 64, 69, 25, 25, 25,
47, 47, 47, 69, 69, 60, 25, 60, 47, 75,
60, 76, 77, 79, 81, 60, 78, 82, 83, 87,
- 95, 25, 28, 28, 47, 86, 28, 89, 135, 88,
- 133, 75, 77, 81, 90, 76, 98, 82, 100, 114,
+ 95, 25, 28, 28, 47, 86, 28, 89, 137, 88,
+ 135, 75, 77, 81, 90, 76, 98, 82, 100, 114,
95, 87, 76, 28, 28, 105, 78, 28, 83, 86,
88, 89, 28, 84, 84, 84, 28, 28, 45, 45,
45, 84, 90, 114, 45, 100, 45, 98, 45, 45,
@@ -596,34 +597,34 @@ static yyconst flex_int16_t yy_chk[589] =
103, 110, 45, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 91, 94, 97, 80, 80, 80,
111, 96, 103, 110, 112, 80, 104, 113, 115, 115,
- 116, 123, 80, 125, 126, 128, 130, 130, 139, 131,
- 134, 80, 129, 127, 124, 122, 121, 119, 117, 113,
- 112, 116, 108, 126, 106, 125, 102, 101, 99, 93,
- 92, 71, 123, 128, 134, 139, 140, 140, 140, 140,
+ 116, 123, 80, 125, 126, 128, 130, 130, 139, 133,
+ 134, 80, 131, 129, 127, 124, 122, 121, 119, 113,
+ 112, 116, 117, 126, 108, 125, 106, 102, 101, 99,
+ 93, 92, 123, 128, 134, 139, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
- 140, 140, 140, 140, 140, 141, 65, 58, 57, 55,
- 53, 52, 51, 50, 49, 48, 42, 41, 146, 40,
- 39, 38, 35, 30, 16, 13, 9, 8, 7, 0,
- 0, 0, 0, 141, 145, 145, 145, 145, 145, 145,
- 145, 145, 145, 145, 145, 146, 0, 0, 145, 145,
- 145, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 140, 140, 140, 140, 140, 141, 71, 65, 58, 57,
+ 55, 53, 52, 51, 50, 49, 48, 42, 147, 41,
+ 40, 39, 38, 35, 30, 16, 13, 9, 8, 7,
+ 0, 0, 0, 141, 146, 146, 146, 146, 146, 146,
+ 146, 146, 146, 146, 146, 147, 0, 0, 146, 146,
+ 146, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 145, 148, 148, 148, 148, 148, 148, 148,
- 148, 148, 148, 148, 0, 0, 0, 148, 148, 148,
+ 0, 0, 146, 149, 149, 149, 149, 149, 149, 149,
+ 149, 149, 149, 149, 0, 0, 0, 149, 149, 149,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 148, 150, 150, 151, 151, 152, 152, 153, 153,
- 154, 154, 155, 155, 157, 157, 158, 158, 159, 159,
- 160, 160, 161, 161, 162, 162, 163, 163, 164, 164,
- 165, 165, 166, 166, 167, 167, 168, 168, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149, 149, 149,
- 149, 149, 149, 149, 149, 149, 149, 149
+ 0, 149, 151, 151, 152, 152, 153, 153, 154, 154,
+ 155, 155, 156, 156, 158, 158, 159, 159, 160, 160,
+ 161, 161, 162, 162, 163, 163, 164, 164, 165, 165,
+ 166, 166, 167, 167, 168, 168, 169, 169, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
+ 150, 150, 150, 150, 150, 150, 150, 150
} ;
#define YY_TRAILING_MASK 0x2000
@@ -690,7 +691,7 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner);
} while(0);
#define YY_USER_INIT yylineno = 0; yycolumn = 0;
-#line 694 "glcpp/glcpp-lex.c"
+#line 695 "glcpp/glcpp-lex.c"
#define INITIAL 0
#define DONE 1
@@ -961,7 +962,7 @@ YY_DECL
/* Single-line comments */
-#line 965 "glcpp/glcpp-lex.c"
+#line 966 "glcpp/glcpp-lex.c"
yylval = yylval_param;
@@ -1024,7 +1025,7 @@ yy_match:
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 150 )
+ if ( yy_current_state >= 151 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1128,71 +1129,82 @@ YY_RULE_SETUP
return SPACE;
}
YY_BREAK
-/* glcpp doesn't handle #extension, #version, or #pragma directives.
- * Simply pass them through to the main compiler's lexer/parser. */
case 8:
YY_RULE_SETUP
-#line 92 "glcpp/glcpp-lex.l"
+#line 90 "glcpp/glcpp-lex.l"
{
yylval->str = xtalloc_strdup (yyextra, yytext);
yylineno++;
yycolumn = 0;
- return OTHER;
+ yyextra->space_tokens = 0;
+ return HASH_VERSION;
}
YY_BREAK
+/* glcpp doesn't handle #extension, #version, or #pragma directives.
+ * Simply pass them through to the main compiler's lexer/parser. */
case 9:
-/* rule 9 can match eol */
YY_RULE_SETUP
-#line 99 "glcpp/glcpp-lex.l"
+#line 100 "glcpp/glcpp-lex.l"
{
- yyextra->lexing_if = 1;
- yyextra->space_tokens = 0;
- return HASH_IFDEF;
+ yylval->str = xtalloc_strdup (yyextra, yytext);
+ yylineno++;
+ yycolumn = 0;
+ return OTHER;
}
YY_BREAK
case 10:
/* rule 10 can match eol */
YY_RULE_SETUP
-#line 105 "glcpp/glcpp-lex.l"
+#line 107 "glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
- return HASH_IFNDEF;
+ return HASH_IFDEF;
}
YY_BREAK
case 11:
/* rule 11 can match eol */
YY_RULE_SETUP
-#line 111 "glcpp/glcpp-lex.l"
+#line 113 "glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
- return HASH_IF;
+ return HASH_IFNDEF;
}
YY_BREAK
case 12:
/* rule 12 can match eol */
YY_RULE_SETUP
-#line 117 "glcpp/glcpp-lex.l"
+#line 119 "glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
- return HASH_ELIF;
+ return HASH_IF;
}
YY_BREAK
case 13:
/* rule 13 can match eol */
YY_RULE_SETUP
-#line 123 "glcpp/glcpp-lex.l"
+#line 125 "glcpp/glcpp-lex.l"
{
+ yyextra->lexing_if = 1;
yyextra->space_tokens = 0;
- return HASH_ELSE;
+ return HASH_ELIF;
}
YY_BREAK
case 14:
/* rule 14 can match eol */
YY_RULE_SETUP
-#line 128 "glcpp/glcpp-lex.l"
+#line 131 "glcpp/glcpp-lex.l"
+{
+ yyextra->space_tokens = 0;
+ return HASH_ELSE;
+}
+ YY_BREAK
+case 15:
+/* rule 15 can match eol */
+YY_RULE_SETUP
+#line 136 "glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_ENDIF;
@@ -1206,13 +1218,13 @@ YY_RULE_SETUP
*
* We use the lexing_if flag to avoid skipping any part of an
* if conditional expression. */
-case 15:
-/* rule 15 can match eol */
+case 16:
+/* rule 16 can match eol */
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
yyg->yy_c_buf_p = yy_cp -= 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
-#line 141 "glcpp/glcpp-lex.l"
+#line 149 "glcpp/glcpp-lex.l"
{
/* Since this rule always matches, YY_USER_ACTION gets called for it,
* wrongly incrementing yycolumn. We undo that effect here. */
@@ -1225,9 +1237,9 @@ YY_RULE_SETUP
}
}
YY_BREAK
-case 16:
+case 17:
YY_RULE_SETUP
-#line 153 "glcpp/glcpp-lex.l"
+#line 161 "glcpp/glcpp-lex.l"
{
char *p;
for (p = yytext; !isalpha(p[0]); p++); /* skip " # " */
@@ -1235,168 +1247,168 @@ YY_RULE_SETUP
glcpp_error(yylloc, yyextra, "#error%s", p);
}
YY_BREAK
-case 17:
+case 18:
YY_RULE_SETUP
-#line 160 "glcpp/glcpp-lex.l"
+#line 168 "glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_DEFINE_FUNC;
}
YY_BREAK
-case 18:
+case 19:
YY_RULE_SETUP
-#line 165 "glcpp/glcpp-lex.l"
+#line 173 "glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_DEFINE_OBJ;
}
YY_BREAK
-case 19:
+case 20:
YY_RULE_SETUP
-#line 170 "glcpp/glcpp-lex.l"
+#line 178 "glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH_UNDEF;
}
YY_BREAK
-case 20:
+case 21:
YY_RULE_SETUP
-#line 175 "glcpp/glcpp-lex.l"
+#line 183 "glcpp/glcpp-lex.l"
{
yyextra->space_tokens = 0;
return HASH;
}
YY_BREAK
-case 21:
+case 22:
YY_RULE_SETUP
-#line 180 "glcpp/glcpp-lex.l"
+#line 188 "glcpp/glcpp-lex.l"
{
yylval->str = xtalloc_strdup (yyextra, yytext);
return INTEGER_STRING;
}
YY_BREAK
-case 22:
+case 23:
YY_RULE_SETUP
-#line 185 "glcpp/glcpp-lex.l"
+#line 193 "glcpp/glcpp-lex.l"
{
yylval->str = xtalloc_strdup (yyextra, yytext);
return INTEGER_STRING;
}
YY_BREAK
-case 23:
+case 24:
YY_RULE_SETUP
-#line 190 "glcpp/glcpp-lex.l"
+#line 198 "glcpp/glcpp-lex.l"
{
yylval->str = xtalloc_strdup (yyextra, yytext);
return INTEGER_STRING;
}
YY_BREAK
-case 24:
+case 25:
YY_RULE_SETUP
-#line 195 "glcpp/glcpp-lex.l"
+#line 203 "glcpp/glcpp-lex.l"
{
return LEFT_SHIFT;
}
YY_BREAK
-case 25:
+case 26:
YY_RULE_SETUP
-#line 199 "glcpp/glcpp-lex.l"
+#line 207 "glcpp/glcpp-lex.l"
{
return RIGHT_SHIFT;
}
YY_BREAK
-case 26:
+case 27:
YY_RULE_SETUP
-#line 203 "glcpp/glcpp-lex.l"
+#line 211 "glcpp/glcpp-lex.l"
{
return LESS_OR_EQUAL;
}
YY_BREAK
-case 27:
+case 28:
YY_RULE_SETUP
-#line 207 "glcpp/glcpp-lex.l"
+#line 215 "glcpp/glcpp-lex.l"
{
return GREATER_OR_EQUAL;
}
YY_BREAK
-case 28:
+case 29:
YY_RULE_SETUP
-#line 211 "glcpp/glcpp-lex.l"
+#line 219 "glcpp/glcpp-lex.l"
{
return EQUAL;
}
YY_BREAK
-case 29:
+case 30:
YY_RULE_SETUP
-#line 215 "glcpp/glcpp-lex.l"
+#line 223 "glcpp/glcpp-lex.l"
{
return NOT_EQUAL;
}
YY_BREAK
-case 30:
+case 31:
YY_RULE_SETUP
-#line 219 "glcpp/glcpp-lex.l"
+#line 227 "glcpp/glcpp-lex.l"
{
return AND;
}
YY_BREAK
-case 31:
+case 32:
YY_RULE_SETUP
-#line 223 "glcpp/glcpp-lex.l"
+#line 231 "glcpp/glcpp-lex.l"
{
return OR;
}
YY_BREAK
-case 32:
+case 33:
YY_RULE_SETUP
-#line 227 "glcpp/glcpp-lex.l"
+#line 235 "glcpp/glcpp-lex.l"
{
return PASTE;
}
YY_BREAK
-case 33:
+case 34:
YY_RULE_SETUP
-#line 231 "glcpp/glcpp-lex.l"
+#line 239 "glcpp/glcpp-lex.l"
{
return DEFINED;
}
YY_BREAK
-case 34:
+case 35:
YY_RULE_SETUP
-#line 235 "glcpp/glcpp-lex.l"
+#line 243 "glcpp/glcpp-lex.l"
{
yylval->str = xtalloc_strdup (yyextra, yytext);
return IDENTIFIER;
}
YY_BREAK
-case 35:
+case 36:
YY_RULE_SETUP
-#line 240 "glcpp/glcpp-lex.l"
+#line 248 "glcpp/glcpp-lex.l"
{
return yytext[0];
}
YY_BREAK
-case 36:
+case 37:
YY_RULE_SETUP
-#line 244 "glcpp/glcpp-lex.l"
+#line 252 "glcpp/glcpp-lex.l"
{
yylval->str = xtalloc_strdup (yyextra, yytext);
return OTHER;
}
YY_BREAK
-case 37:
+case 38:
YY_RULE_SETUP
-#line 249 "glcpp/glcpp-lex.l"
+#line 257 "glcpp/glcpp-lex.l"
{
if (yyextra->space_tokens) {
return SPACE;
}
}
YY_BREAK
-case 38:
-/* rule 38 can match eol */
+case 39:
+/* rule 39 can match eol */
YY_RULE_SETUP
-#line 255 "glcpp/glcpp-lex.l"
+#line 263 "glcpp/glcpp-lex.l"
{
yyextra->lexing_if = 0;
yylineno++;
@@ -1406,7 +1418,7 @@ YY_RULE_SETUP
YY_BREAK
/* Handle missing newline at EOF. */
case YY_STATE_EOF(INITIAL):
-#line 263 "glcpp/glcpp-lex.l"
+#line 271 "glcpp/glcpp-lex.l"
{
BEGIN DONE; /* Don't keep matching this rule forever. */
yyextra->lexing_if = 0;
@@ -1417,20 +1429,20 @@ case YY_STATE_EOF(INITIAL):
only have this action here so that we can pretend to call some
generated functions, (to avoid "defined but not used"
warnings. */
-case 39:
+case 40:
YY_RULE_SETUP
-#line 273 "glcpp/glcpp-lex.l"
+#line 281 "glcpp/glcpp-lex.l"
{
unput('.');
yy_top_state(yyextra);
}
YY_BREAK
-case 40:
+case 41:
YY_RULE_SETUP
-#line 278 "glcpp/glcpp-lex.l"
+#line 286 "glcpp/glcpp-lex.l"
ECHO;
YY_BREAK
-#line 1434 "glcpp/glcpp-lex.c"
+#line 1446 "glcpp/glcpp-lex.c"
case YY_STATE_EOF(DONE):
case YY_STATE_EOF(COMMENT):
case YY_STATE_EOF(UNREACHABLE):
@@ -1696,7 +1708,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 150 )
+ if ( yy_current_state >= 151 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1720,11 +1732,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 150 )
+ if ( yy_current_state >= 151 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 149);
+ yy_is_jam = (yy_current_state == 150);
if ( ! yy_is_jam )
*yyg->yy_state_ptr++ = yy_current_state;
@@ -2624,7 +2636,7 @@ void glcpp_free (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 278 "glcpp/glcpp-lex.l"
+#line 286 "glcpp/glcpp-lex.l"
diff --git a/src/glsl/glcpp/glcpp-lex.l b/src/glsl/glcpp/glcpp-lex.l
index a4c891bdc6..17a097e633 100644
--- a/src/glsl/glcpp/glcpp-lex.l
+++ b/src/glsl/glcpp/glcpp-lex.l
@@ -87,9 +87,17 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
return SPACE;
}
+{HASH}(version) {
+ yylval->str = xtalloc_strdup (yyextra, yytext);
+ yylineno++;
+ yycolumn = 0;
+ yyextra->space_tokens = 0;
+ return HASH_VERSION;
+}
+
/* glcpp doesn't handle #extension, #version, or #pragma directives.
* Simply pass them through to the main compiler's lexer/parser. */
-{HASH}(extension|version|pragma)[^\n]+ {
+{HASH}(extension|pragma)[^\n]+ {
yylval->str = xtalloc_strdup (yyextra, yytext);
yylineno++;
yycolumn = 0;
diff --git a/src/glsl/glcpp/glcpp-parse.c b/src/glsl/glcpp/glcpp-parse.c
index bfbd97f3d8..f0ad4a08ec 100644
--- a/src/glsl/glcpp/glcpp-parse.c
+++ b/src/glsl/glcpp/glcpp-parse.c
@@ -203,10 +203,13 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser);
static void
glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list);
+static void
+add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
+
/* Line 189 of yacc.c */
-#line 210 "glcpp/glcpp-parse.c"
+#line 213 "glcpp/glcpp-parse.c"
/* Enabling traces. */
#ifndef YYDEBUG
@@ -246,24 +249,25 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list);
HASH_IFDEF = 268,
HASH_IFNDEF = 269,
HASH_UNDEF = 270,
- IDENTIFIER = 271,
- IF_EXPANDED = 272,
- INTEGER = 273,
- INTEGER_STRING = 274,
- NEWLINE = 275,
- OTHER = 276,
- PLACEHOLDER = 277,
- SPACE = 278,
- PASTE = 279,
- OR = 280,
- AND = 281,
- NOT_EQUAL = 282,
- EQUAL = 283,
- GREATER_OR_EQUAL = 284,
- LESS_OR_EQUAL = 285,
- RIGHT_SHIFT = 286,
- LEFT_SHIFT = 287,
- UNARY = 288
+ HASH_VERSION = 271,
+ IDENTIFIER = 272,
+ IF_EXPANDED = 273,
+ INTEGER = 274,
+ INTEGER_STRING = 275,
+ NEWLINE = 276,
+ OTHER = 277,
+ PLACEHOLDER = 278,
+ SPACE = 279,
+ PASTE = 280,
+ OR = 281,
+ AND = 282,
+ NOT_EQUAL = 283,
+ EQUAL = 284,
+ GREATER_OR_EQUAL = 285,
+ LESS_OR_EQUAL = 286,
+ RIGHT_SHIFT = 287,
+ LEFT_SHIFT = 288,
+ UNARY = 289
};
#endif
@@ -293,7 +297,7 @@ typedef struct YYLTYPE
/* Line 264 of yacc.c */
-#line 297 "glcpp/glcpp-parse.c"
+#line 301 "glcpp/glcpp-parse.c"
#ifdef short
# undef short
@@ -510,20 +514,20 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 673
+#define YYLAST 604
/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 56
+#define YYNTOKENS 57
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 16
+#define YYNNTS 17
/* YYNRULES -- Number of rules. */
-#define YYNRULES 98
+#define YYNRULES 100
/* YYNRULES -- Number of states. */
-#define YYNSTATES 157
+#define YYNSTATES 161
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
-#define YYMAXUTOK 288
+#define YYMAXUTOK 289
#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
@@ -534,16 +538,16 @@ static const yytype_uint8 yytranslate[] =
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 46, 2, 2, 2, 42, 29, 2,
- 44, 45, 40, 38, 48, 39, 53, 41, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 54,
- 32, 55, 33, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 47, 2, 2, 2, 43, 30, 2,
+ 45, 46, 41, 39, 49, 40, 54, 42, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 55,
+ 33, 56, 34, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 49, 2, 50, 28, 2, 2, 2, 2, 2,
+ 2, 50, 2, 51, 29, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 51, 27, 52, 47, 2, 2, 2,
+ 2, 2, 2, 52, 28, 53, 48, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -559,7 +563,7 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 30, 31, 34, 35, 36, 37, 43
+ 25, 26, 27, 31, 32, 35, 36, 37, 38, 44
};
#if YYDEBUG
@@ -569,63 +573,65 @@ static const yytype_uint16 yyprhs[] =
{
0, 0, 3, 4, 7, 9, 11, 13, 16, 20,
24, 29, 36, 44, 48, 52, 57, 62, 66, 69,
- 72, 75, 78, 80, 82, 86, 90, 94, 98, 102,
- 106, 110, 114, 118, 122, 126, 130, 134, 138, 142,
- 146, 150, 154, 157, 160, 163, 166, 170, 172, 176,
- 178, 181, 184, 185, 187, 188, 190, 193, 198, 200,
- 202, 205, 207, 210, 212, 214, 216, 218, 220, 222,
- 224, 226, 228, 230, 232, 234, 236, 238, 240, 242,
- 244, 246, 248, 250, 252, 254, 256, 258, 260, 262,
- 264, 266, 268, 270, 272, 274, 276, 278, 280
+ 72, 75, 79, 82, 84, 86, 88, 92, 96, 100,
+ 104, 108, 112, 116, 120, 124, 128, 132, 136, 140,
+ 144, 148, 152, 156, 160, 163, 166, 169, 172, 176,
+ 178, 182, 184, 187, 190, 191, 193, 194, 196, 199,
+ 204, 206, 208, 211, 213, 216, 218, 220, 222, 224,
+ 226, 228, 230, 232, 234, 236, 238, 240, 242, 244,
+ 246, 248, 250, 252, 254, 256, 258, 260, 262, 264,
+ 266, 268, 270, 272, 274, 276, 278, 280, 282, 284,
+ 286
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
static const yytype_int8 yyrhs[] =
{
- 57, 0, -1, -1, 57, 58, -1, 60, -1, 63,
- -1, 59, -1, 6, 64, -1, 17, 61, 20, -1,
- 5, 61, 20, -1, 8, 16, 65, 20, -1, 7,
- 16, 44, 45, 65, 20, -1, 7, 16, 44, 62,
- 45, 65, 20, -1, 15, 16, 20, -1, 12, 68,
- 20, -1, 13, 16, 66, 20, -1, 14, 16, 66,
- 20, -1, 9, 68, 20, -1, 9, 20, -1, 10,
- 20, -1, 11, 20, -1, 6, 20, -1, 19, -1,
- 18, -1, 61, 25, 61, -1, 61, 26, 61, -1,
- 61, 27, 61, -1, 61, 28, 61, -1, 61, 29,
- 61, -1, 61, 30, 61, -1, 61, 31, 61, -1,
- 61, 34, 61, -1, 61, 35, 61, -1, 61, 33,
- 61, -1, 61, 32, 61, -1, 61, 36, 61, -1,
- 61, 37, 61, -1, 61, 39, 61, -1, 61, 38,
- 61, -1, 61, 42, 61, -1, 61, 41, 61, -1,
- 61, 40, 61, -1, 46, 61, -1, 47, 61, -1,
- 39, 61, -1, 38, 61, -1, 44, 61, 45, -1,
- 16, -1, 62, 48, 16, -1, 20, -1, 69, 20,
- -1, 69, 20, -1, -1, 69, -1, -1, 69, -1,
- 4, 16, -1, 4, 44, 16, 45, -1, 70, -1,
- 67, -1, 68, 67, -1, 70, -1, 69, 70, -1,
- 16, -1, 19, -1, 71, -1, 21, -1, 23, -1,
- 49, -1, 50, -1, 44, -1, 45, -1, 51, -1,
- 52, -1, 53, -1, 29, -1, 40, -1, 38, -1,
- 39, -1, 47, -1, 46, -1, 41, -1, 42, -1,
- 37, -1, 36, -1, 32, -1, 33, -1, 35, -1,
- 34, -1, 31, -1, 30, -1, 28, -1, 27, -1,
- 26, -1, 25, -1, 54, -1, 48, -1, 55, -1,
- 24, -1
+ 58, 0, -1, -1, 58, 59, -1, 61, -1, 65,
+ -1, 60, -1, 6, 66, -1, 18, 63, 21, -1,
+ 5, 63, 21, -1, 8, 17, 67, 21, -1, 7,
+ 17, 45, 46, 67, 21, -1, 7, 17, 45, 64,
+ 46, 67, 21, -1, 15, 17, 21, -1, 12, 70,
+ 21, -1, 13, 17, 68, 21, -1, 14, 17, 68,
+ 21, -1, 9, 70, 21, -1, 9, 21, -1, 10,
+ 21, -1, 11, 21, -1, 16, 62, 21, -1, 6,
+ 21, -1, 20, -1, 19, -1, 62, -1, 63, 26,
+ 63, -1, 63, 27, 63, -1, 63, 28, 63, -1,
+ 63, 29, 63, -1, 63, 30, 63, -1, 63, 31,
+ 63, -1, 63, 32, 63, -1, 63, 35, 63, -1,
+ 63, 36, 63, -1, 63, 34, 63, -1, 63, 33,
+ 63, -1, 63, 37, 63, -1, 63, 38, 63, -1,
+ 63, 40, 63, -1, 63, 39, 63, -1, 63, 43,
+ 63, -1, 63, 42, 63, -1, 63, 41, 63, -1,
+ 47, 63, -1, 48, 63, -1, 40, 63, -1, 39,
+ 63, -1, 45, 63, 46, -1, 17, -1, 64, 49,
+ 17, -1, 21, -1, 71, 21, -1, 71, 21, -1,
+ -1, 71, -1, -1, 71, -1, 4, 17, -1, 4,
+ 45, 17, 46, -1, 72, -1, 69, -1, 70, 69,
+ -1, 72, -1, 71, 72, -1, 17, -1, 20, -1,
+ 73, -1, 22, -1, 24, -1, 50, -1, 51, -1,
+ 45, -1, 46, -1, 52, -1, 53, -1, 54, -1,
+ 30, -1, 41, -1, 39, -1, 40, -1, 48, -1,
+ 47, -1, 42, -1, 43, -1, 38, -1, 37, -1,
+ 33, -1, 34, -1, 36, -1, 35, -1, 32, -1,
+ 31, -1, 29, -1, 28, -1, 27, -1, 26, -1,
+ 55, -1, 49, -1, 56, -1, 25, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
- 0, 166, 166, 168, 172, 175, 180, 181, 185, 188,
- 194, 197, 200, 203, 211, 223, 228, 233, 245, 256,
- 259, 262, 266, 275, 278, 281, 284, 287, 290, 293,
- 296, 299, 302, 305, 308, 311, 314, 317, 320, 323,
- 326, 329, 332, 335, 338, 341, 344, 350, 355, 363,
- 364, 368, 374, 375, 378, 380, 387, 391, 395, 400,
- 406, 414, 420, 428, 432, 436, 440, 444, 451, 452,
- 453, 454, 455, 456, 457, 458, 459, 460, 461, 462,
- 463, 464, 465, 466, 467, 468, 469, 470, 471, 472,
- 473, 474, 475, 476, 477, 478, 479, 480, 481
+ 0, 169, 169, 171, 175, 178, 183, 184, 188, 191,
+ 197, 200, 203, 206, 214, 226, 231, 236, 248, 259,
+ 262, 265, 274, 278, 287, 292, 293, 296, 299, 302,
+ 305, 308, 311, 314, 317, 320, 323, 326, 329, 332,
+ 335, 338, 341, 344, 347, 350, 353, 356, 359, 365,
+ 370, 378, 379, 383, 389, 390, 393, 395, 402, 406,
+ 410, 415, 421, 429, 435, 443, 447, 451, 455, 459,
+ 466, 467, 468, 469, 470, 471, 472, 473, 474, 475,
+ 476, 477, 478, 479, 480, 481, 482, 483, 484, 485,
+ 486, 487, 488, 489, 490, 491, 492, 493, 494, 495,
+ 496
};
#endif
@@ -637,16 +643,16 @@ static const char *const yytname[] =
"$end", "error", "$undefined", "COMMA_FINAL", "DEFINED",
"ELIF_EXPANDED", "HASH", "HASH_DEFINE_FUNC", "HASH_DEFINE_OBJ",
"HASH_ELIF", "HASH_ELSE", "HASH_ENDIF", "HASH_IF", "HASH_IFDEF",
- "HASH_IFNDEF", "HASH_UNDEF", "IDENTIFIER", "IF_EXPANDED", "INTEGER",
- "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE", "PASTE",
- "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'", "'>'",
- "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT", "'+'",
- "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'", "','",
- "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept", "input",
- "line", "expanded_line", "control_line", "expression", "identifier_list",
- "text_line", "non_directive", "replacement_list", "junk",
- "conditional_token", "conditional_tokens", "pp_tokens",
- "preprocessing_token", "operator", 0
+ "HASH_IFNDEF", "HASH_UNDEF", "HASH_VERSION", "IDENTIFIER", "IF_EXPANDED",
+ "INTEGER", "INTEGER_STRING", "NEWLINE", "OTHER", "PLACEHOLDER", "SPACE",
+ "PASTE", "OR", "AND", "'|'", "'^'", "'&'", "NOT_EQUAL", "EQUAL", "'<'",
+ "'>'", "GREATER_OR_EQUAL", "LESS_OR_EQUAL", "RIGHT_SHIFT", "LEFT_SHIFT",
+ "'+'", "'-'", "'*'", "'/'", "'%'", "UNARY", "'('", "')'", "'!'", "'~'",
+ "','", "'['", "']'", "'{'", "'}'", "'.'", "';'", "'='", "$accept",
+ "input", "line", "expanded_line", "control_line", "integer_constant",
+ "expression", "identifier_list", "text_line", "non_directive",
+ "replacement_list", "junk", "conditional_token", "conditional_tokens",
+ "pp_tokens", "preprocessing_token", "operator", 0
};
#endif
@@ -657,26 +663,27 @@ static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 124, 94, 38,
- 282, 283, 60, 62, 284, 285, 286, 287, 43, 45,
- 42, 47, 37, 288, 40, 41, 33, 126, 44, 91,
- 93, 123, 125, 46, 59, 61
+ 275, 276, 277, 278, 279, 280, 281, 282, 124, 94,
+ 38, 283, 284, 60, 62, 285, 286, 287, 288, 43,
+ 45, 42, 47, 37, 289, 40, 41, 33, 126, 44,
+ 91, 93, 123, 125, 46, 59, 61
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
static const yytype_uint8 yyr1[] =
{
- 0, 56, 57, 57, 58, 58, 58, 58, 59, 59,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 61, 61, 61, 61, 61, 61, 61, 61,
+ 0, 57, 58, 58, 59, 59, 59, 59, 60, 60,
61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 62, 62, 63,
- 63, 64, 65, 65, 66, 66, 67, 67, 67, 68,
- 68, 69, 69, 70, 70, 70, 70, 70, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
- 71, 71, 71, 71, 71, 71, 71, 71, 71
+ 61, 61, 61, 62, 62, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 64,
+ 64, 65, 65, 66, 67, 67, 68, 68, 69, 69,
+ 69, 70, 70, 71, 71, 72, 72, 72, 72, 72,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
+ 73
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -684,14 +691,15 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 1, 1, 1, 2, 3, 3,
4, 6, 7, 3, 3, 4, 4, 3, 2, 2,
- 2, 2, 1, 1, 3, 3, 3, 3, 3, 3,
+ 2, 3, 2, 1, 1, 1, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 2, 2, 2, 2, 3, 1, 3, 1,
- 2, 2, 0, 1, 0, 1, 2, 4, 1, 1,
- 2, 1, 2, 1, 1, 1, 1, 1, 1, 1,
+ 3, 3, 3, 3, 2, 2, 2, 2, 3, 1,
+ 3, 1, 2, 2, 0, 1, 0, 1, 2, 4,
+ 1, 1, 2, 1, 2, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1
+ 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -700,58 +708,60 @@ static const yytype_uint8 yyr2[] =
static const yytype_uint8 yydefact[] =
{
2, 0, 1, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 63, 0, 64, 49, 66, 67,
- 98, 94, 93, 92, 91, 75, 90, 89, 85, 86,
- 88, 87, 84, 83, 77, 78, 76, 81, 82, 70,
- 71, 80, 79, 96, 68, 69, 72, 73, 74, 95,
- 97, 3, 6, 4, 5, 0, 61, 65, 23, 22,
- 0, 0, 0, 0, 0, 0, 21, 7, 0, 0,
- 52, 0, 18, 59, 0, 58, 19, 20, 0, 54,
- 54, 0, 0, 50, 62, 45, 44, 0, 42, 43,
- 9, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 51,
- 0, 0, 53, 56, 0, 17, 60, 14, 0, 55,
- 0, 13, 8, 46, 24, 25, 26, 27, 28, 29,
- 30, 34, 33, 31, 32, 35, 36, 38, 37, 41,
- 40, 39, 47, 52, 0, 10, 0, 15, 16, 0,
- 52, 0, 57, 11, 0, 48, 12
+ 0, 0, 0, 0, 0, 65, 0, 66, 51, 68,
+ 69, 100, 96, 95, 94, 93, 77, 92, 91, 87,
+ 88, 90, 89, 86, 85, 79, 80, 78, 83, 84,
+ 72, 73, 82, 81, 98, 70, 71, 74, 75, 76,
+ 97, 99, 3, 6, 4, 5, 0, 63, 67, 24,
+ 23, 0, 0, 0, 0, 0, 25, 0, 22, 7,
+ 0, 0, 54, 0, 18, 61, 0, 60, 19, 20,
+ 0, 56, 56, 0, 0, 0, 52, 64, 47, 46,
+ 0, 44, 45, 9, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 53, 0, 0, 55, 58, 0, 17, 62,
+ 14, 0, 57, 0, 13, 21, 8, 48, 26, 27,
+ 28, 29, 30, 31, 32, 36, 35, 33, 34, 37,
+ 38, 40, 39, 43, 42, 41, 49, 54, 0, 10,
+ 0, 15, 16, 0, 54, 0, 59, 11, 0, 50,
+ 12
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 1, 51, 52, 53, 65, 144, 54, 67, 111,
- 118, 73, 74, 112, 56, 57
+ -1, 1, 52, 53, 54, 66, 67, 148, 55, 69,
+ 114, 121, 75, 76, 115, 57, 58
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -120
+#define YYPACT_NINF -146
static const yytype_int16 yypact[] =
{
- -120, 108, -120, -17, 356, -9, 9, 160, -15, 6,
- 316, 17, 18, 29, -120, -17, -120, -120, -120, -120,
- -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
- -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
- -120, -120, -120, -120, -120, -120, -120, -120, -120, -120,
- -120, -120, -120, -120, -120, 396, -120, -120, -120, -120,
- -17, -17, -17, -17, -17, 512, -120, -120, 436, 2,
- 476, -8, -120, -120, 212, -120, -120, -120, 264, 476,
- 476, 39, 535, -120, -120, -120, -120, 553, -120, -120,
- -120, -17, -17, -17, -17, -17, -17, -17, -17, -17,
- -17, -17, -17, -17, -17, -17, -17, -17, -17, -120,
- -10, 40, 476, -120, 49, -120, -120, -120, 46, 476,
- 48, -120, -120, -120, 573, 589, 604, 618, 631, -23,
- -23, 1, 1, 1, 1, 16, 16, 22, 22, -120,
- -120, -120, -120, 476, -1, -120, 24, -120, -120, 50,
- 476, 56, -120, -120, 53, -120, -120
+ -146, 111, -146, 429, -10, -9, -4, 151, -15, 27,
+ 271, 54, 63, 86, 82, -146, 429, -146, -146, -146,
+ -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+ -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+ -146, -146, -146, -146, -146, -146, -146, -146, -146, -146,
+ -146, -146, -146, -146, -146, -146, 311, -146, -146, -146,
+ -146, 429, 429, 429, 429, 429, -146, 452, -146, -146,
+ 351, 59, 391, 17, -146, -146, 191, -146, -146, -146,
+ 231, 391, 391, 84, 85, 475, -146, -146, -146, -146,
+ 424, -146, -146, -146, 429, 429, 429, 429, 429, 429,
+ 429, 429, 429, 429, 429, 429, 429, 429, 429, 429,
+ 429, 429, -146, 30, 88, 391, -146, 90, -146, -146,
+ -146, 89, 391, 91, -146, -146, -146, -146, 492, 508,
+ 523, 537, 550, 561, 561, 18, 18, 18, 18, 25,
+ 25, 36, 36, -146, -146, -146, -146, 391, 26, -146,
+ 67, -146, -146, 93, 391, 113, -146, -146, 148, -146,
+ -146
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
+static const yytype_int16 yypgoto[] =
{
- -120, -120, -120, -120, -120, -11, -120, -120, -120, -119,
- -6, -46, 65, 19, -7, -120
+ -146, -146, -146, -146, -146, 120, -11, -146, -146, -146,
+ -145, 92, -6, 160, 0, -7, -146
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -761,168 +771,155 @@ static const yytype_int8 yypgoto[] =
#define YYTABLE_NINF -1
static const yytype_uint8 yytable[] =
{
- 75, 58, 59, 75, 82, 76, 142, 69, 113, 98,
- 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
- 55, 60, 61, 68, 149, 70, 77, 62, 116, 63,
- 64, 154, 116, 79, 80, 143, 114, 102, 103, 104,
- 105, 106, 107, 108, 150, 81, 110, 151, 84, 85,
- 86, 87, 88, 89, 104, 105, 106, 107, 108, 121,
- 145, 84, 106, 107, 108, 146, 147, 75, 148, 152,
- 153, 75, 155, 156, 120, 78, 0, 0, 0, 0,
- 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
- 134, 135, 136, 137, 138, 139, 140, 141, 119, 119,
- 0, 0, 0, 0, 0, 84, 0, 0, 2, 0,
- 0, 0, 84, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 0, 16, 17, 18,
- 0, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 0, 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 71, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 14, 0, 0, 16,
- 72, 18, 0, 19, 20, 21, 22, 23, 24, 25,
+ 77, 56, 153, 77, 70, 85, 78, 15, 71, 158,
+ 17, 68, 19, 72, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 0, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 71, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 14, 0,
- 0, 16, 115, 18, 0, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 0, 39, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 71, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 14, 0, 0, 16, 117, 18, 0, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 0, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 71, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 14, 0, 0, 16, 0, 18, 0, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 14, 0, 0, 16, 66, 18, 0, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 14, 0, 0, 16, 83, 18, 0, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 14, 0, 0, 16, 109, 18, 0, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 14, 0, 0, 16, 0, 18, 0, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 0,
- 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 90, 0, 0, 0, 0, 91, 92, 93,
+ 36, 37, 38, 39, 116, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 146, 79, 87,
+ 88, 89, 90, 91, 92, 105, 106, 107, 108, 109,
+ 110, 111, 117, 87, 107, 108, 109, 110, 111, 77,
+ 119, 81, 154, 77, 119, 155, 147, 109, 110, 111,
+ 82, 122, 122, 128, 129, 130, 131, 132, 133, 134,
+ 135, 136, 137, 138, 139, 140, 141, 142, 143, 144,
+ 145, 59, 60, 83, 113, 124, 125, 150, 87, 149,
+ 151, 2, 152, 156, 157, 87, 3, 4, 5, 6,
+ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
+ 159, 17, 18, 19, 84, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 73, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 160,
+ 80, 17, 74, 19, 123, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 73, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 0,
+ 0, 17, 118, 19, 0, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 73, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 0,
+ 0, 17, 120, 19, 0, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 73, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 0,
+ 0, 17, 0, 19, 0, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 0,
+ 0, 17, 86, 19, 0, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 0,
+ 0, 17, 112, 19, 0, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 15, 0,
+ 0, 17, 0, 19, 0, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 0, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 59, 60,
94, 95, 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 122, 0, 0, 0, 0,
- 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, 91, 92,
- 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
- 103, 104, 105, 106, 107, 108, 0, 0, 123, 92,
- 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
- 103, 104, 105, 106, 107, 108, 93, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
- 107, 108, 94, 95, 96, 97, 98, 99, 100, 101,
- 102, 103, 104, 105, 106, 107, 108, 95, 96, 97,
- 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
- 108, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108
+ 104, 105, 106, 107, 108, 109, 110, 111, 61, 62,
+ 127, 0, 0, 93, 63, 0, 64, 65, 94, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109, 110, 111, 126, 0, 0, 0,
+ 0, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 95,
+ 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+ 106, 107, 108, 109, 110, 111, 96, 97, 98, 99,
+ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
+ 110, 111, 97, 98, 99, 100, 101, 102, 103, 104,
+ 105, 106, 107, 108, 109, 110, 111, 98, 99, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, 101, 102, 103, 104, 105, 106,
+ 107, 108, 109, 110, 111
};
static const yytype_int16 yycheck[] =
{
- 7, 18, 19, 10, 15, 20, 16, 16, 16, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
- 1, 38, 39, 4, 143, 16, 20, 44, 74, 46,
- 47, 150, 78, 16, 16, 45, 44, 36, 37, 38,
- 39, 40, 41, 42, 45, 16, 44, 48, 55, 60,
- 61, 62, 63, 64, 38, 39, 40, 41, 42, 20,
- 20, 68, 40, 41, 42, 16, 20, 74, 20, 45,
- 20, 78, 16, 20, 80, 10, -1, -1, -1, -1,
- 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
- 101, 102, 103, 104, 105, 106, 107, 108, 79, 80,
- -1, -1, -1, -1, -1, 112, -1, -1, 0, -1,
- -1, -1, 119, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, -1, 19, 20, 21,
- -1, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, -1, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 4, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 16, -1, -1, 19,
- 20, 21, -1, 23, 24, 25, 26, 27, 28, 29,
+ 7, 1, 147, 10, 4, 16, 21, 17, 17, 154,
+ 20, 21, 22, 17, 24, 25, 26, 27, 28, 29,
30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, -1, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 4, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 16, -1,
- -1, 19, 20, 21, -1, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, -1, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 4, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 16, -1, -1, 19, 20, 21, -1, 23, 24, 25,
+ 40, 41, 42, 43, 17, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 17, 21, 56,
+ 61, 62, 63, 64, 65, 37, 38, 39, 40, 41,
+ 42, 43, 45, 70, 39, 40, 41, 42, 43, 76,
+ 76, 17, 46, 80, 80, 49, 46, 41, 42, 43,
+ 17, 81, 82, 94, 95, 96, 97, 98, 99, 100,
+ 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
+ 111, 19, 20, 17, 45, 21, 21, 17, 115, 21,
+ 21, 0, 21, 46, 21, 122, 5, 6, 7, 8,
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 17, 20, 21, 22, 14, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 4, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, 21,
+ 10, 20, 21, 22, 82, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 4, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, -1,
+ -1, 20, 21, 22, -1, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 4, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, -1,
+ -1, 20, 21, 22, -1, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 4, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, -1,
+ -1, 20, -1, 22, -1, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, -1, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, -1,
+ -1, 20, 21, 22, -1, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, -1, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, -1,
+ -1, 20, 21, 22, -1, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, -1, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 17, -1,
+ -1, 20, -1, 22, -1, 24, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, -1, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 19, 20,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, -1, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 4, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 16, -1, -1, 19, -1, 21, -1, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, -1,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 16, -1, -1, 19, 20, 21, -1, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, -1,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 16, -1, -1, 19, 20, 21, -1, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, -1,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 16, -1, -1, 19, 20, 21, -1, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, -1,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 16, -1, -1, 19, -1, 21, -1, 23,
- 24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, -1,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 20, -1, -1, -1, -1, 25, 26, 27,
+ 36, 37, 38, 39, 40, 41, 42, 43, 39, 40,
+ 46, -1, -1, 21, 45, -1, 47, 48, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 42, 20, -1, -1, -1, -1,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, -1, -1, 45, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 42, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, 37, 38, 39, 40, 41, 42, 29, 30, 31,
+ 38, 39, 40, 41, 42, 43, 21, -1, -1, -1,
+ -1, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, 37, 38, 39, 40, 41, 42, 43, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
+ 38, 39, 40, 41, 42, 43, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- 42, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42
+ 42, 43, 29, 30, 31, 32, 33, 34, 35, 36,
+ 37, 38, 39, 40, 41, 42, 43, 30, 31, 32,
+ 33, 34, 35, 36, 37, 38, 39, 40, 41, 42,
+ 43, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+ 40, 41, 42, 43, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
- 0, 57, 0, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 19, 20, 21, 23,
+ 0, 58, 0, 5, 6, 7, 8, 9, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 20, 21, 22,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 44,
+ 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 58, 59, 60, 63, 69, 70, 71, 18, 19,
- 38, 39, 44, 46, 47, 61, 20, 64, 69, 16,
- 16, 4, 20, 67, 68, 70, 20, 20, 68, 16,
- 16, 16, 61, 20, 70, 61, 61, 61, 61, 61,
- 20, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 42, 20,
- 44, 65, 69, 16, 44, 20, 67, 20, 66, 69,
- 66, 20, 20, 45, 61, 61, 61, 61, 61, 61,
- 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,
- 61, 61, 16, 45, 62, 20, 16, 20, 20, 65,
- 45, 48, 45, 20, 65, 16, 20
+ 55, 56, 59, 60, 61, 65, 71, 72, 73, 19,
+ 20, 39, 40, 45, 47, 48, 62, 63, 21, 66,
+ 71, 17, 17, 4, 21, 69, 70, 72, 21, 21,
+ 70, 17, 17, 17, 62, 63, 21, 72, 63, 63,
+ 63, 63, 63, 21, 26, 27, 28, 29, 30, 31,
+ 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
+ 42, 43, 21, 45, 67, 71, 17, 45, 21, 69,
+ 21, 68, 71, 68, 21, 21, 21, 46, 63, 63,
+ 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+ 63, 63, 63, 63, 63, 63, 17, 46, 64, 21,
+ 17, 21, 21, 67, 46, 49, 46, 21, 67, 17,
+ 21
};
#define yyerrok (yyerrstatus = 0)
@@ -1776,7 +1773,7 @@ yyreduce:
case 4:
/* Line 1455 of yacc.c */
-#line 172 "glcpp/glcpp-parse.y"
+#line 175 "glcpp/glcpp-parse.y"
{
glcpp_print(parser->output, "\n");
;}
@@ -1785,7 +1782,7 @@ yyreduce:
case 5:
/* Line 1455 of yacc.c */
-#line 175 "glcpp/glcpp-parse.y"
+#line 178 "glcpp/glcpp-parse.y"
{
_glcpp_parser_print_expanded_token_list (parser, (yyvsp[(1) - (1)].token_list));
glcpp_print(parser->output, "\n");
@@ -1796,7 +1793,7 @@ yyreduce:
case 8:
/* Line 1455 of yacc.c */
-#line 185 "glcpp/glcpp-parse.y"
+#line 188 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_push_if (parser, & (yylsp[(1) - (3)]), (yyvsp[(2) - (3)].ival));
;}
@@ -1805,7 +1802,7 @@ yyreduce:
case 9:
/* Line 1455 of yacc.c */
-#line 188 "glcpp/glcpp-parse.y"
+#line 191 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (3)]), "elif", (yyvsp[(2) - (3)].ival));
;}
@@ -1814,7 +1811,7 @@ yyreduce:
case 10:
/* Line 1455 of yacc.c */
-#line 194 "glcpp/glcpp-parse.y"
+#line 197 "glcpp/glcpp-parse.y"
{
_define_object_macro (parser, & (yylsp[(2) - (4)]), (yyvsp[(2) - (4)].str), (yyvsp[(3) - (4)].token_list));
;}
@@ -1823,7 +1820,7 @@ yyreduce:
case 11:
/* Line 1455 of yacc.c */
-#line 197 "glcpp/glcpp-parse.y"
+#line 200 "glcpp/glcpp-parse.y"
{
_define_function_macro (parser, & (yylsp[(2) - (6)]), (yyvsp[(2) - (6)].str), NULL, (yyvsp[(5) - (6)].token_list));
;}
@@ -1832,7 +1829,7 @@ yyreduce:
case 12:
/* Line 1455 of yacc.c */
-#line 200 "glcpp/glcpp-parse.y"
+#line 203 "glcpp/glcpp-parse.y"
{
_define_function_macro (parser, & (yylsp[(2) - (7)]), (yyvsp[(2) - (7)].str), (yyvsp[(4) - (7)].string_list), (yyvsp[(6) - (7)].token_list));
;}
@@ -1841,7 +1838,7 @@ yyreduce:
case 13:
/* Line 1455 of yacc.c */
-#line 203 "glcpp/glcpp-parse.y"
+#line 206 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (3)].str));
if (macro) {
@@ -1855,7 +1852,7 @@ yyreduce:
case 14:
/* Line 1455 of yacc.c */
-#line 211 "glcpp/glcpp-parse.y"
+#line 214 "glcpp/glcpp-parse.y"
{
token_list_t *expanded;
token_t *token;
@@ -1873,7 +1870,7 @@ yyreduce:
case 15:
/* Line 1455 of yacc.c */
-#line 223 "glcpp/glcpp-parse.y"
+#line 226 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
talloc_free ((yyvsp[(2) - (4)].str));
@@ -1884,7 +1881,7 @@ yyreduce:
case 16:
/* Line 1455 of yacc.c */
-#line 228 "glcpp/glcpp-parse.y"
+#line 231 "glcpp/glcpp-parse.y"
{
macro_t *macro = hash_table_find (parser->defines, (yyvsp[(2) - (4)].str));
talloc_free ((yyvsp[(2) - (4)].str));
@@ -1895,7 +1892,7 @@ yyreduce:
case 17:
/* Line 1455 of yacc.c */
-#line 233 "glcpp/glcpp-parse.y"
+#line 236 "glcpp/glcpp-parse.y"
{
token_list_t *expanded;
token_t *token;
@@ -1913,7 +1910,7 @@ yyreduce:
case 18:
/* Line 1455 of yacc.c */
-#line 245 "glcpp/glcpp-parse.y"
+#line 248 "glcpp/glcpp-parse.y"
{
/* #elif without an expression results in a warning if the
* condition doesn't matter (we just handled #if 1 or such)
@@ -1930,7 +1927,7 @@ yyreduce:
case 19:
/* Line 1455 of yacc.c */
-#line 256 "glcpp/glcpp-parse.y"
+#line 259 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_change_if (parser, & (yylsp[(1) - (2)]), "else", 1);
;}
@@ -1939,16 +1936,31 @@ yyreduce:
case 20:
/* Line 1455 of yacc.c */
-#line 259 "glcpp/glcpp-parse.y"
+#line 262 "glcpp/glcpp-parse.y"
{
_glcpp_parser_skip_stack_pop (parser, & (yylsp[(1) - (2)]));
;}
break;
- case 22:
+ case 21:
/* Line 1455 of yacc.c */
-#line 266 "glcpp/glcpp-parse.y"
+#line 265 "glcpp/glcpp-parse.y"
+ {
+ macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
+ if (macro) {
+ hash_table_remove (parser->defines, "__VERSION__");
+ talloc_free (macro);
+ }
+ add_builtin_define (parser, "__VERSION__", (yyvsp[(2) - (3)].ival));
+ glcpp_printf(parser->output, "#version %" PRIiMAX "\n", (yyvsp[(2) - (3)].ival));
+ ;}
+ break;
+
+ case 23:
+
+/* Line 1455 of yacc.c */
+#line 278 "glcpp/glcpp-parse.y"
{
if (strlen ((yyvsp[(1) - (1)].str)) >= 3 && strncmp ((yyvsp[(1) - (1)].str), "0x", 2) == 0) {
(yyval.ival) = strtoll ((yyvsp[(1) - (1)].str) + 2, NULL, 16);
@@ -1960,226 +1972,226 @@ yyreduce:
;}
break;
- case 23:
+ case 24:
/* Line 1455 of yacc.c */
-#line 275 "glcpp/glcpp-parse.y"
+#line 287 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (1)].ival);
;}
break;
- case 24:
+ case 26:
/* Line 1455 of yacc.c */
-#line 278 "glcpp/glcpp-parse.y"
+#line 293 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) || (yyvsp[(3) - (3)].ival);
;}
break;
- case 25:
+ case 27:
/* Line 1455 of yacc.c */
-#line 281 "glcpp/glcpp-parse.y"
+#line 296 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) && (yyvsp[(3) - (3)].ival);
;}
break;
- case 26:
+ case 28:
/* Line 1455 of yacc.c */
-#line 284 "glcpp/glcpp-parse.y"
+#line 299 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival);
;}
break;
- case 27:
+ case 29:
/* Line 1455 of yacc.c */
-#line 287 "glcpp/glcpp-parse.y"
+#line 302 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) ^ (yyvsp[(3) - (3)].ival);
;}
break;
- case 28:
+ case 30:
/* Line 1455 of yacc.c */
-#line 290 "glcpp/glcpp-parse.y"
+#line 305 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) & (yyvsp[(3) - (3)].ival);
;}
break;
- case 29:
+ case 31:
/* Line 1455 of yacc.c */
-#line 293 "glcpp/glcpp-parse.y"
+#line 308 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) != (yyvsp[(3) - (3)].ival);
;}
break;
- case 30:
+ case 32:
/* Line 1455 of yacc.c */
-#line 296 "glcpp/glcpp-parse.y"
+#line 311 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) == (yyvsp[(3) - (3)].ival);
;}
break;
- case 31:
+ case 33:
/* Line 1455 of yacc.c */
-#line 299 "glcpp/glcpp-parse.y"
+#line 314 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >= (yyvsp[(3) - (3)].ival);
;}
break;
- case 32:
+ case 34:
/* Line 1455 of yacc.c */
-#line 302 "glcpp/glcpp-parse.y"
+#line 317 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) <= (yyvsp[(3) - (3)].ival);
;}
break;
- case 33:
+ case 35:
/* Line 1455 of yacc.c */
-#line 305 "glcpp/glcpp-parse.y"
+#line 320 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) > (yyvsp[(3) - (3)].ival);
;}
break;
- case 34:
+ case 36:
/* Line 1455 of yacc.c */
-#line 308 "glcpp/glcpp-parse.y"
+#line 323 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) < (yyvsp[(3) - (3)].ival);
;}
break;
- case 35:
+ case 37:
/* Line 1455 of yacc.c */
-#line 311 "glcpp/glcpp-parse.y"
+#line 326 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) >> (yyvsp[(3) - (3)].ival);
;}
break;
- case 36:
+ case 38:
/* Line 1455 of yacc.c */
-#line 314 "glcpp/glcpp-parse.y"
+#line 329 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) << (yyvsp[(3) - (3)].ival);
;}
break;
- case 37:
+ case 39:
/* Line 1455 of yacc.c */
-#line 317 "glcpp/glcpp-parse.y"
+#line 332 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) - (yyvsp[(3) - (3)].ival);
;}
break;
- case 38:
+ case 40:
/* Line 1455 of yacc.c */
-#line 320 "glcpp/glcpp-parse.y"
+#line 335 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) + (yyvsp[(3) - (3)].ival);
;}
break;
- case 39:
+ case 41:
/* Line 1455 of yacc.c */
-#line 323 "glcpp/glcpp-parse.y"
+#line 338 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) % (yyvsp[(3) - (3)].ival);
;}
break;
- case 40:
+ case 42:
/* Line 1455 of yacc.c */
-#line 326 "glcpp/glcpp-parse.y"
+#line 341 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) / (yyvsp[(3) - (3)].ival);
;}
break;
- case 41:
+ case 43:
/* Line 1455 of yacc.c */
-#line 329 "glcpp/glcpp-parse.y"
+#line 344 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(1) - (3)].ival) * (yyvsp[(3) - (3)].ival);
;}
break;
- case 42:
+ case 44:
/* Line 1455 of yacc.c */
-#line 332 "glcpp/glcpp-parse.y"
+#line 347 "glcpp/glcpp-parse.y"
{
(yyval.ival) = ! (yyvsp[(2) - (2)].ival);
;}
break;
- case 43:
+ case 45:
/* Line 1455 of yacc.c */
-#line 335 "glcpp/glcpp-parse.y"
+#line 350 "glcpp/glcpp-parse.y"
{
(yyval.ival) = ~ (yyvsp[(2) - (2)].ival);
;}
break;
- case 44:
+ case 46:
/* Line 1455 of yacc.c */
-#line 338 "glcpp/glcpp-parse.y"
+#line 353 "glcpp/glcpp-parse.y"
{
(yyval.ival) = - (yyvsp[(2) - (2)].ival);
;}
break;
- case 45:
+ case 47:
/* Line 1455 of yacc.c */
-#line 341 "glcpp/glcpp-parse.y"
+#line 356 "glcpp/glcpp-parse.y"
{
(yyval.ival) = + (yyvsp[(2) - (2)].ival);
;}
break;
- case 46:
+ case 48:
/* Line 1455 of yacc.c */
-#line 344 "glcpp/glcpp-parse.y"
+#line 359 "glcpp/glcpp-parse.y"
{
(yyval.ival) = (yyvsp[(2) - (3)].ival);
;}
break;
- case 47:
+ case 49:
/* Line 1455 of yacc.c */
-#line 350 "glcpp/glcpp-parse.y"
+#line 365 "glcpp/glcpp-parse.y"
{
(yyval.string_list) = _string_list_create (parser);
_string_list_append_item ((yyval.string_list), (yyvsp[(1) - (1)].str));
@@ -2187,10 +2199,10 @@ yyreduce:
;}
break;
- case 48:
+ case 50:
/* Line 1455 of yacc.c */
-#line 355 "glcpp/glcpp-parse.y"
+#line 370 "glcpp/glcpp-parse.y"
{
(yyval.string_list) = (yyvsp[(1) - (3)].string_list);
_string_list_append_item ((yyval.string_list), (yyvsp[(3) - (3)].str));
@@ -2198,62 +2210,62 @@ yyreduce:
;}
break;
- case 49:
+ case 51:
/* Line 1455 of yacc.c */
-#line 363 "glcpp/glcpp-parse.y"
+#line 378 "glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; ;}
break;
- case 51:
+ case 53:
/* Line 1455 of yacc.c */
-#line 368 "glcpp/glcpp-parse.y"
+#line 383 "glcpp/glcpp-parse.y"
{
yyerror (& (yylsp[(1) - (2)]), parser, "Invalid tokens after #");
;}
break;
- case 52:
+ case 54:
/* Line 1455 of yacc.c */
-#line 374 "glcpp/glcpp-parse.y"
+#line 389 "glcpp/glcpp-parse.y"
{ (yyval.token_list) = NULL; ;}
break;
- case 55:
+ case 57:
/* Line 1455 of yacc.c */
-#line 380 "glcpp/glcpp-parse.y"
+#line 395 "glcpp/glcpp-parse.y"
{
glcpp_warning(&(yylsp[(1) - (1)]), parser, "extra tokens at end of directive");
;}
break;
- case 56:
+ case 58:
/* Line 1455 of yacc.c */
-#line 387 "glcpp/glcpp-parse.y"
+#line 402 "glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(2) - (2)].str)) ? 1 : 0;
(yyval.token) = _token_create_ival (parser, INTEGER, v);
;}
break;
- case 57:
+ case 59:
/* Line 1455 of yacc.c */
-#line 391 "glcpp/glcpp-parse.y"
+#line 406 "glcpp/glcpp-parse.y"
{
int v = hash_table_find (parser->defines, (yyvsp[(3) - (4)].str)) ? 1 : 0;
(yyval.token) = _token_create_ival (parser, INTEGER, v);
;}
break;
- case 59:
+ case 61:
/* Line 1455 of yacc.c */
-#line 400 "glcpp/glcpp-parse.y"
+#line 415 "glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
(yyval.token_list) = _token_list_create (parser);
@@ -2262,10 +2274,10 @@ yyreduce:
;}
break;
- case 60:
+ case 62:
/* Line 1455 of yacc.c */
-#line 406 "glcpp/glcpp-parse.y"
+#line 421 "glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@@ -2273,10 +2285,10 @@ yyreduce:
;}
break;
- case 61:
+ case 63:
/* Line 1455 of yacc.c */
-#line 414 "glcpp/glcpp-parse.y"
+#line 429 "glcpp/glcpp-parse.y"
{
parser->space_tokens = 1;
(yyval.token_list) = _token_list_create (parser);
@@ -2285,10 +2297,10 @@ yyreduce:
;}
break;
- case 62:
+ case 64:
/* Line 1455 of yacc.c */
-#line 420 "glcpp/glcpp-parse.y"
+#line 435 "glcpp/glcpp-parse.y"
{
(yyval.token_list) = (yyvsp[(1) - (2)].token_list);
_token_list_append ((yyval.token_list), (yyvsp[(2) - (2)].token));
@@ -2296,277 +2308,277 @@ yyreduce:
;}
break;
- case 63:
+ case 65:
/* Line 1455 of yacc.c */
-#line 428 "glcpp/glcpp-parse.y"
+#line 443 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, IDENTIFIER, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
;}
break;
- case 64:
+ case 66:
/* Line 1455 of yacc.c */
-#line 432 "glcpp/glcpp-parse.y"
+#line 447 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, INTEGER_STRING, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
;}
break;
- case 65:
+ case 67:
/* Line 1455 of yacc.c */
-#line 436 "glcpp/glcpp-parse.y"
+#line 451 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, (yyvsp[(1) - (1)].ival), (yyvsp[(1) - (1)].ival));
(yyval.token)->location = yylloc;
;}
break;
- case 66:
+ case 68:
/* Line 1455 of yacc.c */
-#line 440 "glcpp/glcpp-parse.y"
+#line 455 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_str (parser, OTHER, (yyvsp[(1) - (1)].str));
(yyval.token)->location = yylloc;
;}
break;
- case 67:
+ case 69:
/* Line 1455 of yacc.c */
-#line 444 "glcpp/glcpp-parse.y"
+#line 459 "glcpp/glcpp-parse.y"
{
(yyval.token) = _token_create_ival (parser, SPACE, SPACE);
(yyval.token)->location = yylloc;
;}
break;
- case 68:
+ case 70:
/* Line 1455 of yacc.c */
-#line 451 "glcpp/glcpp-parse.y"
+#line 466 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '['; ;}
break;
- case 69:
+ case 71:
/* Line 1455 of yacc.c */
-#line 452 "glcpp/glcpp-parse.y"
+#line 467 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ']'; ;}
break;
- case 70:
+ case 72:
/* Line 1455 of yacc.c */
-#line 453 "glcpp/glcpp-parse.y"
+#line 468 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '('; ;}
break;
- case 71:
+ case 73:
/* Line 1455 of yacc.c */
-#line 454 "glcpp/glcpp-parse.y"
+#line 469 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ')'; ;}
break;
- case 72:
+ case 74:
/* Line 1455 of yacc.c */
-#line 455 "glcpp/glcpp-parse.y"
+#line 470 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '{'; ;}
break;
- case 73:
+ case 75:
/* Line 1455 of yacc.c */
-#line 456 "glcpp/glcpp-parse.y"
+#line 471 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '}'; ;}
break;
- case 74:
+ case 76:
/* Line 1455 of yacc.c */
-#line 457 "glcpp/glcpp-parse.y"
+#line 472 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '.'; ;}
break;
- case 75:
+ case 77:
/* Line 1455 of yacc.c */
-#line 458 "glcpp/glcpp-parse.y"
+#line 473 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '&'; ;}
break;
- case 76:
+ case 78:
/* Line 1455 of yacc.c */
-#line 459 "glcpp/glcpp-parse.y"
+#line 474 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '*'; ;}
break;
- case 77:
+ case 79:
/* Line 1455 of yacc.c */
-#line 460 "glcpp/glcpp-parse.y"
+#line 475 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '+'; ;}
break;
- case 78:
+ case 80:
/* Line 1455 of yacc.c */
-#line 461 "glcpp/glcpp-parse.y"
+#line 476 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '-'; ;}
break;
- case 79:
+ case 81:
/* Line 1455 of yacc.c */
-#line 462 "glcpp/glcpp-parse.y"
+#line 477 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '~'; ;}
break;
- case 80:
+ case 82:
/* Line 1455 of yacc.c */
-#line 463 "glcpp/glcpp-parse.y"
+#line 478 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '!'; ;}
break;
- case 81:
+ case 83:
/* Line 1455 of yacc.c */
-#line 464 "glcpp/glcpp-parse.y"
+#line 479 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '/'; ;}
break;
- case 82:
+ case 84:
/* Line 1455 of yacc.c */
-#line 465 "glcpp/glcpp-parse.y"
+#line 480 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '%'; ;}
break;
- case 83:
+ case 85:
/* Line 1455 of yacc.c */
-#line 466 "glcpp/glcpp-parse.y"
+#line 481 "glcpp/glcpp-parse.y"
{ (yyval.ival) = LEFT_SHIFT; ;}
break;
- case 84:
+ case 86:
/* Line 1455 of yacc.c */
-#line 467 "glcpp/glcpp-parse.y"
+#line 482 "glcpp/glcpp-parse.y"
{ (yyval.ival) = RIGHT_SHIFT; ;}
break;
- case 85:
+ case 87:
/* Line 1455 of yacc.c */
-#line 468 "glcpp/glcpp-parse.y"
+#line 483 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '<'; ;}
break;
- case 86:
+ case 88:
/* Line 1455 of yacc.c */
-#line 469 "glcpp/glcpp-parse.y"
+#line 484 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '>'; ;}
break;
- case 87:
+ case 89:
/* Line 1455 of yacc.c */
-#line 470 "glcpp/glcpp-parse.y"
+#line 485 "glcpp/glcpp-parse.y"
{ (yyval.ival) = LESS_OR_EQUAL; ;}
break;
- case 88:
+ case 90:
/* Line 1455 of yacc.c */
-#line 471 "glcpp/glcpp-parse.y"
+#line 486 "glcpp/glcpp-parse.y"
{ (yyval.ival) = GREATER_OR_EQUAL; ;}
break;
- case 89:
+ case 91:
/* Line 1455 of yacc.c */
-#line 472 "glcpp/glcpp-parse.y"
+#line 487 "glcpp/glcpp-parse.y"
{ (yyval.ival) = EQUAL; ;}
break;
- case 90:
+ case 92:
/* Line 1455 of yacc.c */
-#line 473 "glcpp/glcpp-parse.y"
+#line 488 "glcpp/glcpp-parse.y"
{ (yyval.ival) = NOT_EQUAL; ;}
break;
- case 91:
+ case 93:
/* Line 1455 of yacc.c */
-#line 474 "glcpp/glcpp-parse.y"
+#line 489 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '^'; ;}
break;
- case 92:
+ case 94:
/* Line 1455 of yacc.c */
-#line 475 "glcpp/glcpp-parse.y"
+#line 490 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '|'; ;}
break;
- case 93:
+ case 95:
/* Line 1455 of yacc.c */
-#line 476 "glcpp/glcpp-parse.y"
+#line 491 "glcpp/glcpp-parse.y"
{ (yyval.ival) = AND; ;}
break;
- case 94:
+ case 96:
/* Line 1455 of yacc.c */
-#line 477 "glcpp/glcpp-parse.y"
+#line 492 "glcpp/glcpp-parse.y"
{ (yyval.ival) = OR; ;}
break;
- case 95:
+ case 97:
/* Line 1455 of yacc.c */
-#line 478 "glcpp/glcpp-parse.y"
+#line 493 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ';'; ;}
break;
- case 96:
+ case 98:
/* Line 1455 of yacc.c */
-#line 479 "glcpp/glcpp-parse.y"
+#line 494 "glcpp/glcpp-parse.y"
{ (yyval.ival) = ','; ;}
break;
- case 97:
+ case 99:
/* Line 1455 of yacc.c */
-#line 480 "glcpp/glcpp-parse.y"
+#line 495 "glcpp/glcpp-parse.y"
{ (yyval.ival) = '='; ;}
break;
- case 98:
+ case 100:
/* Line 1455 of yacc.c */
-#line 481 "glcpp/glcpp-parse.y"
+#line 496 "glcpp/glcpp-parse.y"
{ (yyval.ival) = PASTE; ;}
break;
/* Line 1455 of yacc.c */
-#line 2570 "glcpp/glcpp-parse.c"
+#line 2582 "glcpp/glcpp-parse.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2785,7 +2797,7 @@ yyreturn:
/* Line 1675 of yacc.c */
-#line 484 "glcpp/glcpp-parse.y"
+#line 499 "glcpp/glcpp-parse.y"
string_list_t *
@@ -3196,12 +3208,26 @@ yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error)
glcpp_error(locp, parser, "%s", error);
}
+static void add_builtin_define(glcpp_parser_t *parser,
+ const char *name, int value)
+{
+ token_t *tok;
+ token_list_t *list;
+
+ tok = _token_create_ival (parser, INTEGER, value);
+
+ list = _token_list_create(parser);
+ _token_list_append(list, tok);
+ _define_object_macro(parser, NULL, name, list);
+
+ talloc_unlink(parser, tok);
+}
+
glcpp_parser_t *
glcpp_parser_create (const struct gl_extensions *extensions)
{
glcpp_parser_t *parser;
- token_t *tok;
- token_list_t *list;
+ int language_version;
parser = xtalloc (NULL, glcpp_parser_t);
@@ -3225,32 +3251,24 @@ glcpp_parser_create (const struct gl_extensions *extensions)
parser->error = 0;
/* Add pre-defined macros. */
- tok = _token_create_ival (parser, INTEGER, 1);
+ add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
+ add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list);
+ if (extensions != NULL) {
+ if (extensions->EXT_texture_array) {
+ add_builtin_define(parser, "GL_EXT_texture_array", 1);
+ }
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list);
-
- if ((extensions != NULL) && extensions->EXT_texture_array) {
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL,
- "GL_EXT_texture_array", list);
+ if (extensions->ARB_fragment_coord_conventions)
+ add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
+ 1);
}
- if ((extensions != NULL) &&
- extensions->ARB_fragment_coord_conventions) {
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL,
- "GL_ARB_fragment_coord_conventions", list);
+ language_version = 110;
+ if (extensions && extensions->ARB_shading_language_120) {
+ language_version = 120;
}
-
- talloc_unlink(parser, tok);
+ add_builtin_define(parser, "__VERSION__", language_version);
return parser;
}
diff --git a/src/glsl/glcpp/glcpp-parse.h b/src/glsl/glcpp/glcpp-parse.h
index 6365068ad0..50758930e9 100644
--- a/src/glsl/glcpp/glcpp-parse.h
+++ b/src/glsl/glcpp/glcpp-parse.h
@@ -52,24 +52,25 @@
HASH_IFDEF = 268,
HASH_IFNDEF = 269,
HASH_UNDEF = 270,
- IDENTIFIER = 271,
- IF_EXPANDED = 272,
- INTEGER = 273,
- INTEGER_STRING = 274,
- NEWLINE = 275,
- OTHER = 276,
- PLACEHOLDER = 277,
- SPACE = 278,
- PASTE = 279,
- OR = 280,
- AND = 281,
- NOT_EQUAL = 282,
- EQUAL = 283,
- GREATER_OR_EQUAL = 284,
- LESS_OR_EQUAL = 285,
- RIGHT_SHIFT = 286,
- LEFT_SHIFT = 287,
- UNARY = 288
+ HASH_VERSION = 271,
+ IDENTIFIER = 272,
+ IF_EXPANDED = 273,
+ INTEGER = 274,
+ INTEGER_STRING = 275,
+ NEWLINE = 276,
+ OTHER = 277,
+ PLACEHOLDER = 278,
+ SPACE = 279,
+ PASTE = 280,
+ OR = 281,
+ AND = 282,
+ NOT_EQUAL = 283,
+ EQUAL = 284,
+ GREATER_OR_EQUAL = 285,
+ LESS_OR_EQUAL = 286,
+ RIGHT_SHIFT = 287,
+ LEFT_SHIFT = 288,
+ UNARY = 289
};
#endif
diff --git a/src/glsl/glcpp/glcpp-parse.y b/src/glsl/glcpp/glcpp-parse.y
index 2009aeaf8a..e82fc92c8c 100644
--- a/src/glsl/glcpp/glcpp-parse.y
+++ b/src/glsl/glcpp/glcpp-parse.y
@@ -132,6 +132,9 @@ glcpp_parser_lex (YYSTYPE *yylval, YYLTYPE *yylloc, glcpp_parser_t *parser);
static void
glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list);
+static void
+add_builtin_define(glcpp_parser_t *parser, const char *name, int value);
+
%}
%pure-parser
@@ -142,9 +145,9 @@ glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list);
%lex-param {glcpp_parser_t *parser}
%expect 0
-%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE
+%token COMMA_FINAL DEFINED ELIF_EXPANDED HASH HASH_DEFINE_FUNC HASH_DEFINE_OBJ HASH_ELIF HASH_ELSE HASH_ENDIF HASH_IF HASH_IFDEF HASH_IFNDEF HASH_UNDEF HASH_VERSION IDENTIFIER IF_EXPANDED INTEGER INTEGER_STRING NEWLINE OTHER PLACEHOLDER SPACE
%token PASTE
-%type <ival> expression INTEGER operator SPACE
+%type <ival> expression INTEGER operator SPACE integer_constant
%type <str> IDENTIFIER INTEGER_STRING OTHER
%type <string_list> identifier_list
%type <token> preprocessing_token conditional_token
@@ -259,10 +262,19 @@ control_line:
| HASH_ENDIF NEWLINE {
_glcpp_parser_skip_stack_pop (parser, & @1);
}
+| HASH_VERSION integer_constant NEWLINE {
+ macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
+ if (macro) {
+ hash_table_remove (parser->defines, "__VERSION__");
+ talloc_free (macro);
+ }
+ add_builtin_define (parser, "__VERSION__", $2);
+ glcpp_printf(parser->output, "#version %" PRIiMAX "\n", $2);
+ }
| HASH NEWLINE
;
-expression:
+integer_constant:
INTEGER_STRING {
if (strlen ($1) >= 3 && strncmp ($1, "0x", 2) == 0) {
$$ = strtoll ($1 + 2, NULL, 16);
@@ -275,6 +287,9 @@ expression:
| INTEGER {
$$ = $1;
}
+
+expression:
+ integer_constant
| expression OR expression {
$$ = $1 || $3;
}
@@ -891,12 +906,26 @@ yyerror (YYLTYPE *locp, glcpp_parser_t *parser, const char *error)
glcpp_error(locp, parser, "%s", error);
}
+static void add_builtin_define(glcpp_parser_t *parser,
+ const char *name, int value)
+{
+ token_t *tok;
+ token_list_t *list;
+
+ tok = _token_create_ival (parser, INTEGER, value);
+
+ list = _token_list_create(parser);
+ _token_list_append(list, tok);
+ _define_object_macro(parser, NULL, name, list);
+
+ talloc_unlink(parser, tok);
+}
+
glcpp_parser_t *
glcpp_parser_create (const struct gl_extensions *extensions)
{
glcpp_parser_t *parser;
- token_t *tok;
- token_list_t *list;
+ int language_version;
parser = xtalloc (NULL, glcpp_parser_t);
@@ -920,32 +949,24 @@ glcpp_parser_create (const struct gl_extensions *extensions)
parser->error = 0;
/* Add pre-defined macros. */
- tok = _token_create_ival (parser, INTEGER, 1);
+ add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
+ add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL, "GL_ARB_draw_buffers", list);
+ if (extensions != NULL) {
+ if (extensions->EXT_texture_array) {
+ add_builtin_define(parser, "GL_EXT_texture_array", 1);
+ }
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL, "GL_ARB_texture_rectangle", list);
-
- if ((extensions != NULL) && extensions->EXT_texture_array) {
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL,
- "GL_EXT_texture_array", list);
+ if (extensions->ARB_fragment_coord_conventions)
+ add_builtin_define(parser, "GL_ARB_fragment_coord_conventions",
+ 1);
}
- if ((extensions != NULL) &&
- extensions->ARB_fragment_coord_conventions) {
- list = _token_list_create(parser);
- _token_list_append(list, tok);
- _define_object_macro(parser, NULL,
- "GL_ARB_fragment_coord_conventions", list);
+ language_version = 110;
+ if (extensions && extensions->ARB_shading_language_120) {
+ language_version = 120;
}
-
- talloc_unlink(parser, tok);
+ add_builtin_define(parser, "__VERSION__", language_version);
return parser;
}