465 {
466
467 char *newdefsymbol = NULL;
468
470%}
471
472<SQL>{
473{whitespace} {
474
475 }
476} /* <SQL> */
477
478<C,SQL>{
479{xcstart} {
483 BEGIN(xc);
484
485 yyless(2);
486 fputs("/*", yyout);
487 }
static int state_before_str_start
488} /* <C,SQL> */
489
490<xc>{
491{xcstart} {
493 {
495
496 yyless(2);
497 fputs("/_*", yyout);
498 }
500 {
502 }
503 }
504
505{xcstop} {
507 {
509 {
511 BEGIN(SQL);
513 }
514 else
515 {
517 fputs("*_/", yyout);
518 }
519 }
521 {
523 BEGIN(C);
525 }
526 }
527
528{xcinside} {
530 }
531
532{op_chars} {
534 }
535
536\*+ {
538 }
539
540<<EOF>> {
542 }
543} /* <xc> */
544
545<SQL>{
546{xbstart} {
549 BEGIN(xb);
551 }
552} /* <SQL> */
553
554<xh>{xhinside} |
555<xb>{xbinside} {
557 }
static void addlit(char *ytext, int yleng)
558<xb><<EOF>> {
560 }
561
562<SQL>{xhstart} {
565 BEGIN(xh);
567 }
568<xh><<EOF>> {
570 }
571
572<C>{xqstart} {
575 BEGIN(xqc);
577 }
578
579<SQL>{
580{xnstart} {
581
584 BEGIN(xn);
586 }
587
588{xqstart} {
591 BEGIN(xq);
593 }
594{xestart} {
597 BEGIN(xe);
599 }
600{xusstart} {
603 BEGIN(xus);
605 }
606} /* <SQL> */
607
608<xb,xh,xq,xqc,xe,xn,xus>{quote} {
609
610
611
612
613
614
615
616
618 BEGIN(xqs);
619 }
static int state_before_str_stop
620<xqs>{quotecontinue} {
621
622
623
624
625
627 }
628<xqs>{quotecontinuefail} |
629<xqs>{other} |
630<xqs><<EOF>> {
631
632
633
634
635
636 yyless(0);
638
640 {
641 case xb:
645 return BCONST;
646 case xh:
650 return XCONST;
651 case xq:
652
653 case xqc:
655 return SCONST;
656 case xe:
658 return SCONST;
659 case xn:
661 return SCONST;
662 case xus:
664 return USCONST;
665 default:
667 }
668 }
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)
669
670<xq,xe,xn,xus>{xqdouble} {
672 }
673<xqc>{xqcquote} {
675 }
676<xq,xqc,xn,xus>{xqinside} {
678 }
679<xe>{xeinside} {
681 }
682<xe>{xeunicode} {
684 }
685<xe>{xeescape} {
687 }
688<xe>{xeoctesc} {
690 }
691<xe>{xehexesc} {
693 }
694<xe>. {
695
697 }
static void addlitchar(unsigned char ychar)
698<xq,xqc,xe,xn,xus><<EOF>> {
700 }
701
702<SQL>{
703{dolqdelim} {
708 BEGIN(xdolq);
711 }
712{dolqfailed} {
713
714 yyless(1);
715
716 return yytext[0];
717 }
718} /* <SQL> */
719
720<xdolq>{dolqdelim} {
722 {
726 BEGIN(SQL);
728 return SCONST;
729 }
730 else
731 {
732
733
734
735
736
739 }
740 }
741<xdolq>{dolqinside} {
743 }
744<xdolq>{dolqfailed} {
746 }
747<xdolq>. {
748
750 }
751<xdolq><<EOF>> {
753 }
754
755<SQL>{
756{xdstart} {
758 BEGIN(xd);
760 }
761{xuistart} {
763 BEGIN(xui);
765 }
766} /* <SQL> */
767
768<xd>{xdstop} {
772
773
774
775
776
777
778
779
780
782 return CSTRING;
783 }
784<xdc>{xdstop} {
787 return CSTRING;
788 }
789<xui>{dquote} {
793
794
795
796
797
799 return UIDENT;
800 }
801<xd,xui>{xddouble} {
803 }
804<xd,xui>{xdinside} {
806 }
807<xd,xui><<EOF>> {
809 }
810<C>{xdstart} {
812 BEGIN(xdc);
814 }
815<xdc>{xdcinside} {
817 }
818<xdc><<EOF>> {
820 }
821
822<SQL>{
823{typecast} {
824 return TYPECAST;
825 }
826
827{dot_dot} {
828 return DOT_DOT;
829 }
830
831{colon_equals} {
832 return COLON_EQUALS;
833 }
834
835{equals_greater} {
836 return EQUALS_GREATER;
837 }
838
839{less_equals} {
840 return LESS_EQUALS;
841 }
842
843{greater_equals} {
844 return GREATER_EQUALS;
845 }
846
847{less_greater} {
848
849 return NOT_EQUALS;
850 }
851
852{not_equals} {
853
854 return NOT_EQUALS;
855 }
856
857{informix_special} {
858
860 {
861 unput(':');
862 }
863 else
864 return yytext[0];
865 }
866
867{self} {
868
869
870
871
873 BEGIN(C);
874 return yytext[0];
875 }
876
877{operator} {
878
879
880
881
882
883
885 char *slashstar = strstr(yytext, "/*");
886 char *dashdash = strstr(yytext, "--");
887
888 if (slashstar && dashdash)
889 {
890
891 if (slashstar > dashdash)
892 slashstar = dashdash;
893 }
894 else if (!slashstar)
895 slashstar = dashdash;
896 if (slashstar)
897 nchars = slashstar - yytext;
898
899
900
901
902
903
904
905
906
907 if (nchars > 1 &&
908 (yytext[nchars - 1] == '+' ||
909 yytext[nchars - 1] == '-'))
910 {
911 int ic;
912
913 for (ic = nchars - 2; ic >= 0; ic--)
914 {
916
917 if (
c ==
'~' ||
c ==
'!' ||
c ==
'@' ||
918 c ==
'#' ||
c ==
'^' ||
c ==
'&' ||
919 c ==
'|' ||
c ==
'`' ||
c ==
'?' ||
921 break;
922 }
923 if (ic < 0)
924 {
925
926
927
928
929 do
930 {
931 nchars--;
932 } while (nchars > 1 &&
933 (yytext[nchars - 1] == '+' ||
934 yytext[nchars - 1] == '-'));
935 }
936 }
937
939 {
940
941 yyless(nchars);
942
943
944
945
946
947
948
949 if (nchars == 1 &&
950 strchr(",()[].;:+-*/%^<>=", yytext[0]))
951 return yytext[0];
952
953
954
955
956
957
958
959 if (nchars == 2)
960 {
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] == '=')
966 return LESS_EQUALS;
967 if (yytext[0] == '<' && yytext[1] == '>')
968 return NOT_EQUALS;
969 if (yytext[0] == '!' && yytext[1] == '=')
970 return NOT_EQUALS;
971 }
972 }
973
975 return Op;
976 }
977
978{param} {
980
981 errno = 0;
983 if (errno == ERANGE)
986 return PARAM;
987 }
988{param_junk} {
990 }
991
992{ip} {
995 }
996} /* <SQL> */
997
998<C,SQL>{
999{decinteger} {
1001 }
static int process_integer_literal(const char *token, YYSTYPE *lval, int base)
1002{hexinteger} {
1004 }
1005{numeric} {
1007 return FCONST;
1008 }
1009{numericfail} {
1010
1013 }
1014{real} {
1016 return FCONST;
1017 }
1018{realfail} {
1019
1020
1021
1022
1025 }
1026} /* <C,SQL> */
1027
1028<SQL>{
1029{octinteger} {
1031 }
1032{bininteger} {
1034 }
1035
1036
1037
1038
1039
1040{integer_junk} {
1042 }
1043{numeric_junk} {
1045 }
1046{real_junk} {
1048 }
1049
1050:{identifier}((("->"|\.){identifier})|(\[{array}\]))* {
1052 return CVARIABLE;
1053 }
1054
1055{identifier} {
1056
1058 {
1059 int kwvalue;
static bool isdefine(void)
1060
1061
1062
1063
1064
1065
1066
1068 {
1069
1071 if (kwvalue >= 0)
1072 return kwvalue;
1073 }
int ScanECPGKeywordLookup(const char *text)
struct typedefs * get_typedef(const char *name, bool noerror)
1074
1075
1077 if (kwvalue >= 0)
1078 return kwvalue;
int ScanCKeywordLookup(const char *text)
1079
1080
1081
1082
1083
1084
1085
1086
1087
1089 return IDENT;
1090 }
1091 }
1092
1093{other} {
1094 return yytext[0];
1095 }
1096} /* <SQL> */
1097
1098
1099
1100
1101
1102<C>{exec_sql} {
1103 BEGIN(SQL);
1104 return SQL_START;
1105 }
1106<C>{informix_special} {
1107
1109 {
1110 BEGIN(SQL);
1111 return SQL_START;
1112 }
1113 else
1114 return S_ANYTHING;
1115 }
1116<C>{ccomment} {
1118 }
1119<C>{cppinclude} {
1121 {
1123 BEGIN(incl);
1124 }
1125 else
1126 {
1128 return CPP_LINE;
1129 }
1130 }
1131<C>{cppinclude_next} {
1133 {
1135 BEGIN(incl);
1136 }
1137 else
1138 {
1140 return CPP_LINE;
1141 }
1142 }
1143<C,SQL>{cppline} {
1145 return CPP_LINE;
1146 }
1147<C>{identifier} {
1148
1149
1150
1151
1152
1154 {
1158 }
1159
1160
1162 {
1163 int kwvalue;
static bool isinformixdefine(void)
1164
1166 if (kwvalue >= 0)
1167 return kwvalue;
1168 else
1169 {
1171 return IDENT;
1172 }
1173 }
1174 }
1175<C>{xcstop} {
1177 }
1178<C>":" { return ':'; }
1179<C>";" { return ';'; }
1180<C>"," { return ','; }
1181<C>"*" { return '*'; }
1182<C>"%" { return '%'; }
1183<C>"/" { return '/'; }
1184<C>"+" { return '+'; }
1185<C>"-" { return '-'; }
1186<C>"(" { parenths_open++; return '('; }
1187<C>")" { parenths_open--; 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}* {
1213
1215 {
1216 BEGIN(def_ident);
1217 }
1218 else
1219 {
1220 yyless(1);
1221 return S_ANYTHING;
1222 }
1223 }
1224<C>{exec_sql}{undef}{space}* {
1225 BEGIN(undef);
1226 }
1227<C>{informix_special}{undef}{space}* {
1228
1230 {
1231 BEGIN(undef);
1232 }
1233 else
1234 {
1235 yyless(1);
1236 return S_ANYTHING;
1237 }
1238 }
1239<undef>{identifier}{space}*";" {
1241 *ptr2 = NULL;
1243
1244
1245
1246
1247
1248 for (
i = strlen(yytext) - 2;
1251 ;
1252 yytext[
i + 1] =
'\0';
1253
1254
1255 for (ptr =
defines; ptr; ptr2 = ptr, ptr = ptr->
next)
1256 {
1257 if (strcmp(yytext, ptr->name) == 0)
1258 {
1260 ptr->value = NULL;
1261
1262 if (ptr->cmdvalue == NULL)
1263 {
1264 if (ptr2 == NULL)
1266 else
1270 }
1271 break;
1272 }
1273 }
1274
1275 BEGIN(C);
1276 }
1277<undef>{other}|\n {
1279 yyterminate();
1280 }
1281<C>{exec_sql}{include}{space}* {
1282 BEGIN(incl);
1283 }
1284<C>{informix_special}{include}{space}* {
1285
1287 {
1288 BEGIN(incl);
1289 }
1290 else
1291 {
1292 yyless(1);
1293 return S_ANYTHING;
1294 }
1295 }
1296<C,xskip>{exec_sql}{ifdef}{space}* {
1304 BEGIN(xcond);
1305 }
1306<C,xskip>{informix_special}{ifdef}{space}* {
1307
1309 {
1317 BEGIN(xcond);
1318 }
1319 else
1320 {
1321 yyless(1);
1322 return S_ANYTHING;
1323 }
1324 }
1325<C,xskip>{exec_sql}{ifndef}{space}* {
1333 BEGIN(xcond);
1334 }
1335<C,xskip>{informix_special}{ifndef}{space}* {
1336
1338 {
1346 BEGIN(xcond);
1347 }
1348 else
1349 {
1350 yyless(1);
1351 return S_ANYTHING;
1352 }
1353 }
1354<C,xskip>{exec_sql}{elif}{space}* {
1360 BEGIN(xcond);
1361 }
1362<C,xskip>{informix_special}{elif}{space}* {
1363
1365 {
1371 BEGIN(xcond);
1372 }
1373 else
1374 {
1375 yyless(1);
1376 return S_ANYTHING;
1377 }
1378 }
1379
1380<C,xskip>{exec_sql}{else}{space}*";" {
1381
1386 else
1387 {
1393
1395 BEGIN(C);
1396 else
1397 BEGIN(xskip);
1398 }
1399 }
1400<C,xskip>{informix_special}{else}{space}*";" {
1401
1403 {
1408 else
1409 {
1415
1417 BEGIN(C);
1418 else
1419 BEGIN(xskip);
1420 }
1421 }
1422 else
1423 {
1424 yyless(1);
1425 return S_ANYTHING;
1426 }
1427 }
1428<C,xskip>{exec_sql}{endif}{space}*";" {
1431 else
1433
1435 BEGIN(C);
1436 else
1437 BEGIN(xskip);
1438 }
1439<C,xskip>{informix_special}{endif}{space}*";" {
1440
1442 {
1445 else
1447
1449 BEGIN(C);
1450 else
1451 BEGIN(xskip);
1452 }
1453 else
1454 {
1455 yyless(1);
1456 return S_ANYTHING;
1457 }
1458 }
1459
1460<xskip>{other} { /* ignore */ }
1461
1462<xcond>{identifier}{space}*";" {
1463 {
1466 bool this_active;
1467
1468
1469
1470
1471
1472
1473 for (
i = strlen(yytext) - 2;
1476 ;
1477 yytext[
i + 1] =
'\0';
1478
1479
1480 for (defptr =
defines; defptr; defptr = defptr->
next)
1481 {
1482 if (strcmp(yytext, defptr->
name) == 0)
1483 {
1484
1485 if (defptr->
value == NULL)
1486 defptr = NULL;
1487 break;
1488 }
1489 }
1490
1495 this_active);
1497 }
1498
1500 BEGIN(C);
1501 else
1502 BEGIN(xskip);
1503 }
1504
1505<xcond>{other}|\n {
1507 yyterminate();
1508 }
1509<def_ident>{identifier} {
1511 BEGIN(def);
1513 }
1514<def_ident>{other}|\n {
1516 yyterminate();
1517 }
1518<def>{space}*";" {
1520
1521
1523 {
1524 if (strcmp(newdefsymbol, ptr->
name) == 0)
1525 {
1528
1530 break;
1531 }
1532 }
1533 if (ptr == NULL)
1534 {
1535
1537
1538 ptr->
name = newdefsymbol;
1544 }
1545
1546 BEGIN(C);
1547 }
1548<def>[^;] { addlit(yytext, yyleng); }
1549<incl><[^>]+>{space}*";"? { parse_include(); }
1550<incl>{dquote}{xdinside}{dquote}{space}*";"? { parse_include(); }
1551<incl>[^;<>\"]+";" { parse_include(); }
1552<incl>{other}|\n {
1554 yyterminate();
1555 }
1556
1557<<EOF>> {
1559 {
1560
1562 {
1565 }
1566 yyterminate();
1567 }
1568 else
1569 {
1570
1574
1575
1577 {
1579 {
1581 break;
1582 }
1583 }
1584
1585 if (yyin != NULL)
1586 fclose(yyin);
1587
1588 yy_delete_buffer(YY_CURRENT_BUFFER);
1590
1592
1593
1595
1598
1601
1604 }
1605 }
1606
1607<INITIAL>{other}|\n {
1608 mmfatal(
PARSE_ERROR,
"internal error: unreachable state; please report this to <%s>", PACKAGE_BUGREPORT);
1609 }
1610
1611%%