Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
0a9be2db
Commit
0a9be2db
authored
27 years ago
by
Thomas G. Lockhart
Browse files
Options
Downloads
Patches
Plain Diff
Add support for delimited identifiers. Include new exclusive state "xd".
Remove unused ScanString variable and code.
parent
0175759e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/backend/parser/scan.l
+31
-10
31 additions, 10 deletions
src/backend/parser/scan.l
with
31 additions
and
10 deletions
src/backend/parser/scan.l
+
31
−
10
View file @
0a9be2db
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.2
6
1997/10/30 1
5:28:25 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.2
7
1997/10/30 1
6:36:39 thomas
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -57,7 +57,6 @@ void unput(char);
extern YYSTYPE yylval;
int llen;
char *ScanString;
char literal[MAX_PARSE_BUFFER];
%}
...
...
@@ -74,6 +73,7 @@ char literal[MAX_PARSE_BUFFER];
* <xc> extended C-style comments - tgl 1997-07-12
* <xq> quoted strings - tgl 1997-07-30
* <xm> numeric strings with embedded minus sign - tgl 1997-09-05
* <xd> delimited identifiers (double-quoted identifiers) - tgl 1997-10-27
*
* The "extended comment" syntax closely resembles allowable operator syntax.
* So, when in condition <xc>, only strings which would terminate the
...
...
@@ -83,10 +83,10 @@ char literal[MAX_PARSE_BUFFER];
*/
%x xc
%x xd
%x xq
%x xm
/* We used to allow double-quoted strings, but SQL doesn't so we won't either */
quote '
xqstart {quote}
xqstop {quote}
...
...
@@ -96,6 +96,11 @@ xqembedded "\\'"
xqliteral [\\](.|\n)
xqcat {quote}{space}*\n{space}*{quote}
dquote \"
xdstart {dquote}
xdstop {dquote}
xdinside [^"]*
xcline [\/][\*].*[\*][\/]{space}*\n*
xcstart [\/][\*]{op_and_self}*
xcstop {op_and_self}*[\*][\/]({space}*|\n)
...
...
@@ -190,12 +195,32 @@ other .
<xq>{xqcat} {
}
{xdstart} {
BEGIN(xd);
llen = 0;
*literal = '\0';
}
<xd>{xdstop} {
BEGIN(INITIAL);
yylval.str = pstrdup(literal);
return (IDENT);
}
<xd>{xdinside} {
if ((llen+yyleng) > (MAX_PARSE_BUFFER - 1))
elog(WARN,"quoted string parse buffer of %d chars exceeded",MAX_PARSE_BUFFER);
memcpy(literal+llen, yytext, yyleng+1);
llen += yyleng;
}
<xm>{space}* { /* ignore */ }
<xm>{xmstop} {
BEGIN(INITIAL);
return (yytext[0]);
}
{sysfunc} {
yylval.str = pstrdup(SystemFunctionHandler((char *)yytext));
return (SCONST);
...
...
@@ -225,7 +250,6 @@ other .
{integer}/{space}*-{number} {
BEGIN(xm);
ScanString = pstrdup((char*)yytext);
yylval.ival = atoi((char*)yytext);
return (ICONST);
}
...
...
@@ -233,10 +257,9 @@ other .
char* endptr;
BEGIN(xm);
errno = 0;
ScanString = pstrdup((char*)yytext);
yylval.dval = strtod(((char *)yytext),&endptr);
if (*endptr != '\0' || errno == ERANGE)
elog(WARN,"
\t
Bad float8 input
format\n"
);
elog(WARN,"Bad float8 input
'%s'",yytext
);
CheckFloat8Val(yylval.dval);
return (FCONST);
}
...
...
@@ -244,20 +267,18 @@ other .
char* endptr;
errno = 0;
ScanString = pstrdup((char*)yytext);
yylval.ival = strtol((char *)yytext,&endptr,10);
if (*endptr != '\0' || errno == ERANGE)
elog(WARN,"
\t
Bad integer input
format\n"
);
elog(WARN,"Bad integer input
'%s'",yytext
);
return (ICONST);
}
{real} {
char* endptr;
errno = 0;
ScanString = pstrdup((char*)yytext);
yylval.dval = strtod((char *)yytext,&endptr);
if (*endptr != '\0' || errno == ERANGE)
elog(WARN,"
\t
Bad float input
format\n"
);
elog(WARN,"Bad float input
'%s'",yytext
);
CheckFloat8Val(yylval.dval);
return (FCONST);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment