8
8
*
9
9
*
10
10
* IDENTIFICATION
11
- * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.54 1999/09/11 22:26:35 tgl Exp $
11
+ * $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.55 1999/09/27 19:40:40 momjian Exp $
12
12
*
13
13
*-------------------------------------------------------------------------
14
14
*/
@@ -81,7 +81,6 @@ char literal[MAX_PARSE_BUFFER];
81
81
* <xc> extended C-style comments - tgl 1997-07-12
82
82
* <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27
83
83
* <xh> hexadecimal numeric string - thomas 1997-11-16
84
- * <xm> numeric strings with embedded minus sign - tgl 1997-09-05
85
84
* <xq> quoted strings - tgl 1997-07-30
86
85
*
87
86
* The "extended comment" syntax closely resembles allowable operator syntax.
@@ -95,7 +94,6 @@ char literal[MAX_PARSE_BUFFER];
95
94
%x xc
96
95
%x xd
97
96
%x xh
98
- %x xm
99
97
%x xq
100
98
101
99
/* Binary number
@@ -144,7 +142,6 @@ xcinside[^*]*
144
142
xcstar [^ / ]
145
143
146
144
digit [0 -9 ]
147
- number [-+.0 -9Ee ]
148
145
letter [\200 -\377 _A -Za -z ]
149
146
letter_or_digit [\200 -\377 _A -Za -z0 -9 ]
150
147
@@ -156,13 +153,16 @@ self[,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
156
153
op_and_self [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\= ]
157
154
operator {op_and_self }+
158
155
159
- xmstop -
156
+ /* we do not allow unary minus in numbers.
157
+ * instead we pass it verbatim to parser. there it gets
158
+ * coerced via doNegate() -- Leon aug 20 1999
159
+ */
160
160
161
- integer [ \- ] ? {digit }+
162
- decimal [ \- ] ? (({digit }* \. {digit }+ )| ({digit }+ \. {digit }* ))
163
- real [ \- ] ? ((({digit }* \. {digit }+ )| ({digit }+ \. {digit }* )| ({digit }+ ))([Ee ][-+ ]? {digit }+ ))
161
+ integer {digit }+
162
+ decimal (({digit }* \. {digit }+ )| ({digit }+ \. {digit }* ))
163
+ real ((({digit }* \. {digit }+ )| ({digit }+ \. {digit }* )| ({digit }+ ))([Ee ][-+ ]? {digit }+ ))
164
164
/*
165
- real[\-]? (((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
165
+ real (((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
166
166
*/
167
167
168
168
param \$ {integer }
@@ -278,26 +278,10 @@ other.
278
278
llen += yyleng;
279
279
}
280
280
281
-
282
- <xm >{space }* {/* ignore */ }
283
- <xm >{xmstop }{
284
- BEGIN (INITIAL);
285
- return yytext[0 ];
286
- }
287
-
288
-
289
281
{typecast }{return TYPECAST; }
290
282
291
- {self }/ {space }* -[\. 0 -9 ]{
292
- BEGIN (xm);
293
- return yytext[0 ];
294
- }
295
283
{self }{return yytext[0 ]; }
296
- {self }{return yytext[0 ]; }
297
- {operator }/ -[\. 0 -9 ]{
298
- yylval.str =pstrdup ((char *)yytext);
299
- return Op;
300
- }
284
+
301
285
{operator }{
302
286
if (strcmp ((char *)yytext," !=" ) ==0 )
303
287
yylval.str =pstrdup (" <>" );/* compatability */
@@ -311,77 +295,6 @@ other.
311
295
}
312
296
313
297
314
- {identifier }/ {space }* -{number }{
315
- int i;
316
- ScanKeyword*keyword;
317
-
318
- BEGIN (xm);
319
- for (i =0 ; yytext[i]; i++)
320
- if (isascii ((unsigned char )yytext[i]) &&
321
- isupper (yytext[i]))
322
- yytext[i] =tolower (yytext[i]);
323
- if (i >= NAMEDATALEN)
324
- yytext[NAMEDATALEN-1 ] =' \0 ' ;
325
-
326
- keyword =ScanKeywordLookup ((char *)yytext);
327
- if (keyword !=NULL ) {
328
- return keyword->value ;
329
- }
330
- else
331
- {
332
- yylval.str =pstrdup ((char *)yytext);
333
- return IDENT;
334
- }
335
- }
336
- {integer }/ {space }* -{number }{
337
- char * endptr;
338
-
339
- BEGIN (xm);
340
- errno =0 ;
341
- yylval.ival =strtol ((char *)yytext,&endptr,10 );
342
- if (*endptr !=' \0 ' || errno == ERANGE)
343
- {
344
- errno =0 ;
345
- #if 0
346
- yylval.dval = strtod(((char *)yytext),&endptr);
347
- if (*endptr != '\0' || errno == ERANGE)
348
- elog(ERROR,"Bad integer input '%s'",yytext);
349
- CheckFloat8Val(yylval.dval);
350
- elog(NOTICE,"Integer input '%s' is out of range; promoted to float", yytext);
351
- return FCONST;
352
- #endif
353
- yylval.str =pstrdup ((char *)yytext);
354
- return SCONST;
355
- }
356
- return ICONST;
357
- }
358
- {decimal }/ {space }* -{number } {
359
- char * endptr;
360
-
361
- BEGIN (xm);
362
- if (strlen ((char *)yytext) <=17 )
363
- {
364
- errno =0 ;
365
- yylval.dval =strtod (((char *)yytext),&endptr);
366
- if (*endptr !=' \0 ' || errno == ERANGE)
367
- elog (ERROR," Bad float8 input '%s'" ,yytext);
368
- CheckFloat8Val (yylval.dval );
369
- return FCONST;
370
- }
371
- yylval.str =pstrdup ((char *)yytext);
372
- return SCONST;
373
- }
374
- {real }/ {space }* -{number } {
375
- char * endptr;
376
-
377
- BEGIN (xm);
378
- errno =0 ;
379
- yylval.dval =strtod (((char *)yytext),&endptr);
380
- if (*endptr !=' \0 ' || errno == ERANGE)
381
- elog (ERROR," Bad float8 input '%s'" ,yytext);
382
- CheckFloat8Val (yylval.dval );
383
- return FCONST;
384
- }
385
298
{integer }{
386
299
char * endptr;
387
300