Simplify lexer's rules for string constants, eliminate potential buffer overrun.

This commit is contained in:
Tom Lane 1999-02-07 23:58:52 +00:00
parent 45ff93c460
commit f7c6a88c33
2 changed files with 212 additions and 241 deletions

View File

@ -1,7 +1,7 @@
/* A lexical scanner generated by flex */
/* Scanner skeleton version:
* /master/usr.bin/lex/skel.c,v 1.3 1997/09/25 00:10:23 jch Exp
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.33 1999/02/07 23:58:52 tgl Exp $
*/
#define FLEX_SCANNER
@ -284,33 +284,33 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
*yy_cp = '\0'; \
yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 42
#define YY_END_OF_BUFFER 43
static yyconst short int yy_acclist[184] =
#define YY_NUM_RULES 41
#define YY_END_OF_BUFFER 42
static yyconst short int yy_acclist[182] =
{ 0,
10, 10, 6, 6, 24, 24, 9, 9, 25, 25,
18, 18, 43, 41, 42, 40, 41, 42, 40, 42,
32, 41, 42, 22, 41, 42, 29, 30, 32, 41,
42, 15, 41, 42, 29, 30, 41, 42, 29, 30,
32, 41, 42, 29, 30, 32, 41, 42, 29, 30,
41, 42, 29, 30, 32, 41, 42, 37, 41, 42,
16419, 29, 30, 32, 41, 42, 39, 41, 42,16418,
39, 41, 42,16418, 39, 41, 42,16418, 10, 42,
8, 42, 3, 6, 42, 3, 6, 42, 3, 42,
6, 42, 24, 42, 23, 42, 9, 42, 14, 42,
10, 10, 6, 6, 23, 23, 9, 9, 24, 24,
18, 18, 42, 40, 41, 39, 40, 41, 39, 41,
31, 40, 41, 21, 40, 41, 28, 29, 31, 40,
41, 15, 40, 41, 28, 29, 40, 41, 28, 29,
31, 40, 41, 28, 29, 31, 40, 41, 28, 29,
40, 41, 28, 29, 31, 40, 41, 36, 40, 41,
16418, 28, 29, 31, 40, 41, 38, 40, 41,16417,
38, 40, 41,16417, 38, 40, 41,16417, 10, 41,
8, 41, 3, 6, 41, 3, 6, 41, 3, 41,
6, 41, 23, 41, 22, 41, 9, 41, 14, 41,
42, 25, 42, 26, 42, 18, 42, 16, 42, 42,
32, 32, 32, 33, 32, 32, 37,16419, 38,16420,
4, 32, 32, 38,16420, 27, 32, 39,16418, 7,
13, 10, 6, 6, 5, 24, 9, 25, 18, 17,
20, 19, 20, 31, 28, 31, 28, 31, 33, 28,
1, 32, 32, 28, 31, 4, 32, 4, 32, 4,
32, 8227, 38,16420, 38,16420, 8226, 12, 5, 11,
21, 31, 8228, 38,16420, 2, 4, 32, 31, 2,
2, 2, 2
41, 24, 41, 25, 41, 18, 41, 16, 41, 41,
31, 31, 31, 32, 31, 31, 36,16418, 37,16419,
4, 31, 31, 37,16419, 26, 31, 38,16417, 7,
13, 10, 6, 6, 5, 23, 9, 24, 18, 17,
19, 30, 27, 30, 27, 30, 32, 27, 1, 31,
31, 27, 30, 4, 31, 4, 31, 4, 31, 8226,
37,16419, 37,16419, 8225, 12, 5, 11, 20, 30,
8227, 37,16419, 2, 4, 31, 30, 2, 2, 2,
2
} ;
static yyconst short int yy_accept[135] =
static yyconst short int yy_accept[134] =
{ 0,
1, 1, 1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 16, 19, 21, 24,
@ -321,12 +321,12 @@ static yyconst short int yy_accept[135] =
123, 124, 124, 124, 126, 126, 128, 128, 128, 130,
131, 132, 133, 133, 133, 134, 135, 135, 135, 136,
137, 138, 138, 138, 139, 140, 140, 140, 141, 142,
144, 145, 147, 150, 151, 151, 152, 153, 154, 156,
143, 145, 148, 149, 149, 150, 151, 152, 154, 154,
156, 156, 156, 156, 158, 160, 162, 163, 165, 165,
167, 168, 168, 168, 169, 170, 170, 170, 171, 171,
171, 172, 173, 174, 174, 176, 176, 179, 180, 181,
182, 183, 184, 184
154, 154, 154, 156, 158, 160, 161, 163, 163, 165,
166, 166, 166, 167, 168, 168, 168, 169, 169, 169,
170, 171, 172, 172, 174, 174, 177, 178, 179, 180,
181, 182, 182
} ;
static yyconst int yy_ec[256] =
@ -368,79 +368,79 @@ static yyconst int yy_meta[22] =
12
} ;
static yyconst short int yy_base[153] =
static yyconst short int yy_base[152] =
{ 0,
0, 0, 368, 361, 18, 31, 350, 343, 339, 338,
46, 48, 18, 31, 344, 451, 451, 451, 332, 451,
58, 451, 51, 12, 44, 71, 23, 84, 327, 64,
102, 329, 0, 61, 0, 110, 67, 0, 0, 451,
0, 68, 451, 75, 451, 0, 81, 328, 247, 78,
0, 0, 361, 348, 18, 31, 343, 341, 338, 337,
46, 48, 18, 31, 343, 451, 451, 451, 331, 451,
58, 451, 51, 12, 44, 71, 23, 84, 321, 64,
102, 328, 0, 61, 0, 110, 67, 0, 0, 451,
0, 68, 451, 75, 451, 0, 81, 0, 247, 78,
91, 31, 242, 67, 234, 126, 228, 0, 146, 162,
85, 104, 0, 226, 140, 222, 150, 0, 211, 451,
451, 0, 98, 115, 0, 0, 99, 174, 153, 0,
0, 108, 156, 167, 0, 177, 179, 451, 451, 451,
451, 451, 153, 451, 183, 451, 196, 162, 0, 211,
451, 153, 451, 183, 451, 196, 162, 0, 211, 0,
0, 174, 155, 219, 111, 189, 451, 0, 77, 196,
451, 214, 217, 451, 188, 224, 234, 451, 236, 242,
451, 0, 451, 54, 51, 195, 244, 21, 248, 250,
252, 258, 451, 261, 273, 285, 297, 309, 321, 330,
338, 349, 361, 370, 379, 391, 403, 414, 426, 431,
435, 439
174, 155, 219, 111, 189, 451, 0, 77, 196, 451,
214, 217, 451, 188, 224, 234, 451, 236, 242, 451,
0, 451, 54, 51, 195, 244, 21, 248, 250, 252,
258, 451, 261, 273, 285, 297, 309, 321, 330, 338,
349, 361, 370, 379, 391, 403, 414, 426, 431, 435,
439
} ;
static yyconst short int yy_def[153] =
static yyconst short int yy_def[152] =
{ 0,
133, 1, 134, 134, 135, 135, 136, 136, 137, 137,
138, 138, 139, 139, 133, 133, 133, 133, 140, 133,
140, 133, 133, 21, 21, 133, 24, 133, 24, 141,
141, 31, 142, 133, 143, 143, 144, 36, 145, 133,
146, 133, 133, 133, 133, 147, 133, 148, 140, 140,
133, 50, 133, 133, 52, 133, 133, 28, 133, 149,
56, 133, 150, 59, 133, 140, 133, 151, 31, 133,
133, 142, 133, 133, 143, 36, 144, 144, 144, 145,
146, 133, 133, 133, 147, 133, 133, 133, 133, 133,
133, 133, 133, 133, 56, 133, 95, 97, 95, 133,
132, 1, 133, 133, 134, 134, 135, 135, 136, 136,
137, 137, 138, 138, 132, 132, 132, 132, 139, 132,
139, 132, 132, 21, 21, 132, 24, 132, 24, 140,
140, 31, 141, 132, 142, 142, 143, 36, 144, 132,
145, 132, 132, 132, 132, 146, 132, 147, 139, 139,
132, 50, 132, 132, 52, 132, 132, 28, 132, 148,
56, 132, 149, 59, 132, 139, 132, 150, 31, 132,
132, 141, 132, 132, 142, 36, 143, 143, 143, 144,
145, 132, 132, 132, 146, 132, 132, 132, 132, 132,
132, 132, 132, 56, 132, 94, 96, 94, 132, 151,
152, 133, 149, 149, 104, 104, 133, 64, 133, 64,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 95, 133, 133, 110, 149, 104, 149, 149, 149,
133, 133, 0, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133
132, 148, 148, 103, 103, 132, 64, 132, 64, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
94, 132, 132, 109, 148, 103, 148, 148, 148, 132,
132, 0, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132
} ;
static yyconst short int yy_nxt[473] =
{ 0,
16, 17, 18, 19, 20, 21, 22, 23, 24, 24,
25, 26, 27, 28, 29, 24, 30, 31, 30, 32,
16, 36, 55, 36, 47, 133, 37, 36, 36, 126,
16, 36, 55, 36, 47, 132, 37, 36, 36, 125,
38, 60, 36, 36, 36, 61, 36, 47, 48, 37,
36, 36, 92, 38, 93, 36, 36, 44, 44, 44,
36, 36, 91, 38, 92, 36, 36, 44, 44, 44,
44, 48, 51, 51, 56, 57, 45, 58, 45, 51,
51, 54, 73, 74, 125, 67, 67, 125, 52, 82,
83, 53, 51, 51, 68, 77, 84, 84, 94, 79,
94, 54, 86, 87, 59, 62, 62, 88, 50, 91,
110, 91, 51, 51, 63, 64, 95, 58, 95, 73,
51, 54, 73, 74, 124, 67, 67, 124, 52, 82,
83, 53, 51, 51, 68, 77, 84, 84, 93, 79,
93, 54, 86, 87, 59, 62, 62, 88, 50, 90,
109, 90, 51, 51, 63, 64, 94, 58, 94, 73,
74, 54, 65, 67, 67, 62, 62, 77, 70, 82,
83, 79, 68, 76, 63, 76, 112, 113, 77, 76,
76, 114, 76, 127, 76, 76, 95, 95, 96, 97,
95, 97, 95, 95, 97, 97, 98, 99, 97, 99,
97, 97, 95, 95, 95, 95, 95, 100, 100, 109,
109, 67, 67, 110, 115, 115, 101, 116, 117, 59,
68, 77, 118, 126, 102, 104, 53, 104, 84, 84,
105, 104, 106, 122, 104, 122, 104, 104, 86, 87,
119, 120, 77, 124, 124, 121, 95, 125, 95, 115,
115, 95, 95, 95, 95, 95, 95, 95, 95, 97,
83, 79, 68, 76, 63, 76, 111, 112, 77, 76,
76, 113, 76, 126, 76, 76, 94, 94, 95, 96,
94, 96, 94, 94, 96, 96, 97, 98, 96, 98,
96, 96, 94, 94, 94, 94, 94, 99, 99, 108,
108, 67, 67, 109, 114, 114, 100, 115, 116, 59,
68, 77, 117, 125, 101, 103, 53, 103, 84, 84,
104, 103, 105, 121, 103, 121, 103, 103, 86, 87,
118, 119, 77, 123, 123, 120, 94, 124, 94, 114,
114, 94, 94, 94, 94, 94, 94, 94, 94, 96,
128, 97, 128, 126, 97, 97, 98, 129, 97, 110,
97, 97, 100, 100, 133, 112, 113, 133, 112, 113,
114, 101, 104, 114, 104, 116, 117, 105, 104, 106,
118, 104, 50, 104, 104, 116, 117, 119, 120, 108,
118, 59, 121, 119, 120, 130, 131, 92, 121, 130,
131, 130, 131, 132, 131, 53, 126, 50, 126, 132,
131, 33, 33, 33, 33, 33, 33, 33, 33, 33,
127, 96, 127, 125, 96, 96, 97, 128, 96, 109,
96, 96, 99, 99, 132, 111, 112, 132, 111, 112,
113, 100, 103, 113, 103, 115, 116, 104, 103, 105,
117, 103, 50, 103, 103, 115, 116, 118, 119, 107,
117, 59, 120, 118, 119, 129, 130, 91, 120, 129,
130, 129, 130, 131, 130, 53, 125, 50, 125, 131,
130, 33, 33, 33, 33, 33, 33, 33, 33, 33,
33, 33, 33, 35, 35, 35, 35, 35, 35, 35,
35, 35, 35, 35, 35, 39, 39, 39, 39, 39,
39, 39, 39, 39, 39, 39, 39, 41, 41, 41,
@ -448,78 +448,78 @@ static yyconst short int yy_nxt[473] =
41, 41, 41, 41, 41, 41, 41, 41, 41, 43,
43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
43, 46, 46, 46, 46, 46, 46, 46, 46, 46,
46, 46, 46, 49, 90, 71, 49, 49, 49, 69,
69, 66, 50, 133, 42, 42, 69, 40, 69, 72,
72, 72, 72, 72, 40, 72, 72, 72, 72, 72,
46, 46, 46, 49, 71, 66, 49, 49, 49, 69,
69, 50, 132, 42, 42, 40, 69, 40, 69, 72,
72, 72, 72, 72, 34, 72, 72, 72, 72, 72,
72, 75, 75, 75, 75, 75, 75, 34, 75, 75,
75, 75, 75, 78, 34, 133, 78, 78, 78, 80,
80, 80, 80, 133, 80, 80, 80, 80, 80, 80,
80, 81, 81, 81, 81, 81, 133, 81, 81, 81,
75, 75, 75, 78, 132, 132, 78, 78, 78, 80,
80, 80, 80, 132, 80, 80, 80, 80, 80, 80,
80, 81, 81, 81, 81, 81, 132, 81, 81, 81,
81, 81, 81, 85, 85, 85, 85, 85, 133, 85,
81, 81, 81, 85, 85, 85, 85, 85, 132, 85,
85, 85, 85, 85, 89, 89, 89, 89, 89, 89,
89, 89, 89, 89, 89, 89, 103, 103, 133, 103,
103, 103, 103, 103, 103, 103, 103, 103, 107, 107,
107, 107, 111, 111, 111, 111, 123, 123, 123, 123,
15, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133
89, 89, 89, 89, 89, 89, 102, 102, 132, 102,
102, 102, 102, 102, 102, 102, 102, 102, 106, 106,
106, 106, 110, 110, 110, 110, 122, 122, 122, 122,
15, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132
} ;
static yyconst short int yy_chk[473] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 5, 24, 5, 13, 24, 5, 5, 5, 128,
1, 5, 24, 5, 13, 24, 5, 5, 5, 127,
5, 27, 5, 5, 6, 27, 6, 14, 13, 6,
6, 6, 52, 6, 52, 6, 6, 11, 11, 12,
12, 14, 23, 23, 25, 25, 11, 25, 12, 21,
21, 23, 34, 34, 125, 30, 30, 124, 21, 42,
21, 23, 34, 34, 124, 30, 30, 123, 21, 42,
42, 21, 26, 26, 30, 37, 44, 44, 54, 37,
54, 26, 47, 47, 26, 28, 28, 47, 50, 50,
109, 50, 51, 51, 28, 28, 61, 28, 61, 73,
108, 50, 51, 51, 28, 28, 61, 28, 61, 73,
73, 51, 28, 31, 31, 62, 62, 77, 31, 82,
82, 77, 31, 36, 62, 36, 74, 74, 36, 36,
36, 74, 36, 105, 36, 36, 56, 56, 56, 56,
36, 74, 36, 104, 36, 36, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
56, 56, 56, 56, 56, 56, 56, 59, 59, 65,
65, 67, 67, 65, 79, 79, 59, 83, 83, 59,
67, 79, 83, 103, 59, 60, 93, 60, 84, 84,
60, 60, 60, 98, 60, 98, 60, 60, 86, 86,
87, 87, 78, 102, 102, 87, 95, 102, 95, 115,
115, 95, 95, 95, 95, 95, 95, 95, 95, 97,
67, 79, 83, 102, 59, 60, 92, 60, 84, 84,
60, 60, 60, 97, 60, 97, 60, 60, 86, 86,
87, 87, 78, 101, 101, 87, 94, 101, 94, 114,
114, 94, 94, 94, 94, 94, 94, 94, 94, 96,
106, 97, 106, 126, 97, 97, 97, 126, 97, 110,
97, 97, 100, 100, 110, 112, 112, 69, 113, 113,
112, 100, 104, 113, 104, 116, 116, 104, 104, 104,
116, 104, 66, 104, 104, 117, 117, 119, 119, 64,
117, 57, 119, 120, 120, 127, 127, 55, 120, 129,
129, 130, 130, 131, 131, 53, 129, 49, 130, 132,
132, 134, 134, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 135, 135, 135, 135, 135, 135, 135,
135, 135, 135, 135, 135, 136, 136, 136, 136, 136,
136, 136, 136, 136, 136, 136, 136, 137, 137, 137,
105, 96, 105, 125, 96, 96, 96, 125, 96, 109,
96, 96, 99, 99, 109, 111, 111, 69, 112, 112,
111, 99, 103, 112, 103, 115, 115, 103, 103, 103,
115, 103, 66, 103, 103, 116, 116, 118, 118, 64,
116, 57, 118, 119, 119, 126, 126, 55, 119, 128,
128, 129, 129, 130, 130, 53, 128, 49, 129, 131,
131, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 134, 134, 134, 134, 134, 134, 134,
134, 134, 134, 134, 134, 135, 135, 135, 135, 135,
135, 135, 135, 135, 135, 135, 135, 136, 136, 136,
137, 137, 137, 137, 137, 137, 137, 137, 137, 138,
138, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 139, 139, 139, 139, 139, 139, 139, 139, 139,
139, 139, 139, 140, 48, 32, 140, 140, 140, 141,
141, 29, 19, 15, 10, 9, 141, 8, 141, 142,
142, 142, 142, 142, 7, 142, 142, 142, 142, 142,
142, 143, 143, 143, 143, 143, 143, 4, 143, 143,
143, 143, 143, 144, 3, 0, 144, 144, 144, 145,
145, 145, 145, 0, 145, 145, 145, 145, 145, 145,
145, 146, 146, 146, 146, 146, 0, 146, 146, 146,
136, 136, 136, 136, 136, 136, 136, 136, 136, 137,
137, 137, 137, 137, 137, 137, 137, 137, 137, 137,
137, 138, 138, 138, 138, 138, 138, 138, 138, 138,
138, 138, 138, 139, 32, 29, 139, 139, 139, 140,
140, 19, 15, 10, 9, 8, 140, 7, 140, 141,
141, 141, 141, 141, 4, 141, 141, 141, 141, 141,
141, 142, 142, 142, 142, 142, 142, 3, 142, 142,
142, 142, 142, 143, 0, 0, 143, 143, 143, 144,
144, 144, 144, 0, 144, 144, 144, 144, 144, 144,
144, 145, 145, 145, 145, 145, 0, 145, 145, 145,
146, 146, 146, 147, 147, 147, 147, 147, 0, 147,
147, 147, 147, 147, 148, 148, 148, 148, 148, 148,
148, 148, 148, 148, 148, 148, 149, 149, 0, 149,
149, 149, 149, 149, 149, 149, 149, 149, 150, 150,
150, 150, 151, 151, 151, 151, 152, 152, 152, 152,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133, 133, 133, 133, 133, 133, 133, 133, 133,
133, 133
145, 145, 145, 146, 146, 146, 146, 146, 0, 146,
146, 146, 146, 146, 147, 147, 147, 147, 147, 147,
147, 147, 147, 147, 147, 147, 148, 148, 0, 148,
148, 148, 148, 148, 148, 148, 148, 148, 149, 149,
149, 149, 150, 150, 150, 150, 151, 151, 151, 151,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132, 132, 132, 132, 132, 132, 132, 132, 132,
132, 132
} ;
static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
@ -556,7 +556,7 @@ char *yytext;
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.32 1998/12/18 19:45:36 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/scan.c,v 1.33 1999/02/07 23:58:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -649,6 +649,8 @@ char literal[MAX_PARSE_BUFFER];
/* Extended quote
* xqdouble implements SQL92 embedded quote
* xqcat allows strings to cross input lines
* Note: reduction of '' and \ sequences to output text is done in scanstr(),
* not by rules here.
*/
/* Delimited quote
* Allows embedded spaces and other special characters into identifiers.
@ -671,7 +673,7 @@ real [\-]?{digit}+\.{digit}+([Ee][-+]?{digit}+)?
* Other embedded escaped characters are matched explicitly and the leading
* backslash is dropped from the string. - thomas 1997-09-24
*/
#line 675 "lex.yy.c"
#line 677 "lex.yy.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@ -822,9 +824,9 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 179 "scan.l"
#line 180 "scan.l"
#line 828 "lex.yy.c"
#line 830 "lex.yy.c"
if ( yy_init )
{
@ -872,7 +874,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 >= 134 )
if ( yy_current_state >= 133 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -930,34 +932,34 @@ do_action: /* This label is used only to access EOF actions. */
{ /* beginning of action switch */
case 1:
YY_RULE_SETUP
#line 180 "scan.l"
#line 181 "scan.l"
{ /* ignore */ }
YY_BREAK
case 2:
YY_RULE_SETUP
#line 182 "scan.l"
#line 183 "scan.l"
{ /* ignore */ }
YY_BREAK
case 3:
#line 185 "scan.l"
#line 186 "scan.l"
case 4:
YY_RULE_SETUP
#line 185 "scan.l"
#line 186 "scan.l"
{ BEGIN(xc); }
YY_BREAK
case 5:
YY_RULE_SETUP
#line 187 "scan.l"
#line 188 "scan.l"
{ BEGIN(INITIAL); }
YY_BREAK
case 6:
YY_RULE_SETUP
#line 189 "scan.l"
#line 190 "scan.l"
{ /* ignore */ }
YY_BREAK
case 7:
YY_RULE_SETUP
#line 191 "scan.l"
#line 192 "scan.l"
{
BEGIN(xb);
llen = 0;
@ -966,7 +968,7 @@ YY_RULE_SETUP
YY_BREAK
case 8:
YY_RULE_SETUP
#line 196 "scan.l"
#line 197 "scan.l"
{
char* endptr;
@ -979,10 +981,10 @@ YY_RULE_SETUP
}
YY_BREAK
case 9:
#line 207 "scan.l"
#line 208 "scan.l"
case 10:
YY_RULE_SETUP
#line 207 "scan.l"
#line 208 "scan.l"
{
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@ -991,16 +993,16 @@ YY_RULE_SETUP
}
YY_BREAK
case 11:
#line 214 "scan.l"
#line 215 "scan.l"
case 12:
YY_RULE_SETUP
#line 214 "scan.l"
#line 215 "scan.l"
{
}
YY_BREAK
case 13:
YY_RULE_SETUP
#line 217 "scan.l"
#line 218 "scan.l"
{
BEGIN(xh);
llen = 0;
@ -1009,7 +1011,7 @@ YY_RULE_SETUP
YY_BREAK
case 14:
YY_RULE_SETUP
#line 222 "scan.l"
#line 223 "scan.l"
{
char* endptr;
@ -1023,7 +1025,7 @@ YY_RULE_SETUP
YY_BREAK
case 15:
YY_RULE_SETUP
#line 233 "scan.l"
#line 234 "scan.l"
{
BEGIN(xq);
llen = 0;
@ -1032,7 +1034,7 @@ YY_RULE_SETUP
YY_BREAK
case 16:
YY_RULE_SETUP
#line 238 "scan.l"
#line 239 "scan.l"
{
BEGIN(INITIAL);
yylval.str = pstrdup(scanstr(literal));
@ -1040,10 +1042,12 @@ YY_RULE_SETUP
}
YY_BREAK
case 17:
#line 244 "scan.l"
#line 245 "scan.l"
case 18:
#line 246 "scan.l"
case 19:
YY_RULE_SETUP
#line 244 "scan.l"
#line 246 "scan.l"
{
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@ -1051,54 +1055,33 @@ YY_RULE_SETUP
llen += yyleng;
}
YY_BREAK
case 19:
YY_RULE_SETUP
#line 250 "scan.l"
{
if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
memcpy(literal+llen, yytext, yyleng+1);
*(literal+llen) = '\'';
llen += yyleng;
}
YY_BREAK
case 20:
YY_RULE_SETUP
#line 258 "scan.l"
#line 252 "scan.l"
{
if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
memcpy(literal+llen, yytext, yyleng+1);
llen += yyleng;
}
YY_BREAK
case 21:
YY_RULE_SETUP
#line 264 "scan.l"
{
}
YY_BREAK
case 22:
YY_RULE_SETUP
#line 268 "scan.l"
#line 256 "scan.l"
{
BEGIN(xd);
llen = 0;
*literal = '\0';
}
YY_BREAK
case 23:
case 22:
YY_RULE_SETUP
#line 273 "scan.l"
#line 261 "scan.l"
{
BEGIN(INITIAL);
yylval.str = pstrdup(literal);
return IDENT;
}
YY_BREAK
case 24:
case 23:
YY_RULE_SETUP
#line 278 "scan.l"
#line 266 "scan.l"
{
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
@ -1106,59 +1089,59 @@ YY_RULE_SETUP
llen += yyleng;
}
YY_BREAK
case 25:
case 24:
YY_RULE_SETUP
#line 286 "scan.l"
#line 274 "scan.l"
{ /* ignore */ }
YY_BREAK
case 26:
case 25:
YY_RULE_SETUP
#line 287 "scan.l"
#line 275 "scan.l"
{
BEGIN(INITIAL);
return yytext[0];
}
YY_BREAK
case 27:
case 26:
YY_RULE_SETUP
#line 293 "scan.l"
#line 281 "scan.l"
{ return TYPECAST; }
YY_BREAK
case 28:
case 27:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp = yy_bp + 1;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 295 "scan.l"
#line 283 "scan.l"
{
BEGIN(xm);
return yytext[0];
}
YY_BREAK
case 28:
YY_RULE_SETUP
#line 287 "scan.l"
{ return yytext[0]; }
YY_BREAK
case 29:
YY_RULE_SETUP
#line 299 "scan.l"
#line 288 "scan.l"
{ return yytext[0]; }
YY_BREAK
case 30:
YY_RULE_SETUP
#line 300 "scan.l"
{ return yytext[0]; }
YY_BREAK
case 31:
*yy_cp = yy_hold_char; /* undo effects of setting up yytext */
yy_c_buf_p = yy_cp -= 2;
YY_DO_BEFORE_ACTION; /* set up yytext again */
YY_RULE_SETUP
#line 301 "scan.l"
#line 289 "scan.l"
{
yylval.str = pstrdup((char*)yytext);
return Op;
}
YY_BREAK
case 32:
case 31:
YY_RULE_SETUP
#line 305 "scan.l"
#line 293 "scan.l"
{
if (strcmp((char*)yytext,"!=") == 0)
yylval.str = pstrdup("<>"); /* compatability */
@ -1167,17 +1150,17 @@ YY_RULE_SETUP
return Op;
}
YY_BREAK
case 33:
case 32:
YY_RULE_SETUP
#line 312 "scan.l"
#line 300 "scan.l"
{
yylval.ival = atoi((char*)&yytext[1]);
return PARAM;
}
YY_BREAK
case 34:
case 33:
YY_RULE_SETUP
#line 318 "scan.l"
#line 306 "scan.l"
{
int i;
ScanKeyword *keyword;
@ -1201,9 +1184,9 @@ YY_RULE_SETUP
}
}
YY_BREAK
case 35:
case 34:
YY_RULE_SETUP
#line 340 "scan.l"
#line 328 "scan.l"
{
char* endptr;
@ -1223,9 +1206,9 @@ YY_RULE_SETUP
return ICONST;
}
YY_BREAK
case 36:
case 35:
YY_RULE_SETUP
#line 358 "scan.l"
#line 346 "scan.l"
{
char* endptr;
@ -1238,9 +1221,9 @@ YY_RULE_SETUP
return FCONST;
}
YY_BREAK
case 37:
case 36:
YY_RULE_SETUP
#line 369 "scan.l"
#line 357 "scan.l"
{
char* endptr;
@ -1259,9 +1242,9 @@ YY_RULE_SETUP
return ICONST;
}
YY_BREAK
case 38:
case 37:
YY_RULE_SETUP
#line 386 "scan.l"
#line 374 "scan.l"
{
char* endptr;
@ -1273,9 +1256,9 @@ YY_RULE_SETUP
return FCONST;
}
YY_BREAK
case 39:
case 38:
YY_RULE_SETUP
#line 398 "scan.l"
#line 386 "scan.l"
{
int i;
ScanKeyword *keyword;
@ -1298,22 +1281,22 @@ YY_RULE_SETUP
}
}
YY_BREAK
case 39:
YY_RULE_SETUP
#line 407 "scan.l"
{ /* ignore */ }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 419 "scan.l"
{ /* ignore */ }
#line 409 "scan.l"
{ return yytext[0]; }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 421 "scan.l"
{ return yytext[0]; }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 423 "scan.l"
#line 411 "scan.l"
ECHO;
YY_BREAK
#line 1317 "lex.yy.c"
#line 1300 "lex.yy.c"
case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(xb):
case YY_STATE_EOF(xc):
@ -1608,7 +1591,7 @@ static yy_state_type yy_get_previous_state()
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 >= 134 )
if ( yy_current_state >= 133 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@ -1638,11 +1621,11 @@ yy_state_type yy_current_state;
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 >= 134 )
if ( yy_current_state >= 133 )
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 == 133);
yy_is_jam = (yy_current_state == 132);
if ( ! yy_is_jam )
*yy_state_ptr++ = yy_current_state;
@ -2199,7 +2182,7 @@ int main()
return 0;
}
#endif
#line 423 "scan.l"
#line 411 "scan.l"
void yyerror(char message[])

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.44 1998/10/08 18:29:51 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.45 1999/02/07 23:58:10 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -108,13 +108,14 @@ xhcat {quote}{space}*\n{space}*{quote}
/* Extended quote
* xqdouble implements SQL92 embedded quote
* xqcat allows strings to cross input lines
* Note: reduction of '' and \ sequences to output text is done in scanstr(),
* not by rules here.
*/
quote '
xqstart {quote}
xqstop {quote}
xqdouble {quote}{quote}
xqinside [^\\']*
xqembedded "\\'"
xqliteral [\\](.|\n)
xqcat {quote}{space}*\n{space}*{quote}
@ -241,22 +242,9 @@ other .
return SCONST;
}
<xq>{xqdouble} |
<xq>{xqinside} {
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
memcpy(literal+llen, yytext, yyleng+1);
llen += yyleng;
}
<xq>{xqembedded} {
if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
memcpy(literal+llen, yytext, yyleng+1);
*(literal+llen) = '\'';
llen += yyleng;
}
<xq>{xqinside} |
<xq>{xqliteral} {
if ((llen+yyleng-1) > (MAX_PARSE_BUFFER - 1))
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
elog(ERROR,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
memcpy(literal+llen, yytext, yyleng+1);
llen += yyleng;