57#define startlit() (literalbuf[0] = '\0', literallen = 0)
58static void addlit(
char *ytext,
int yleng);
102#define MAX_NESTED_IF 128
static int state_before_str_start
static int state_before_str_stop
static bool isdefine(void)
static struct _yy_buffer * yy_buffer
static int process_integer_literal(const char *token, YYSTYPE *lval, int base)
static struct _if_value stacked_if_value[MAX_NESTED_IF]
static void parse_include(void)
static void addlitchar(unsigned char ychar)
static bool ecpg_isspace(char ch)
static void addlit(char *ytext, int yleng)
static bool isinformixdefine(void)
struct yy_buffer_state * YY_BUFFER_STATE
115%option never-interactive
121%option prefix="base_yy"
174%x C SQL incl def def_ident undef
195non_newline_space [ \t\f\v]
199comment ("--"{non_newline}*)
201whitespace ({space}+|{comment})
210non_newline_whitespace ({non_newline_space}|{comment})
211whitespace_with_newline ({non_newline_whitespace}*{newline}{whitespace}*)
215quotecontinue {whitespace_with_newline}{quote}
224quotecontinuefail {whitespace}*"-"?
242xeoctesc [\\][0-7]{1,3}
243xehexesc [\\]x[0-9A-Fa-f]{1,2}
244xeunicode [\\](u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})
250xqdouble {quote}{quote}
263dolq_start [A-Za-z\200-\377_]
264dolq_cont [A-Za-z\200-\377_0-9]
265dolqdelim \$({dolq_start}{dolq_cont}*)?\$
266dolqfailed \${dolq_start}{dolq_cont}*
275xddouble {dquote}{dquote}
279xuistart [uU]&{dquote}
288xdcinside ({xdcqq}|{xdcqdq}|{xdcother})
309xcstart \/\*{op_chars}*
313ident_start [A-Za-z\200-\377_]
314ident_cont [A-Za-z\200-\377_0-9\$]
316identifier {ident_start}{ident_cont}*
318array ({ident_cont}|{whitespace}|[\[\]\+\-\*\%\/\(\)>\.])*
349self [,()\[\].;\:\+\-\*\/\%\^<>\=]
350op_chars [\~\!\@\#\^\&\|\`\?\+\-\*\/\%<>\=]
369decinteger {decdigit}(_?{decdigit})*
370hexinteger 0[xX](_?{hexdigit})+
371octinteger 0[oO](_?{octdigit})+
372bininteger 0[bB](_?{bindigit})+
378numeric (({decinteger}\.{decinteger}?)|(\.{decinteger}))
379numericfail {decinteger}\.\.
381real ({decinteger}|{numeric})[Ee][-+]?{decinteger}
382realfail ({decinteger}|{numeric})[Ee][-+]
404integer_junk {decinteger}{identifier}
405numeric_junk {numeric}{identifier}
406real_junk {real}{identifier}
407param_junk \${decdigit}+{identifier}
431define [dD][eE][fF][iI][nN][eE]
432include [iI][nN][cC][lL][uU][dD][eE]
433include_next [iI][nN][cC][lL][uU][dD][eE]_[nN][eE][xX][tT]
434import [iI][mM][pP][oO][rR][tT]
435undef [uU][nN][dD][eE][fF]
440ifdef [iI][fF][dD][eE][fF]
441ifndef [iI][fF][nN][dD][eE][fF]
444endif [eE][nN][dD][iI][fF]
446struct [sS][tT][rR][uU][cC][tT]
448exec_sql {exec}{space}*{sql}{space}*
449ipdigit ({decdigit}|{decdigit}{decdigit}|{decdigit}{decdigit}{decdigit})
450ip {ipdigit}\.{ipdigit}\.{ipdigit}\.{ipdigit}
453cppinclude {space}*#{include}{space}*
454cppinclude_next {space}*#{include_next}{space}*
461cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+\/)|.|\\{space}*{newline})*{newline}
467 char *newdefsymbol = NULL;
void void mmfatal(int error_code, const char *error,...) pg_attribute_printf(2
608<xb,xh,xq,xqc,xe,xn,xus>{quote} {
620<xqs>{quotecontinue} {
628<xqs>{quotecontinuefail} |
void mmerror(int error_code, enum errortype type, const char *error,...) pg_attribute_printf(3
char * make3_str(const char *str1, const char *str2, const char *str3)
670<xq,xe,xn,xus>{xqdouble} {
676<xq,xqc,xn,xus>{xqinside} {
698<xq,xqc,xe,xn,xus><<EOF>> {
char * mm_strdup(const char *string)
char * loc_strdup(const char *string)
836 return EQUALS_GREATER;
844 return GREATER_EQUALS;
885 char *slashstar = strstr(yytext,
"/*");
886 char *dashdash = strstr(yytext,
"--");
888 if (slashstar && dashdash)
891 if (slashstar > dashdash)
892 slashstar = dashdash;
895 slashstar = dashdash;
897 nchars = slashstar - yytext;
908 (yytext[nchars - 1] ==
'+' ||
909 yytext[nchars - 1] ==
'-'))
913 for (ic = nchars - 2; ic >= 0; ic--)
917 if (
c ==
'~' ||
c ==
'!' ||
c ==
'@' ||
918 c ==
'#' ||
c ==
'^' ||
c ==
'&' ||
919 c ==
'|' ||
c ==
'`' ||
c ==
'?' ||
932 }
while (nchars > 1 &&
933 (yytext[nchars - 1] ==
'+' ||
934 yytext[nchars - 1] ==
'-'));
950 strchr(
",()[].;:+-*/%^<>=", yytext[0]))
961 if (yytext[0] ==
'=' && yytext[1] ==
'>')
962 return EQUALS_GREATER;
963 if (yytext[0] ==
'>' && yytext[1] ==
'=')
964 return GREATER_EQUALS;
965 if (yytext[0] ==
'<' && yytext[1] ==
'=')
967 if (yytext[0] ==
'<' && yytext[1] ==
'>')
969 if (yytext[0] ==
'!' && yytext[1] ==
'=')
int strtoint(const char *pg_restrict str, char **pg_restrict endptr, int base)
1050:{identifier}((("->"|\.){identifier})|(\[{array}\]))* {
int ScanCKeywordLookup(const char *text)
int ScanECPGKeywordLookup(const char *text)
struct typedefs * get_typedef(const char *name, bool noerror)
1106<C>{informix_special} {
1131<C>{cppinclude_next} {
1178<C>":" {
return ':'; }
1179<C>";" {
return ';'; }
1180<C>"," {
return ','; }
1181<C>"*" {
return '*'; }
1182<C>"%" {
return '%'; }
1183<C>"/" {
return '/'; }
1184<C>"+" {
return '+'; }
1185<C>"-" {
return '-'; }
1188<C,xskip>{space} {
ECHO; }
1189<C>\{ {
return '{'; }
1190<C>\} {
return '}'; }
1191<C>\[ {
return '['; }
1192<C>\] {
return ']'; }
1193<C>\= {
return '='; }
1194<C>"->" {
return S_MEMBER; }
1195<C>">>" {
return S_RSHIFT; }
1196<C>"<<" {
return S_LSHIFT; }
1197<C>"||" {
return S_OR; }
1198<C>"&&" {
return S_AND; }
1199<C>"++" {
return S_INC; }
1200<C>"--" {
return S_DEC; }
1201<C>"==" {
return S_EQUAL; }
1202<C>"!=" {
return S_NEQUAL; }
1203<C>"+=" {
return S_ADD; }
1204<C>"-=" {
return S_SUB; }
1205<C>"*=" {
return S_MUL; }
1206<C>"/=" {
return S_DIV; }
1207<C>"%=" {
return S_MOD; }
1208<C>"->*" {
return S_MEMPOINT; }
1209<C>".*" {
return S_DOTPOINT; }
1210<C>{other} {
return S_ANYTHING; }
1211<C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
1212<C>{informix_special}{define}{space}* {
1224<C>{exec_sql}{undef}{space}* {
1227<C>{informix_special}{undef}{space}* {
1239<undef>{identifier}{space}*";" {
1248 for (
i = strlen(yytext) - 2;
1252 yytext[
i + 1] =
'\0';
1255 for (ptr =
defines; ptr; ptr2 = ptr, ptr = ptr->
next)
1257 if (strcmp(yytext, ptr->name) == 0)
1262 if (ptr->cmdvalue == NULL)
struct _defines * defines
1281<C>{exec_sql}{include}{space}* {
1284<C>{informix_special}{include}{space}* {
1296<C,xskip>{exec_sql}{ifdef}{space}* {
1306<C,xskip>{informix_special}{ifdef}{space}* {
1325<C,xskip>{exec_sql}{ifndef}{space}* {
1335<C,xskip>{informix_special}{ifndef}{space}* {
1354<C,xskip>{exec_sql}{elif}{space}* {
1362<C,xskip>{informix_special}{elif}{space}* {
1380<C,xskip>{exec_sql}{else}{space}*";" {
1400<C,xskip>{informix_special}{else}{space}*";" {
1428<C,xskip>{exec_sql}{endif}{space}*";" {
1439<C,xskip>{informix_special}{endif}{space}*";" {
1462<xcond>{identifier}{space}*";" {
1473 for (
i = strlen(yytext) - 2;
1477 yytext[
i + 1] =
'\0';
1480 for (defptr =
defines; defptr; defptr = defptr->
next)
1482 if (strcmp(yytext, defptr->
name) == 0)
1485 if (defptr->
value == NULL)
1509<def_ident>{identifier} {
1514<def_ident>{other}|\n {
1524 if (strcmp(newdefsymbol, ptr->
name) == 0)
1538 ptr->
name = newdefsymbol;
void * mm_alloc(size_t size)
1550<incl>{dquote}{xdinside}{dquote}{space}*";"? {
parse_include(); }
1588 yy_delete_buffer(YY_CURRENT_BUFFER);
void output_line_number(void)
1607<INITIAL>{other}|\n {
1608 mmfatal(
PARSE_ERROR,
"internal error: unreachable state; please report this to <%s>", PACKAGE_BUGREPORT);
1685 if (*endptr !=
'\0' || errno == ERANGE)
1706 yb->
buffer = YY_CURRENT_BUFFER;
1717 for (
i = strlen(yytext) - 2;
1722 if (yytext[
i] ==
';')
1725 yytext[
i + 1] =
'\0';
1735 if (yytext[0] ==
'"' && yytext[
i] ==
'"' &&
1739 memmove(yytext, yytext + 1, strlen(yytext));
1741 strlcpy(inc_file, yytext,
sizeof(inc_file));
1742 yyin = fopen(inc_file,
"r");
1745 if (strlen(inc_file) <= 2 || strcmp(inc_file + strlen(inc_file) - 2,
".h") != 0)
1747 strcat(inc_file,
".h");
1748 yyin = fopen(inc_file,
"r");
1755 if ((yytext[0] ==
'"' && yytext[
i] ==
'"') || (yytext[0] ==
'<' && yytext[
i] ==
'>'))
1758 memmove(yytext, yytext + 1, strlen(yytext));
1765 fprintf(stderr,
_(
"Error: include path \"%s/%s\" is too long on line %d, skipping\n"), ip->
path, yytext, yylineno);
1768 snprintf(inc_file,
sizeof(inc_file),
"%s/%s", ip->
path, yytext);
1769 yyin = fopen(inc_file,
"r");
1772 if (strcmp(inc_file + strlen(inc_file) - 2,
".h") != 0)
1774 strcat(inc_file,
".h");
1775 yyin = fopen(inc_file,
"r");
1795 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
1831 if (strcmp(yytext, ptr->
name) == 0 &&
1832 ptr->
value != NULL &&
1840 yb->
buffer = YY_CURRENT_BUFFER;
1854 yy_scan_string(ptr->
value);
1869 const char *
new = NULL;
1871 if (strcmp(yytext,
"dec_t") == 0)
1873 else if (strcmp(yytext,
"intrvl_t") == 0)
1875 else if (strcmp(yytext,
"dtime_t") == 0)
1884 yb->
buffer = YY_CURRENT_BUFFER;
1890 yy_scan_string(
new);
#define fprintf(file, fmt, msg)
struct _include_path * include_paths
@ ECPG_COMPAT_INFORMIX_SE
size_t strlcpy(char *dst, const char *src, size_t siz)
struct _include_path * next