Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
8e079051
Commit
8e079051
authored
Mar 15, 2000
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
parent
77f48853
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
80 deletions
+104
-80
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/ChangeLog
+6
-0
src/interfaces/ecpg/preproc/keywords.c
src/interfaces/ecpg/preproc/keywords.c
+2
-1
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/pgc.l
+55
-19
src/interfaces/ecpg/preproc/preproc.y
src/interfaces/ecpg/preproc/preproc.y
+41
-60
No files found.
src/interfaces/ecpg/ChangeLog
View file @
8e079051
...
@@ -861,5 +861,11 @@ Tue Mar 7 10:58:21 CET 2000
...
@@ -861,5 +861,11 @@ Tue Mar 7 10:58:21 CET 2000
Thu Mar 9 10:12:57 CET 2000
Thu Mar 9 10:12:57 CET 2000
- Fixed another memory bug in the parser.
- Fixed another memory bug in the parser.
Wed Mar 15 17:36:02 CET 2000
- Synced preproc.y with gram.y.
- Synced pgc.l with scan.l.
- Synced keyword.c.
- Set library version to 3.1.0.
- Set library version to 3.1.0.
- Set ecpg version to 2.7.0.
- Set ecpg version to 2.7.0.
src/interfaces/ecpg/preproc/keywords.c
View file @
8e079051
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.2
3 2000/02/22 19:57
:10 meskes Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.2
4 2000/03/15 19:09
:10 meskes Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -182,6 +182,7 @@ static ScanKeyword ScanKeywords[] = {
...
@@ -182,6 +182,7 @@ static ScanKeyword ScanKeywords[] = {
{
"only"
,
ONLY
},
{
"only"
,
ONLY
},
{
"operator"
,
OPERATOR
},
{
"operator"
,
OPERATOR
},
{
"option"
,
OPTION
},
{
"option"
,
OPTION
},
{
"overlaps"
,
OVERLAPS
},
{
"or"
,
OR
},
{
"or"
,
OR
},
{
"order"
,
ORDER
},
{
"order"
,
ORDER
},
{
"outer"
,
OUTER_P
},
{
"outer"
,
OUTER_P
},
...
...
src/interfaces/ecpg/preproc/pgc.l
View file @
8e079051
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.5
3 2000/03/08 22:03:12 tgl
Exp $
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.5
4 2000/03/15 19:09:10 meskes
Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -147,21 +147,22 @@ xdcother [^"]
...
@@ -147,21 +147,22 @@ xdcother [^"]
xdcinside ({xdcqq}|{xdcqdq}|{xdcother})
xdcinside ({xdcqq}|{xdcqdq}|{xdcother})
/* C-Style Comments
/* C-Style Comments
* Ignored by the scanner and parser.
* The "extended comment" syntax closely resembles allowable operator syntax.
* The "extended comment" syntax closely resembles allowable operator syntax.
* The tricky part here is to get lex to recognize a string starting with
* The tricky part here is to get lex to recognize a string starting with
* slash-star as a comment, when interpreting it as an operator would produce
* slash-star as a comment, when interpreting it as an operator would produce
* a longer match --- remember lex will prefer a longer match! So, we have
* a longer match --- remember lex will prefer a longer match! Also, if we
* to provide a special rule for xcline (a complete comment that could
* have tor whereas we want to see it as a + operator and a comment start.
* otherwise look like an operator), as well as append {op_and_self}* to
* The solution is two-fold:
* xcstart so that it matches at least as much as {operator} would.
* 1. append {op_and_self}* to xcstart so that it matches as much text as
* Then the tie-breaker (first matching rule of same length) wins.
* {operator} would. Then the tie-breaker (first matching rule of same
* There is still a problem if someone writes, eg, slash-star-star-slash-plus.
* length) ensures xcstart wins. We put back the extra stuff with yyless()
* It'll be taken as an xcstart, rather than xcline and an operator as one
* in case it contains a star-slash that should terminate the comment.
* could wish. I don't see any way around that given lex's behavior;
* 2. In the operator rule, check for slash-star within the operator, and
* that someone will just have to write a space after the comment.
* if found throw it back with yyless(). This handles the plus-slash-star
* problem.
* SQL92-style comments, which start with dash-dash, have similar interactions
* with the operator rule.
*/
*/
xcline \/\*{op_and_self}*\*\/
xcstart \/\*{op_and_self}*
xcstart \/\*{op_and_self}*
xcstop \*+\/
xcstop \*+\/
xcinside ([^*]+)|(\*+[^/])
xcinside ([^*]+)|(\*+[^/])
...
@@ -174,6 +175,7 @@ identifier {letter}{letter_or_digit}*
...
@@ -174,6 +175,7 @@ identifier {letter}{letter_or_digit}*
typecast "::"
typecast "::"
/* NB: if you change "self", fix the copy in the operator rule too! */
self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
self [,()\[\].;$\:\+\-\*\/\%\^\<\>\=\|]
op_and_self [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
op_and_self [\~\!\@\#\^\&\|\`\?\$\:\+\-\*\/\%\<\>\=]
operator {op_and_self}+
operator {op_and_self}+
...
@@ -252,31 +254,32 @@ cppline {space}*#(.*\\{line_end})*.*
...
@@ -252,31 +254,32 @@ cppline {space}*#(.*\\{line_end})*.*
*
*
* Quoted strings must allow some special characters such as single-quote
* Quoted strings must allow some special characters such as single-quote
* and newline.
* and newline.
* Embedded single-quotes are implemented both in the SQL
/
92-standard
* Embedded single-quotes are implemented both in the SQL92-standard
* style of two adjacent single quotes "''" and in the Postgres/Java style
* style of two adjacent single quotes "''" and in the Postgres/Java style
* of escaped-quote "\'".
* of escaped-quote "\'".
* Other embedded escaped characters are matched explicitly and the leading
* Other embedded escaped characters are matched explicitly and the leading
* backslash is dropped from the string. - thomas 1997-09-24
* backslash is dropped from the string. - thomas 1997-09-24
* Note that xcline must appear before xcstart, which must appear before
* Note that xcstart must appear before operator, as explained above!
* operator, as explained above! Also whitespace (comment) must appear
* Also whitespace (comment) must appear before operator.
* before operator.
*/
*/
%%
%%
<SQL>{whitespace} { /* ignore */ }
<SQL>{whitespace} { /* ignore */ }
{xcline} { ECHO; }
{xcstart} {
{xcstart} {
state_before = YYSTATE;
state_before = YYSTATE;
ECHO;
ECHO;
BEGIN(xc);
BEGIN(xc);
/* Put back any characters past slash-star; see above */
yyless(2);
}
}
<xc>{xcstop} { ECHO; BEGIN(state_before); }
<xc>{xcstop} { ECHO; BEGIN(state_before); }
<xc>{xcinside} { ECHO; }
<xc>{xcinside} { ECHO; }
<xc><<EOF>> { mmerror(ET_ERROR, "Unterminated /* comment"); }
<SQL>{xbstart} {
<SQL>{xbstart} {
BEGIN(xb);
BEGIN(xb);
startlit();
startlit();
...
@@ -291,6 +294,8 @@ cppline {space}*#(.*\\{line_end})*.*
...
@@ -291,6 +294,8 @@ cppline {space}*#(.*\\{line_end})*.*
mmerror(ET_ERROR, "Bad binary integer input!");
mmerror(ET_ERROR, "Bad binary integer input!");
return ICONST;
return ICONST;
}
}
<xb><<EOF>> { mmerror(ET_ERROR, "Unterminated binary integer"); }
<xh>{xhinside} |
<xh>{xhinside} |
<xb>{xbinside} {
<xb>{xbinside} {
addlit(yytext, yyleng);
addlit(yytext, yyleng);
...
@@ -314,6 +319,8 @@ cppline {space}*#(.*\\{line_end})*.*
...
@@ -314,6 +319,8 @@ cppline {space}*#(.*\\{line_end})*.*
return ICONST;
return ICONST;
}
}
<xb><<EOF>> { mmerror(ET_ERROR, "Unterminated hexadecimal integer"); }
{xqstart} {
{xqstart} {
state_before = YYSTATE;
state_before = YYSTATE;
BEGIN(xq);
BEGIN(xq);
...
@@ -333,6 +340,8 @@ cppline {space}*#(.*\\{line_end})*.*
...
@@ -333,6 +340,8 @@ cppline {space}*#(.*\\{line_end})*.*
/* ignore */
/* ignore */
}
}
<xq><<EOF>> { mmerror(ET_ERROR, "Unterminated quoted string"); }
{xdstart} {
{xdstart} {
state_before = YYSTATE;
state_before = YYSTATE;
BEGIN(xd);
BEGIN(xd);
...
@@ -346,6 +355,7 @@ cppline {space}*#(.*\\{line_end})*.*
...
@@ -346,6 +355,7 @@ cppline {space}*#(.*\\{line_end})*.*
<xd>{xdinside} {
<xd>{xdinside} {
addlit(yytext, yyleng);
addlit(yytext, yyleng);
}
}
<xq><<EOF>> { mmerror(ET_ERROR, "Unterminated quoted identifier"); }
<SQL>{typecast} { return TYPECAST; }
<SQL>{typecast} { return TYPECAST; }
<SQL>{self} { /*
<SQL>{self} { /*
* We may find a ';' inside a structure
* We may find a ';' inside a structure
...
@@ -357,7 +367,33 @@ cppline {space}*#(.*\\{line_end})*.*
...
@@ -357,7 +367,33 @@ cppline {space}*#(.*\\{line_end})*.*
return yytext[0];
return yytext[0];
}
}
<SQL>{operator} {
<SQL>{operator} {
if (strcmp((char*)yytext,"!=") == 0)
/* Check for embedded slash-star or dash-dash */
char *slashstar = strstr((char*)yytext, "/*");
char *dashdash = strstr((char*)yytext, "--");
if (slashstar && dashdash)
{
if (slashstar > dashdash)
slashstar = dashdash;
}
else if (!slashstar)
slashstar = dashdash;
if (slashstar)
{
int nchars = slashstar - ((char*)yytext);
yyless(nchars);
/* If what we have left is only one char, and it's
* one of the characters matching "self", then
* return it as a character token the same way
* that the "self" rule would have.
*/
if (nchars == 1 &&
strchr(",()[].;$:+-*/%^<>=|", yytext[0]))
return yytext[0];
}
if (strcmp((char*)yytext, "!=") == 0)
yylval.str = mm_strdup("<>"); /* compatability */
yylval.str = mm_strdup("<>"); /* compatability */
else
else
yylval.str = mm_strdup((char*)yytext);
yylval.str = mm_strdup((char*)yytext);
...
...
src/interfaces/ecpg/preproc/preproc.y
View file @
8e079051
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment