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
da758c26
Commit
da758c26
authored
17 years ago
by
Michael Meskes
Browse files
Options
Downloads
Patches
Plain Diff
Fixed lexer to correctly parse C quotes.
parent
59fc64ac
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/interfaces/ecpg/ChangeLog
+4
-0
4 additions, 0 deletions
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/preproc/pgc.l
+19
-35
19 additions, 35 deletions
src/interfaces/ecpg/preproc/pgc.l
with
23 additions
and
35 deletions
src/interfaces/ecpg/ChangeLog
+
4
−
0
View file @
da758c26
...
...
@@ -2279,6 +2279,10 @@ Fri, 28 Dec 2007 12:15:38 +0100
<itagaki.takahiro@oss.ntt.co.jp> to fix bug in connect statement if
user name is a variable.
- Also fixed test case that didn't detect this.
Fri, 11 Jan 2008 16:16:24 +0100
- Fixed lexer to correctly parse C quotes.
- Set pgtypes library version to 3.0.
- Set compat library version to 3.0.
- Set ecpg library version to 6.0.
...
...
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/preproc/pgc.l
+
19
−
35
View file @
da758c26
...
...
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.15
7
2008/01/
0
1 1
9:45:59 momjian
Exp $
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.15
8
2008/01/
1
1 1
5:19:16 meskes
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -29,7 +29,6 @@ extern YYSTYPE yylval;
static int xcdepth = 0; /* depth of nesting in slash-star comments */
static char *dolqstart; /* current $foo$ quote start string */
static bool escape_string_warning;
static bool warn_on_first_escape;
static YY_BUFFER_STATE scanbufhandle;
static char *scanbuf;
...
...
@@ -47,7 +46,6 @@ static int literalalloc; /* current allocated buffer size */
static void addlit(char *ytext, int yleng);
static void addlitchar (unsigned char);
static void parse_include (void);
static void check_escape_warning(void);
static bool ecpg_isspace(char ch);
static bool isdefine(void);
static bool isinformixdefine(void);
...
...
@@ -101,6 +99,7 @@ static struct _if_value
* <xd> delimited identifiers (double-quoted identifiers) - thomas 1997-10-27
* <xh> hexadecimal numeric string - thomas 1997-11-16
* <xq> standard quoted strings - thomas 1997-07-30
* <xqc> standard quoted strings in C - michael
* <xe> extended quoted strings (support backslash escape sequences)
* <xn> national character quoted strings
* <xdolq> $foo$ quoted strings
...
...
@@ -114,6 +113,7 @@ static struct _if_value
%x xe
%x xn
%x xq
%x xqc
%x xdolq
%x xcond
%x xskip
...
...
@@ -145,6 +145,7 @@ xch 0[xX][0-9A-Fa-f]*
*/
xqstart {quote}
xqdouble {quote}{quote}
xqcquote [\\]{quote}
xqinside [^']+
/* $foo$ style quotes ("dollar quoting")
...
...
@@ -409,35 +410,31 @@ cppline {space}*#(.*\\{space})*.*{newline}
/* National character.
* Transfer it as-is to the backend.
*/
warn_on_first_escape = true;
token_start = yytext;
token_start = yytext;
state_before = YYSTATE;
BEGIN(xn);
startlit();
}
<C>{xqstart} {
warn_on_first_escape = false;
token_start = yytext;
state_before = YYSTATE;
BEGIN(xq);
BEGIN(xq
c
);
startlit();
}
<SQL>{xqstart} {
warn_on_first_escape = true;
token_start = yytext;
state_before = YYSTATE;
BEGIN(xq);
startlit();
}
<SQL>{xestart} {
warn_on_first_escape = false;
token_start = yytext;
state_before = YYSTATE;
BEGIN(xe);
startlit();
}
<xq>{quotestop} |
<xq>{quotefail} {
<xq
,xqc
>{quotestop} |
<xq
,xqc
>{quotefail} {
yyless(1);
BEGIN(state_before);
yylval.str = mm_strdup(literalbuf);
...
...
@@ -457,27 +454,22 @@ cppline {space}*#(.*\\{space})*.*{newline}
yylval.str = mm_strdup(literalbuf);
return NCONST;
}
<xq,xe,xn>{xqdouble} { addlitchar('\''); }
<xq,xn>{xqinside} { addlit(yytext, yyleng); }
<xe>{xeinside} { addlit(yytext, yyleng); }
<xe>{xeescape} {
check_escape_warning();
addlit(yytext, yyleng);
<xq,xe,xn>{xqdouble} { addlitchar('\''); }
<xqc>{xqcquote} {
addlitchar('\\');
addlitchar('\'');
}
<xe>{xeoctesc} {
check_escape_warning();
addlit(yytext, yyleng);
}
<xe>{xehexesc} {
check_escape_warning();
addlit(yytext, yyleng);
}
<xq,xe,xn>{quotecontinue} { /* ignore */ }
<xq,xqc,xn>{xqinside} { addlit(yytext, yyleng); }
<xe>{xeinside} { addlit(yytext, yyleng); }
<xe>{xeescape} { addlit(yytext, yyleng); }
<xe>{xeoctesc} { addlit(yytext, yyleng); }
<xe>{xehexesc} { addlit(yytext, yyleng); }
<xq,xqc,xe,xn>{quotecontinue} { /* ignore */ }
<xe>. {
/* This is only needed for \ just before EOF */
addlitchar(yytext[0]);
}
<xq,xe,xn><<EOF>>
{ mmerror(PARSE_ERROR, ET_FATAL, "Unterminated quoted string"); }
<xq,
xqc,
xe,xn><<EOF>> { mmerror(PARSE_ERROR, ET_FATAL, "Unterminated quoted string"); }
<SQL>{dolqfailed} {
/* throw back all but the initial "$" */
yyless(1);
...
...
@@ -1284,14 +1276,6 @@ parse_include(void)
BEGIN(C);
}
static void
check_escape_warning(void)
{
if (warn_on_first_escape && escape_string_warning)
mmerror (PARSE_ERROR, ET_WARNING, "nonstandard use of escape in a string literal");
warn_on_first_escape = false; /* warn only once per string */
}
/*
* ecpg_isspace() --- return TRUE if flex scanner considers char whitespace
*/
...
...
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