Skip to content

Commit 4c4a667

Browse files
author
Michael Meskes
committed
Applied Peter's patch to use yyless instead of my string_unput function.
1 parent b2312c4 commit 4c4a667

File tree

1 file changed

+19
-44
lines changed
  • src/interfaces/ecpg/preproc

1 file changed

+19
-44
lines changed

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 19 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.118 2003/06/26 11:37:05 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.119 2003/07/25 05:42:27 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -42,7 +42,6 @@ static int literalalloc; /* current allocated buffer size */
4242
#define startlit() (literalbuf[0] = '\0', literallen = 0)
4343
static void addlit(char *ytext, int yleng);
4444
static void addlitchar (unsigned char);
45-
static void string_unput (char *);
4645
static void parse_include (void);
4746

4847
char *token_start;
@@ -721,9 +720,7 @@ cppline {space}*#(.*\\{space})+.*
721720
}
722721
else
723722
{
724-
string_unput("define ");
725-
/* remove the "define " part of the text */
726-
yytext[1] = '\0';
723+
yyless(1);
727724
return (S_ANYTHING);
728725
}
729726
}
@@ -732,46 +729,40 @@ cppline {space}*#(.*\\{space})+.*
732729
/* are we simulating Informix? */
733730
if (INFORMIX_MODE)
734731
{
735-
BEGIN(incl);
732+
BEGIN(incl);
736733
}
737734
else
738735
{
739-
string_unput("include ");
740-
/* remove the "include " part of the text */
741-
yytext[1] = '\0';
742-
return (S_ANYTHING);
736+
yyless(1);
737+
return (S_ANYTHING);
743738
}
744739
}
745740
<C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); }
746741
<C,xskip>{informix_special}{ifdef}{space}* {
747742
/* are we simulating Informix? */
748743
if (INFORMIX_MODE)
749744
{
750-
ifcond = TRUE;
751-
BEGIN(xcond);
745+
ifcond = TRUE;
746+
BEGIN(xcond);
752747
}
753748
else
754749
{
755-
string_unput("ifdef ");
756-
/* remove the "ifdef " part of the text */
757-
yytext[1] = '\0';
758-
return (S_ANYTHING);
750+
yyless(1);
751+
return (S_ANYTHING);
759752
}
760753
}
761754
<C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
762755
<C,xskip>{informix_special}{ifndef}{space}* {
763756
/* are we simulating Informix? */
764757
if (INFORMIX_MODE)
765758
{
766-
ifcond = FALSE;
767-
BEGIN(xcond);
759+
ifcond = FALSE;
760+
BEGIN(xcond);
768761
}
769762
else
770763
{
771-
string_unput("ifndef ");
772-
/* remove the "ifndef " part of the text */
773-
yytext[1] = '\0';
774-
return (S_ANYTHING);
764+
yyless(1);
765+
return (S_ANYTHING);
775766
}
776767
}
777768
<C,xskip>{exec_sql}{elif}{space}* { /* pop stack */
@@ -801,10 +792,8 @@ cppline {space}*#(.*\\{space})+.*
801792
}
802793
else
803794
{
804-
string_unput("elif ");
805-
/* remove the "elif " part of the text */
806-
yytext[1] = '\0';
807-
return (S_ANYTHING);
795+
yyless(1);
796+
return (S_ANYTHING);
808797
}
809798
}
810799

@@ -845,10 +834,8 @@ cppline {space}*#(.*\\{space})+.*
845834
}
846835
else
847836
{
848-
string_unput("else ");
849-
/* remove the "else " part of the text */
850-
yytext[1] = '\0';
851-
return (S_ANYTHING);
837+
yyless(1);
838+
return (S_ANYTHING);
852839
}
853840
}
854841
<C,xskip>{exec_sql}{endif}{space}*";" {
@@ -878,10 +865,8 @@ cppline {space}*#(.*\\{space})+.*
878865
}
879866
else
880867
{
881-
string_unput("endif ");
882-
/* remove the "endif " part of the text */
883-
yytext[1] = '\0';
884-
return (S_ANYTHING);
868+
yyless(1);
869+
return (S_ANYTHING);
885870
}
886871
}
887872

@@ -1045,16 +1030,6 @@ addlitchar(unsigned char ychar)
10451030
literalbuf[literallen] = '\0';
10461031
}
10471032

1048-
/* put string back on stack */
1049-
static void
1050-
string_unput (char *string)
1051-
{
1052-
int i;
1053-
1054-
for (i = strlen(string)-1; i>=0; i--)
1055-
unput(string[i]);
1056-
}
1057-
10581033
static void
10591034
parse_include(void)
10601035
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy