|
9 | 9 | *
|
10 | 10 | *
|
11 | 11 | * IDENTIFICATION
|
12 |
| - * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.79 2000/10/30 17:54:16 petere Exp $ |
| 12 | + * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.80 2000/10/31 10:22:11 petere Exp $ |
13 | 13 | *
|
14 | 14 | *-------------------------------------------------------------------------
|
15 | 15 | */
|
@@ -93,25 +93,25 @@ static void addlit(char *ytext, int yleng);
|
93 | 93 | * We use exclusive states for quoted strings, extended comments,
|
94 | 94 | * and to eliminate parsing troubles for numeric strings.
|
95 | 95 | * Exclusive states:
|
96 |
| - * <xb> binary numericstring- thomas 1997-11-16 |
| 96 | + * <xbit> bitstringliteral |
97 | 97 | * <xc> extended C-style comments - thomas 1997-07-12
|
98 | 98 | * <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
|
99 | 99 | * <xh> hexadecimal numeric string - thomas 1997-11-16
|
100 | 100 | * <xq> quoted strings - thomas 1997-07-30
|
101 | 101 | */
|
102 | 102 |
|
103 |
| -%xxb |
| 103 | +%xxbit |
104 | 104 | %xxc
|
105 | 105 | %xxd
|
106 | 106 | %xxh
|
107 | 107 | %xxq
|
108 | 108 |
|
109 |
| -/*Binary number |
| 109 | +/*Bit string |
110 | 110 | */
|
111 |
| -xbstart[bB]{quote} |
112 |
| -xbstop{quote} |
113 |
| -xbinside[^']+ |
114 |
| -xbcat{quote}{whitespace_with_newline}{quote} |
| 111 | +xbitstart[bB]{quote} |
| 112 | +xbitstop{quote} |
| 113 | +xbitinside[^']* |
| 114 | +xbitcat{quote}{whitespace_with_newline}{quote} |
115 | 115 |
|
116 | 116 | /* Hexadecimal number
|
117 | 117 | */
|
@@ -279,30 +279,27 @@ other.
|
279 | 279 |
|
280 | 280 | <xc><<EOF>>{elog(ERROR,"Unterminated /* comment"); }
|
281 | 281 |
|
282 |
| -{xbstart}{ |
283 |
| -BEGIN(xb); |
| 282 | +{xbitstart}{ |
| 283 | +BEGIN(xbit); |
284 | 284 | startlit();
|
285 | 285 | }
|
286 |
| -<xb>{xbstop}{ |
287 |
| -char* endptr; |
288 |
| - |
| 286 | +<xbit>{xbitstop}{ |
289 | 287 | BEGIN(INITIAL);
|
290 |
| -errno =0; |
291 |
| -yylval.ival =strtol(literalbuf, &endptr,2); |
292 |
| -if (*endptr !='\0' || errno == ERANGE) |
293 |
| -elog(ERROR,"Bad binary integer input '%s'", |
| 288 | +if (literalbuf[strspn(literalbuf,"01")] !='\0') |
| 289 | +elog(ERROR,"invalid bit string input: '%s'", |
294 | 290 | literalbuf);
|
295 |
| -return ICONST; |
| 291 | +yylval.str = literalbuf; |
| 292 | +return BITCONST; |
296 | 293 | }
|
297 | 294 | <xh>{xhinside}|
|
298 |
| -<xb>{xbinside}{ |
| 295 | +<xbit>{xbitinside}{ |
299 | 296 | addlit(yytext, yyleng);
|
300 | 297 | }
|
301 | 298 | <xh>{xhcat}|
|
302 |
| -<xb>{xbcat}{ |
| 299 | +<xbit>{xbitcat}{ |
303 | 300 | /* ignore */
|
304 | 301 | }
|
305 |
| -<xb><<EOF>>{elog(ERROR,"Unterminated binary integer"); } |
| 302 | +<xbit><<EOF>>{elog(ERROR,"unterminated bit string literal"); } |
306 | 303 |
|
307 | 304 | {xhstart}{
|
308 | 305 | BEGIN(xh);
|
|