Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d7fb02

Browse files
committed
Following advice from Michael Ansley, I broke up the patch in
two: one fixes uminus and other literal length. They are to beapplied - uminus first, then possilbly literal on top of uminus.Leon
1 parent3f5a164 commit7d7fb02

File tree

1 file changed

+10
-97
lines changed

1 file changed

+10
-97
lines changed

‎src/backend/parser/scan.l

Lines changed: 10 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* 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 $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -81,7 +81,6 @@ char literal[MAX_PARSE_BUFFER];
8181
* <xc> extended C-style comments - tgl 1997-07-12
8282
* <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27
8383
* <xh> hexadecimal numeric string - thomas 1997-11-16
84-
* <xm> numeric strings with embedded minus sign - tgl 1997-09-05
8584
* <xq> quoted strings - tgl 1997-07-30
8685
*
8786
* The "extended comment" syntax closely resembles allowable operator syntax.
@@ -95,7 +94,6 @@ char literal[MAX_PARSE_BUFFER];
9594
%xxc
9695
%xxd
9796
%xxh
98-
%xxm
9997
%xxq
10098

10199
/* Binary number
@@ -144,7 +142,6 @@ xcinside[^*]*
144142
xcstar[^/]
145143

146144
digit[0-9]
147-
number[-+.0-9Ee]
148145
letter[\200-\377_A-Za-z]
149146
letter_or_digit[\200-\377_A-Za-z0-9]
150147

@@ -156,13 +153,16 @@ self[,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
156153
op_and_self[\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
157154
operator{op_and_self}+
158155

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+
*/
160160

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}+))
164164
/*
165-
real[\-]?(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
165+
real(((({digit}*\.{digit}+)|({digit}+\.{digit}*))([Ee][-+]?{digit}+)?)|({digit}+[Ee][-+]?{digit}+))
166166
*/
167167

168168
param\${integer}
@@ -278,26 +278,10 @@ other.
278278
llen += yyleng;
279279
}
280280

281-
282-
<xm>{space}*{/* ignore */ }
283-
<xm>{xmstop}{
284-
BEGIN(INITIAL);
285-
return yytext[0];
286-
}
287-
288-
289281
{typecast}{return TYPECAST; }
290282

291-
{self}/{space}*-[\.0-9]{
292-
BEGIN(xm);
293-
return yytext[0];
294-
}
295283
{self}{return yytext[0]; }
296-
{self}{return yytext[0]; }
297-
{operator}/-[\.0-9]{
298-
yylval.str =pstrdup((char*)yytext);
299-
return Op;
300-
}
284+
301285
{operator}{
302286
if (strcmp((char*)yytext,"!=") ==0)
303287
yylval.str =pstrdup("<>");/* compatability */
@@ -311,77 +295,6 @@ other.
311295
}
312296

313297

314-
{identifier}/{space}*-{number}{
315-
int i;
316-
ScanKeyword*keyword;
317-
318-
BEGIN(xm);
319-
for(i =0; yytext[i]; i++)
320-
if (isascii((unsignedchar)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-
#if0
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-
}
385298
{integer}{
386299
char* endptr;
387300

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp