LCOV - code coverage report
Current view: top level - src/interfaces/ecpg/preproc - pgc.l (source / functions) Hit Total Coverage
Test: PostgreSQL 16devel Lines: 97 126 77.0 %
Date: 2022-08-17 03:10:30 Functions: 7 8 87.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : %top{
       2             : /*-------------------------------------------------------------------------
       3             :  *
       4             :  * pgc.l
       5             :  *    lexical scanner for ecpg
       6             :  *
       7             :  * This is a modified version of src/backend/parser/scan.l
       8             :  *
       9             :  * The ecpg scanner is not backup-free, so the fail rules are
      10             :  * only here to simplify syncing this file with scan.l.
      11             :  *
      12             :  *
      13             :  * Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
      14             :  * Portions Copyright (c) 1994, Regents of the University of California
      15             :  *
      16             :  * IDENTIFICATION
      17             :  *    src/interfaces/ecpg/preproc/pgc.l
      18             :  *
      19             :  *-------------------------------------------------------------------------
      20             :  */
      21             : #include "postgres_fe.h"
      22             : 
      23             : #include <ctype.h>
      24             : #include <limits.h>
      25             : 
      26             : #include "common/string.h"
      27             : 
      28             : #include "preproc_extern.h"
      29             : #include "preproc.h"
      30             : }
      31             : 
      32             : %{
      33             : 
      34             : /* LCOV_EXCL_START */
      35             : 
      36             : extern YYSTYPE base_yylval;
      37             : 
      38             : static int      xcdepth = 0;    /* depth of nesting in slash-star comments */
      39             : static char    *dolqstart = NULL;   /* current $foo$ quote start string */
      40             : 
      41             : /*
      42             :  * literalbuf is used to accumulate literal values when multiple rules
      43             :  * are needed to parse a single literal.  Call startlit to reset buffer
      44             :  * to empty, addlit to add text.  Note that the buffer is permanently
      45             :  * malloc'd to the largest size needed so far in the current run.
      46             :  */
      47             : static char    *literalbuf = NULL;      /* expandable buffer */
      48             : static int      literallen;             /* actual current length */
      49             : static int      literalalloc;           /* current allocated buffer size */
      50             : 
      51             : /* Used for detecting global state together with braces_open */
      52             : static int      parenths_open;
      53             : 
      54             : /* Used to tell parse_include() whether the command was #include or #include_next */
      55             : static bool     include_next;
      56             : 
      57             : #define startlit()  (literalbuf[0] = '\0', literallen = 0)
      58             : static void addlit(char *ytext, int yleng);
      59             : static void addlitchar(unsigned char);
      60             : static int  process_integer_literal(const char *token, YYSTYPE *lval);
      61             : static void parse_include(void);
      62             : static bool ecpg_isspace(char ch);
      63             : static bool isdefine(void);
      64             : static bool isinformixdefine(void);
      65             : 
      66             : char *token_start;
      67             : 
      68             : /* vars to keep track of start conditions when scanning literals */
      69             : static int state_before_str_start;
      70             : static int state_before_str_stop;
      71             : 
      72             : struct _yy_buffer
      73             : {
      74             :     YY_BUFFER_STATE     buffer;
      75             :     long                lineno;
      76             :     char               *filename;
      77             :     struct _yy_buffer  *next;
      78             : } *yy_buffer = NULL;
      79             : 
      80             : static char *old;
      81             : 
      82             : /*
      83             :  * Vars for handling ifdef/elif/endif constructs.  preproc_tos is the current
      84             :  * nesting depth of such constructs, and stacked_if_value[preproc_tos] is the
      85             :  * state for the innermost level.  (For convenience, stacked_if_value[0] is
      86             :  * initialized as though we are in the active branch of some outermost IF.)
      87             :  * The active field is true if the current branch is active (being expanded).
      88             :  * The saw_active field is true if we have found any successful branch,
      89             :  * so that all subsequent branches of this level should be skipped.
      90             :  * The else_branch field is true if we've found an 'else' (so that another
      91             :  * 'else' or 'elif' at this level is an error.)
      92             :  * For IFs nested within an inactive branch, all branches always have active
      93             :  * set to false, but saw_active and else_branch are maintained normally.
      94             :  * ifcond is valid only while evaluating an if-condition; it's true if we
      95             :  * are doing ifdef, false if ifndef.
      96             :  */
      97             : #define MAX_NESTED_IF 128
      98             : static short preproc_tos;
      99             : static bool ifcond;
     100             : static struct _if_value
     101             : {
     102             :     bool        active;
     103             :     bool        saw_active;
     104             :     bool        else_branch;
     105             : } stacked_if_value[MAX_NESTED_IF];
     106             : 
     107             : %}
     108             : 
     109             : %option 8bit
     110             : %option never-interactive
     111             : %option nodefault
     112             : %option noinput
     113             : %option noyywrap
     114             : %option warn
     115             : %option yylineno
     116             : %option prefix="base_yy"
     117             : 
     118             : /*
     119             :  * OK, here is a short description of lex/flex rules behavior.
     120             :  * The longest pattern which matches an input string is always chosen.
     121             :  * For equal-length patterns, the first occurring in the rules list is chosen.
     122             :  * INITIAL is the starting state, to which all non-conditional rules apply.
     123             :  * Exclusive states change parsing rules while the state is active.  When in
     124             :  * an exclusive state, only those rules defined for that state apply.
     125             :  *
     126             :  * We use exclusive states for quoted strings, extended comments,
     127             :  * and to eliminate parsing troubles for numeric strings.
     128             :  * Exclusive states:
     129             :  *  <xb> bit string literal
     130             :  *  <xc> extended C-style comments
     131             :  *  <xd> delimited identifiers (double-quoted identifiers)
     132             :  *  <xdc> double-quoted strings in C
     133             :  *  <xh> hexadecimal byte string
     134             :  *  <xn> national character quoted strings
     135             :  *  <xq> standard quoted strings
     136             :  *  <xqs> quote stop (detect continued strings)
     137             :  *  <xe> extended quoted strings (support backslash escape sequences)
     138             :  *  <xqc> single-quoted strings in C
     139             :  *  <xdolq> $foo$ quoted strings
     140             :  *  <xui> quoted identifier with Unicode escapes
     141             :  *  <xus> quoted string with Unicode escapes
     142             :  *  <xcond> condition of an EXEC SQL IFDEF construct
     143             :  *  <xskip> skipping the inactive part of an EXEC SQL IFDEF construct
     144             :  *
     145             :  * Note: we intentionally don't mimic the backend's <xeu> state; we have
     146             :  * no need to distinguish it from <xe> state.
     147             :  *
     148             :  * Remember to add an <<EOF>> case whenever you add a new exclusive state!
     149             :  * The default one is probably not the right thing.
     150             :  */
     151             : 
     152             : %x xb
     153             : %x xc
     154             : %x xd
     155             : %x xdc
     156             : %x xh
     157             : %x xn
     158             : %x xq
     159             : %x xqs
     160             : %x xe
     161             : %x xqc
     162             : %x xdolq
     163             : %x xui
     164             : %x xus
     165             : %x xcond
     166             : %x xskip
     167             : 
     168             : /* Additional exclusive states that are specific to ECPG */
     169             : %x C SQL incl def def_ident undef
     170             : 
     171             : /*
     172             :  * In order to make the world safe for Windows and Mac clients as well as
     173             :  * Unix ones, we accept either \n or \r as a newline.  A DOS-style \r\n
     174             :  * sequence will be seen as two successive newlines, but that doesn't cause
     175             :  * any problems.  SQL-style comments, which start with -- and extend to the
     176             :  * next newline, are treated as equivalent to a single whitespace character.
     177             :  *
     178             :  * NOTE a fine point: if there is no newline following --, we will absorb
     179             :  * everything to the end of the input as a comment.  This is correct.  Older
     180             :  * versions of Postgres failed to recognize -- as a comment if the input
     181             :  * did not end with a newline.
     182             :  *
     183             :  * XXX perhaps \f (formfeed) should be treated as a newline as well?
     184             :  *
     185             :  * XXX if you change the set of whitespace characters, fix ecpg_isspace()
     186             :  * to agree.
     187             :  */
     188             : 
     189             : space           [ \t\n\r\f]
     190             : horiz_space     [ \t\f]
     191             : newline         [\n\r]
     192             : non_newline     [^\n\r]
     193             : 
     194             : comment         ("--"{non_newline}*)
     195             : 
     196             : whitespace      ({space}+|{comment})
     197             : 
     198             : /*
     199             :  * SQL requires at least one newline in the whitespace separating
     200             :  * string literals that are to be concatenated.  Silly, but who are we
     201             :  * to argue?  Note that {whitespace_with_newline} should not have * after
     202             :  * it, whereas {whitespace} should generally have a * after it...
     203             :  */
     204             : 
     205             : horiz_whitespace        ({horiz_space}|{comment})
     206             : whitespace_with_newline ({horiz_whitespace}*{newline}{whitespace}*)
     207             : 
     208             : quote           '
     209             : /* If we see {quote} then {quotecontinue}, the quoted string continues */
     210             : quotecontinue   {whitespace_with_newline}{quote}
     211             : 
     212             : /*
     213             :  * {quotecontinuefail} is needed to avoid lexer backup when we fail to match
     214             :  * {quotecontinue}.  It might seem that this could just be {whitespace}*,
     215             :  * but if there's a dash after {whitespace_with_newline}, it must be consumed
     216             :  * to see if there's another dash --- which would start a {comment} and thus
     217             :  * allow continuation of the {quotecontinue} token.
     218             :  */
     219             : quotecontinuefail   {whitespace}*"-"?
     220             : 
     221             : /* Bit string
     222             :  */
     223             : xbstart         [bB]{quote}
     224             : xbinside        [^']*
     225             : 
     226             : /* Hexadecimal byte string */
     227             : xhstart         [xX]{quote}
     228             : xhinside        [^']*
     229             : 
     230             : /* National character */
     231             : xnstart         [nN]{quote}
     232             : 
     233             : /* Quoted string that allows backslash escapes */
     234             : xestart         [eE]{quote}
     235             : xeinside        [^\\']+
     236             : xeescape        [\\][^0-7]
     237             : xeoctesc        [\\][0-7]{1,3}
     238             : xehexesc        [\\]x[0-9A-Fa-f]{1,2}
     239             : xeunicode       [\\](u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})
     240             : 
     241             : /* Extended quote
     242             :  * xqdouble implements embedded quote, ''''
     243             :  */
     244             : xqstart         {quote}
     245             : xqdouble        {quote}{quote}
     246             : xqcquote        [\\]{quote}
     247             : xqinside        [^']+
     248             : 
     249             : /* $foo$ style quotes ("dollar quoting")
     250             :  * The quoted string starts with $foo$ where "foo" is an optional string
     251             :  * in the form of an identifier, except that it may not contain "$",
     252             :  * and extends to the first occurrence of an identical string.
     253             :  * There is *no* processing of the quoted text.
     254             :  *
     255             :  * {dolqfailed} is an error rule to avoid scanner backup when {dolqdelim}
     256             :  * fails to match its trailing "$".
     257             :  */
     258             : dolq_start      [A-Za-z\200-\377_]
     259             : dolq_cont       [A-Za-z\200-\377_0-9]
     260             : dolqdelim       \$({dolq_start}{dolq_cont}*)?\$
     261             : dolqfailed      \${dolq_start}{dolq_cont}*
     262             : dolqinside      [^$]+
     263             : 
     264             : /* Double quote
     265             :  * Allows embedded spaces and other special characters into identifiers.
     266             :  */
     267             : dquote          \"
     268             : xdstart         {dquote}
     269             : xdstop          {dquote}
     270             : xddouble        {dquote}{dquote}
     271             : xdinside        [^"]+
     272             : 
     273             : /* Quoted identifier with Unicode escapes */
     274             : xuistart        [uU]&{dquote}
     275             : 
     276             : /* Quoted string with Unicode escapes */
     277             : xusstart        [uU]&{quote}
     278             : 
     279             : /* special stuff for C strings */
     280             : xdcqq           \\\\
     281             : xdcqdq          \\\"
     282             : xdcother        [^"]
     283             : xdcinside       ({xdcqq}|{xdcqdq}|{xdcother})
     284             : 
     285             : 
     286             : /* C-style comments
     287             :  *
     288             :  * The "extended comment" syntax closely resembles allowable operator syntax.
     289             :  * The tricky part here is to get lex to recognize a string starting with
     290             :  * slash-star as a comment, when interpreting it as an operator would produce
     291             :  * a longer match --- remember lex will prefer a longer match!  Also, if we
     292             :  * have something like plus-slash-star, lex will think this is a 3-character
     293             :  * operator whereas we want to see it as a + operator and a comment start.
     294             :  * The solution is two-fold:
     295             :  * 1. append {op_chars}* to xcstart so that it matches as much text as
     296             :  *    {operator} would. Then the tie-breaker (first matching rule of same
     297             :  *    length) ensures xcstart wins.  We put back the extra stuff with yyless()
     298             :  *    in case it contains a star-slash that should terminate the comment.
     299             :  * 2. In the operator rule, check for slash-star within the operator, and
     300             :  *    if found throw it back with yyless().  This handles the plus-slash-star
     301             :  *    problem.
     302             :  * Dash-dash comments have similar interactions with the operator rule.
     303             :  */
     304             : xcstart         \/\*{op_chars}*
     305             : xcstop          \*+\/
     306             : xcinside        [^*/]+
     307             : 
     308             : ident_start     [A-Za-z\200-\377_]
     309             : ident_cont      [A-Za-z\200-\377_0-9\$]
     310             : 
     311             : identifier      {ident_start}{ident_cont}*
     312             : 
     313             : array           ({ident_cont}|{whitespace}|[\[\]\+\-\*\%\/\(\)\>\.])*
     314             : 
     315             : /* Assorted special-case operators and operator-like tokens */
     316             : typecast        "::"
     317             : dot_dot         \.\.
     318             : colon_equals    ":="
     319             : 
     320             : /*
     321             :  * These operator-like tokens (unlike the above ones) also match the {operator}
     322             :  * rule, which means that they might be overridden by a longer match if they
     323             :  * are followed by a comment start or a + or - character. Accordingly, if you
     324             :  * add to this list, you must also add corresponding code to the {operator}
     325             :  * block to return the correct token in such cases. (This is not needed in
     326             :  * psqlscan.l since the token value is ignored there.)
     327             :  */
     328             : equals_greater  "=>"
     329             : less_equals     "<="
     330             : greater_equals  ">="
     331             : less_greater    "<>"
     332             : not_equals      "!="
     333             : 
     334             : /*
     335             :  * "self" is the set of chars that should be returned as single-character
     336             :  * tokens.  "op_chars" is the set of chars that can make up "Op" tokens,
     337             :  * which can be one or more characters long (but if a single-char token
     338             :  * appears in the "self" set, it is not to be returned as an Op).  Note
     339             :  * that the sets overlap, but each has some chars that are not in the other.
     340             :  *
     341             :  * If you change either set, adjust the character lists appearing in the
     342             :  * rule for "operator"!
     343             :  */
     344             : self            [,()\[\].;\:\+\-\*\/\%\^\<\>\=]
     345             : op_chars        [\~\!\@\#\^\&\|\`\?\+\-\*\/\%\<\>\=]
     346             : operator        {op_chars}+
     347             : 
     348             : /*
     349             :  * Numbers
     350             :  *
     351             :  * Unary minus is not part of a number here.  Instead we pass it separately to
     352             :  * the parser, and there it gets coerced via doNegate().
     353             :  *
     354             :  * {decimalfail} is used because we would like "1..10" to lex as 1, dot_dot, 10.
     355             :  *
     356             :  * {realfail} is added to prevent the need for scanner
     357             :  * backup when the {real} rule fails to match completely.
     358             :  */
     359             : digit           [0-9]
     360             : 
     361             : integer         {digit}+
     362             : decimal         (({digit}*\.{digit}+)|({digit}+\.{digit}*))
     363             : decimalfail     {digit}+\.\.
     364             : real            ({integer}|{decimal})[Ee][-+]?{digit}+
     365             : realfail        ({integer}|{decimal})[Ee][-+]
     366             : 
     367             : integer_junk    {integer}{ident_start}
     368             : decimal_junk    {decimal}{ident_start}
     369             : real_junk       {real}{ident_start}
     370             : 
     371             : param           \${integer}
     372             : param_junk      \${integer}{ident_start}
     373             : 
     374             : /* special characters for other dbms */
     375             : /* we have to react differently in compat mode */
     376             : informix_special    [\$]
     377             : 
     378             : other           .
     379             : 
     380             : /*
     381             :  * Dollar quoted strings are totally opaque, and no escaping is done on them.
     382             :  * Other quoted strings must allow some special characters such as single-quote
     383             :  *  and newline.
     384             :  * Embedded single-quotes are implemented both in the SQL standard
     385             :  *  style of two adjacent single quotes "''" and in the Postgres/Java style
     386             :  *  of escaped-quote "\'".
     387             :  * Other embedded escaped characters are matched explicitly and the leading
     388             :  *  backslash is dropped from the string.
     389             :  * Note that xcstart must appear before operator, as explained above!
     390             :  *  Also whitespace (comment) must appear before operator.
     391             :  */
     392             : 
     393             : /* some stuff needed for ecpg */
     394             : exec            [eE][xX][eE][cC]
     395             : sql             [sS][qQ][lL]
     396             : define          [dD][eE][fF][iI][nN][eE]
     397             : include         [iI][nN][cC][lL][uU][dD][eE]
     398             : include_next    [iI][nN][cC][lL][uU][dD][eE]_[nN][eE][xX][tT]
     399             : import          [iI][mM][pP][oO][rR][tT]
     400             : undef           [uU][nN][dD][eE][fF]
     401             : 
     402             : /* C version of hex number */
     403             : xch             0[xX][0-9A-Fa-f]*
     404             : 
     405             : ccomment        "//".*\n
     406             : 
     407             : if              [iI][fF]
     408             : ifdef           [iI][fF][dD][eE][fF]
     409             : ifndef          [iI][fF][nN][dD][eE][fF]
     410             : else            [eE][lL][sS][eE]
     411             : elif            [eE][lL][iI][fF]
     412             : endif           [eE][nN][dD][iI][fF]
     413             : 
     414             : struct          [sS][tT][rR][uU][cC][tT]
     415             : 
     416             : exec_sql        {exec}{space}*{sql}{space}*
     417             : ipdigit         ({digit}|{digit}{digit}|{digit}{digit}{digit})
     418             : ip              {ipdigit}\.{ipdigit}\.{ipdigit}\.{ipdigit}
     419             : 
     420             : /* we might want to parse all cpp include files */
     421             : cppinclude      {space}*#{include}{space}*
     422             : cppinclude_next     {space}*#{include_next}{space}*
     423             : 
     424             : /* take care of cpp lines, they may also be continued */
     425             : /* first a general line for all commands not starting with "i" */
     426             : /* and then the other commands starting with "i", we have to add these
     427             :  * separately because the cppline production would match on "include" too
     428             :  */
     429             : cppline         {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+\/)|.|\\{space}*{newline})*{newline}
     430             : 
     431             : %%
     432             : 
     433             : %{
     434             :         /* code to execute during start of each call of yylex() */
     435             :         token_start = NULL;
     436             : %}
     437             : 
     438             : <SQL>{
     439             : {whitespace}    {
     440             :                     /* ignore */
     441             :                 }
     442             : } /* <SQL> */
     443             : 
     444             : <C,SQL>{
     445             : {xcstart}       {
     446             :                     token_start = yytext;
     447             :                     state_before_str_start = YYSTATE;
     448             :                     xcdepth = 0;
     449             :                     BEGIN(xc);
     450             :                     /* Put back any characters past slash-star; see above */
     451             :                     yyless(2);
     452             :                     fputs("/*", yyout);
     453             :                 }
     454             : } /* <C,SQL> */
     455             : 
     456             : <xc>{
     457             : {xcstart}       {
     458             :                     if (state_before_str_start == SQL)
     459             :                     {
     460             :                         xcdepth++;
     461             :                         /* Put back any characters past slash-star; see above */
     462             :                         yyless(2);
     463             :                         fputs("/_*", yyout);
     464             :                     }
     465             :                     else if (state_before_str_start == C)
     466             :                     {
     467             :                         ECHO;
     468             :                     }
     469             :                 }
     470             : 
     471             : {xcstop}        {
     472             :                     if (state_before_str_start == SQL)
     473             :                     {
     474             :                         if (xcdepth <= 0)
     475             :                         {
     476             :                             ECHO;
     477             :                             BEGIN(SQL);
     478             :                             token_start = NULL;
     479             :                         }
     480             :                         else
     481             :                         {
     482             :                             xcdepth--;
     483             :                             fputs("*_/", yyout);
     484             :                         }
     485             :                     }
     486             :                     else if (state_before_str_start == C)
     487             :                     {
     488             :                         ECHO;
     489             :                         BEGIN(C);
     490             :                         token_start = NULL;
     491             :                     }
     492             :                 }
     493             : 
     494             : {xcinside}      {
     495             :                     ECHO;
     496             :                 }
     497             : 
     498             : {op_chars}      {
     499             :                     ECHO;
     500             :                 }
     501             : 
     502             : \*+             {
     503             :                     ECHO;
     504             :                 }
     505             : 
     506             : <<EOF>>         {
     507             :                     mmfatal(PARSE_ERROR, "unterminated /* comment");
     508             :                 }
     509             : } /* <xc> */
     510             : 
     511             : <SQL>{
     512             : {xbstart}       {
     513             :                     token_start = yytext;
     514             :                     state_before_str_start = YYSTATE;
     515             :                     BEGIN(xb);
     516             :                     startlit();
     517             :                 }
     518             : } /* <SQL> */
     519             : 
     520             : <xh>{xhinside}    |
     521             : <xb>{xbinside}    {
     522             :                     addlit(yytext, yyleng);
     523             :                 }
     524             : <xb><<EOF>>       { mmfatal(PARSE_ERROR, "unterminated bit string literal"); }
     525             : 
     526             : <SQL>{xhstart}    {
     527             :                     token_start = yytext;
     528             :                     state_before_str_start = YYSTATE;
     529             :                     BEGIN(xh);
     530             :                     startlit();
     531             :                 }
     532             : <xh><<EOF>>       { mmfatal(PARSE_ERROR, "unterminated hexadecimal string literal"); }
     533             : 
     534             : <C>{xqstart}  {
     535             :                     token_start = yytext;
     536             :                     state_before_str_start = YYSTATE;
     537             :                     BEGIN(xqc);
     538             :                     startlit();
     539             :                 }
     540             : 
     541             : <SQL>{
     542             : {xnstart}       {
     543             :                     /* National character.
     544             :                      * Transfer it as-is to the backend.
     545             :                      */
     546             :                     token_start = yytext;
     547             :                     state_before_str_start = YYSTATE;
     548             :                     BEGIN(xn);
     549             :                     startlit();
     550             :                 }
     551             : 
     552             : {xqstart}       {
     553             :                     token_start = yytext;
     554             :                     state_before_str_start = YYSTATE;
     555             :                     BEGIN(xq);
     556             :                     startlit();
     557             :                 }
     558             : {xestart}       {
     559             :                     token_start = yytext;
     560             :                     state_before_str_start = YYSTATE;
     561             :                     BEGIN(xe);
     562             :                     startlit();
     563             :                 }
     564             : {xusstart}      {
     565             :                     token_start = yytext;
     566             :                     state_before_str_start = YYSTATE;
     567             :                     BEGIN(xus);
     568             :                     startlit();
     569             :                 }
     570             : } /* <SQL> */
     571             : 
     572             : <xb,xh,xq,xqc,xe,xn,xus>{quote} {
     573             :                     /*
     574             :                      * When we are scanning a quoted string and see an end
     575             :                      * quote, we must look ahead for a possible continuation.
     576             :                      * If we don't see one, we know the end quote was in fact
     577             :                      * the end of the string.  To reduce the lexer table size,
     578             :                      * we use a single "xqs" state to do the lookahead for all
     579             :                      * types of strings.
     580             :                      */
     581             :                     state_before_str_stop = YYSTATE;
     582             :                     BEGIN(xqs);
     583             :                 }
     584             : <xqs>{quotecontinue} {
     585             :                     /*
     586             :                      * Found a quote continuation, so return to the in-quote
     587             :                      * state and continue scanning the literal.  Nothing is
     588             :                      * added to the literal's contents.
     589             :                      */
     590             :                     BEGIN(state_before_str_stop);
     591             :                 }
     592             : <xqs>{quotecontinuefail} |
     593             : <xqs>{other} |
     594             : <xqs><<EOF>>  {
     595             :                     /*
     596             :                      * Failed to see a quote continuation.  Throw back
     597             :                      * everything after the end quote, and handle the string
     598             :                      * according to the state we were in previously.
     599             :                      */
     600             :                     yyless(0);
     601             :                     BEGIN(state_before_str_start);
     602             : 
     603             :                     switch (state_before_str_stop)
     604             :                     {
     605             :                         case xb:
     606             :                             if (literalbuf[strspn(literalbuf, "01")] != '\0')
     607             :                                 mmerror(PARSE_ERROR, ET_ERROR, "invalid bit string literal");
     608             :                             base_yylval.str = psprintf("b'%s'", literalbuf);
     609             :                             return BCONST;
     610             :                         case xh:
     611             :                             if (literalbuf[strspn(literalbuf, "0123456789abcdefABCDEF")] != '\0')
     612             :                                 mmerror(PARSE_ERROR, ET_ERROR, "invalid hexadecimal string literal");
     613             :                             base_yylval.str = psprintf("x'%s'", literalbuf);
     614             :                             return XCONST;
     615             :                         case xq:
     616             :                             /* fallthrough */
     617             :                         case xqc:
     618             :                             base_yylval.str = psprintf("'%s'", literalbuf);
     619             :                             return SCONST;
     620             :                         case xe:
     621             :                             base_yylval.str = psprintf("E'%s'", literalbuf);
     622             :                             return SCONST;
     623             :                         case xn:
     624             :                             base_yylval.str = psprintf("N'%s'", literalbuf);
     625             :                             return SCONST;
     626             :                         case xus:
     627             :                             base_yylval.str = psprintf("U&'%s'", literalbuf);
     628             :                             return USCONST;
     629             :                         default:
     630             :                             mmfatal(PARSE_ERROR, "unhandled previous state in xqs\n");
     631             :                     }
     632             :                 }
     633             : 
     634             : <xq,xe,xn,xus>{xqdouble}  { addlit(yytext, yyleng); }
     635             : <xqc>{xqcquote}               { addlit(yytext, yyleng); }
     636             : <xq,xqc,xn,xus>{xqinside} { addlit(yytext, yyleng); }
     637             : <xe>{xeinside}  {
     638             :                     addlit(yytext, yyleng);
     639             :                 }
     640             : <xe>{xeunicode} {
     641             :                     addlit(yytext, yyleng);
     642             :                 }
     643             : <xe>{xeescape}  {
     644             :                     addlit(yytext, yyleng);
     645             :                 }
     646             : <xe>{xeoctesc}  {
     647             :                     addlit(yytext, yyleng);
     648             :                 }
     649             : <xe>{xehexesc}  {
     650             :                     addlit(yytext, yyleng);
     651             :                 }
     652             : <xe>.         {
     653             :                     /* This is only needed for \ just before EOF */
     654             :                     addlitchar(yytext[0]);
     655             :                 }
     656             : <xq,xqc,xe,xn,xus><<EOF>> { mmfatal(PARSE_ERROR, "unterminated quoted string"); }
     657             : 
     658             : <SQL>{
     659             : {dolqdelim}     {
     660             :                     token_start = yytext;
     661             :                     if (dolqstart)
     662             :                         free(dolqstart);
     663             :                     dolqstart = mm_strdup(yytext);
     664             :                     BEGIN(xdolq);
     665             :                     startlit();
     666             :                     addlit(yytext, yyleng);
     667             :                 }
     668             : {dolqfailed}    {
     669             :                     /* throw back all but the initial "$" */
     670             :                     yyless(1);
     671             :                     /* and treat it as {other} */
     672             :                     return yytext[0];
     673             :                 }
     674             : } /* <SQL> */
     675             : 
     676             : <xdolq>{dolqdelim} {
     677             :                     if (strcmp(yytext, dolqstart) == 0)
     678             :                     {
     679             :                         addlit(yytext, yyleng);
     680             :                         free(dolqstart);
     681             :                         dolqstart = NULL;
     682             :                         BEGIN(SQL);
     683             :                         base_yylval.str = mm_strdup(literalbuf);
     684             :                         return SCONST;
     685             :                     }
     686             :                     else
     687             :                     {
     688             :                         /*
     689             :                          * When we fail to match $...$ to dolqstart, transfer
     690             :                          * the $... part to the output, but put back the final
     691             :                          * $ for rescanning.  Consider $delim$...$junk$delim$
     692             :                          */
     693             :                         addlit(yytext, yyleng - 1);
     694             :                         yyless(yyleng - 1);
     695             :                     }
     696             :                 }
     697             : <xdolq>{dolqinside} {
     698             :                     addlit(yytext, yyleng);
     699             :                 }
     700             : <xdolq>{dolqfailed} {
     701             :                     addlit(yytext, yyleng);
     702             :                 }
     703             : <xdolq>.      {
     704             :                     /* single quote or dollar sign */
     705             :                     addlitchar(yytext[0]);
     706             :                 }
     707             : <xdolq><<EOF>>    { mmfatal(PARSE_ERROR, "unterminated dollar-quoted string"); }
     708             : 
     709             : <SQL>{
     710             : {xdstart}       {
     711             :                     state_before_str_start = YYSTATE;
     712             :                     BEGIN(xd);
     713             :                     startlit();
     714             :                 }
     715             : {xuistart}      {
     716             :                     state_before_str_start = YYSTATE;
     717             :                     BEGIN(xui);
     718             :                     startlit();
     719             :                 }
     720             : } /* <SQL> */
     721             : 
     722             : <xd>{xdstop}  {
     723             :                     BEGIN(state_before_str_start);
     724             :                     if (literallen == 0)
     725             :                         mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
     726             :                     /*
     727             :                      * The server will truncate the identifier here.  We do
     728             :                      * not, as (1) it does not change the result; (2) we don't
     729             :                      * know what NAMEDATALEN the server might use; (3) this
     730             :                      * code path is also taken for literal query strings in
     731             :                      * PREPARE and EXECUTE IMMEDIATE, which can certainly be
     732             :                      * longer than NAMEDATALEN.
     733             :                      */
     734             :                     base_yylval.str = mm_strdup(literalbuf);
     735             :                     return CSTRING;
     736             :                 }
     737             : <xdc>{xdstop} {
     738             :                     BEGIN(state_before_str_start);
     739             :                     base_yylval.str = mm_strdup(literalbuf);
     740             :                     return CSTRING;
     741             :                 }
     742             : <xui>{dquote} {
     743             :                     BEGIN(state_before_str_start);
     744             :                     if (literallen == 0)
     745             :                         mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
     746             :                     /* The backend will truncate the identifier here. We do not as it does not change the result. */
     747             :                     base_yylval.str = psprintf("U&\"%s\"", literalbuf);
     748             :                     return UIDENT;
     749             :                 }
     750             : <xd,xui>{xddouble}    {
     751             :                     addlit(yytext, yyleng);
     752             :                 }
     753             : <xd,xui>{xdinside}    {
     754             :                     addlit(yytext, yyleng);
     755             :                 }
     756             : <xd,xui><<EOF>>   { mmfatal(PARSE_ERROR, "unterminated quoted identifier"); }
     757             : <C>{xdstart}  {
     758             :                     state_before_str_start = YYSTATE;
     759             :                     BEGIN(xdc);
     760             :                     startlit();
     761             :                 }
     762             : <xdc>{xdcinside}  {
     763             :                     addlit(yytext, yyleng);
     764             :                 }
     765             : <xdc><<EOF>>  { mmfatal(PARSE_ERROR, "unterminated quoted string"); }
     766             : 
     767             : <SQL>{
     768             : {typecast}      {
     769             :                     return TYPECAST;
     770             :                 }
     771             : 
     772             : {dot_dot}       {
     773             :                     return DOT_DOT;
     774             :                 }
     775             : 
     776             : {colon_equals}  {
     777             :                     return COLON_EQUALS;
     778             :                 }
     779             : 
     780             : {equals_greater} {
     781             :                     return EQUALS_GREATER;
     782             :                 }
     783             : 
     784             : {less_equals}   {
     785             :                     return LESS_EQUALS;
     786             :                 }
     787             : 
     788             : {greater_equals} {
     789             :                     return GREATER_EQUALS;
     790             :                 }
     791             : 
     792             : {less_greater}  {
     793             :                     /* We accept both "<>" and "!=" as meaning NOT_EQUALS */
     794             :                     return NOT_EQUALS;
     795             :                 }
     796             : 
     797             : {not_equals}    {
     798             :                     /* We accept both "<>" and "!=" as meaning NOT_EQUALS */
     799             :                     return NOT_EQUALS;
     800             :                 }
     801             : 
     802             : {informix_special}  {
     803             :               /* are we simulating Informix? */
     804             :                 if (INFORMIX_MODE)
     805             :                 {
     806             :                     unput(':');
     807             :                 }
     808             :                 else
     809             :                     return yytext[0];
     810             :                 }
     811             : 
     812             : {self}          {
     813             :                     /*
     814             :                      * We may find a ';' inside a structure
     815             :                      * definition in a TYPE or VAR statement.
     816             :                      * This is not an EOL marker.
     817             :                      */
     818             :                     if (yytext[0] == ';' && struct_level == 0)
     819             :                         BEGIN(C);
     820             :                     return yytext[0];
     821             :                 }
     822             : 
     823             : {operator}      {
     824             :                     /*
     825             :                      * Check for embedded slash-star or dash-dash; those
     826             :                      * are comment starts, so operator must stop there.
     827             :                      * Note that slash-star or dash-dash at the first
     828             :                      * character will match a prior rule, not this one.
     829             :                      */
     830             :                     int         nchars = yyleng;
     831             :                     char       *slashstar = strstr(yytext, "/*");
     832             :                     char       *dashdash = strstr(yytext, "--");
     833             : 
     834             :                     if (slashstar && dashdash)
     835             :                     {
     836             :                         /* if both appear, take the first one */
     837             :                         if (slashstar > dashdash)
     838             :                             slashstar = dashdash;
     839             :                     }
     840             :                     else if (!slashstar)
     841             :                         slashstar = dashdash;
     842             :                     if (slashstar)
     843             :                         nchars = slashstar - yytext;
     844             : 
     845             :                     /*
     846             :                      * For SQL compatibility, '+' and '-' cannot be the
     847             :                      * last char of a multi-char operator unless the operator
     848             :                      * contains chars that are not in SQL operators.
     849             :                      * The idea is to lex '=-' as two operators, but not
     850             :                      * to forbid operator names like '?-' that could not be
     851             :                      * sequences of SQL operators.
     852             :                      */
     853             :                     if (nchars > 1 &&
     854             :                         (yytext[nchars - 1] == '+' ||
     855             :                          yytext[nchars - 1] == '-'))
     856             :                     {
     857             :                         int         ic;
     858             : 
     859             :                         for (ic = nchars - 2; ic >= 0; ic--)
     860             :                         {
     861             :                             char c = yytext[ic];
     862             :                             if (c == '~' || c == '!' || c == '@' ||
     863             :                                 c == '#' || c == '^' || c == '&' ||
     864             :                                 c == '|' || c == '`' || c == '?' ||
     865             :                                 c == '%')
     866             :                                 break;
     867             :                         }
     868             :                         if (ic < 0)
     869             :                         {
     870             :                             /*
     871             :                              * didn't find a qualifying character, so remove
     872             :                              * all trailing [+-]
     873             :                              */
     874             :                             do {
     875             :                                 nchars--;
     876             :                             } while (nchars > 1 &&
     877             :                                  (yytext[nchars - 1] == '+' ||
     878             :                                   yytext[nchars - 1] == '-'));
     879             :                         }
     880             :                     }
     881             : 
     882             :                     if (nchars < yyleng)
     883             :                     {
     884             :                         /* Strip the unwanted chars from the token */
     885             :                         yyless(nchars);
     886             :                         /*
     887             :                          * If what we have left is only one char, and it's
     888             :                          * one of the characters matching "self", then
     889             :                          * return it as a character token the same way
     890             :                          * that the "self" rule would have.
     891             :                          */
     892             :                         if (nchars == 1 &&
     893             :                             strchr(",()[].;:+-*/%^<>=", yytext[0]))
     894             :                             return yytext[0];
     895             :                         /*
     896             :                          * Likewise, if what we have left is two chars, and
     897             :                          * those match the tokens ">=", "<=", "=>", "<>" or
     898             :                          * "!=", then we must return the appropriate token
     899             :                          * rather than the generic Op.
     900             :                          */
     901             :                         if (nchars == 2)
     902             :                         {
     903             :                             if (yytext[0] == '=' && yytext[1] == '>')
     904             :                                 return EQUALS_GREATER;
     905             :                             if (yytext[0] == '>' && yytext[1] == '=')
     906             :                                 return GREATER_EQUALS;
     907             :                             if (yytext[0] == '<' && yytext[1] == '=')
     908             :                                 return LESS_EQUALS;
     909             :                             if (yytext[0] == '<' && yytext[1] == '>')
     910             :                                 return NOT_EQUALS;
     911             :                             if (yytext[0] == '!' && yytext[1] == '=')
     912             :                                 return NOT_EQUALS;
     913             :                         }
     914             :                     }
     915             : 
     916             :                     base_yylval.str = mm_strdup(yytext);
     917             :                     return Op;
     918             :                 }
     919             : 
     920             : {param}         {
     921             :                     base_yylval.ival = atol(yytext+1);
     922             :                     return PARAM;
     923             :                 }
     924             : {param_junk}    {
     925             :                     mmfatal(PARSE_ERROR, "trailing junk after parameter");
     926             :                 }
     927             : 
     928             : {ip}            {
     929             :                     base_yylval.str = mm_strdup(yytext);
     930             :                     return IP;
     931             :                 }
     932             : }  /* <SQL> */
     933             : 
     934             : <C,SQL>{
     935             : {integer}       {
     936             :                     return process_integer_literal(yytext, &base_yylval);
     937             :                 }
     938             : {decimal}       {
     939             :                     base_yylval.str = mm_strdup(yytext);
     940             :                     return FCONST;
     941             :                 }
     942             : {decimalfail}   {
     943             :                     /* throw back the .., and treat as integer */
     944             :                     yyless(yyleng - 2);
     945             :                     return process_integer_literal(yytext, &base_yylval);
     946             :                 }
     947             : {real}          {
     948             :                     base_yylval.str = mm_strdup(yytext);
     949             :                     return FCONST;
     950             :                 }
     951             : {realfail}      {
     952             :                     /*
     953             :                      * throw back the [Ee][+-], and figure out whether what
     954             :                      * remains is an {integer} or {decimal}.
     955             :                      */
     956             :                     yyless(yyleng - 2);
     957             :                     return process_integer_literal(yytext, &base_yylval);
     958             :                 }
     959             : } /* <C,SQL> */
     960             : 
     961             : <SQL>{
     962             :     /*
     963             :      * Note that some trailing junk is valid in C (such as 100LL), so we
     964             :      * contain this to SQL mode.
     965             :      */
     966             : {integer_junk}  {
     967             :                     mmfatal(PARSE_ERROR, "trailing junk after numeric literal");
     968             :                 }
     969             : {decimal_junk}  {
     970             :                     mmfatal(PARSE_ERROR, "trailing junk after numeric literal");
     971             :                 }
     972             : {real_junk}     {
     973             :                     mmfatal(PARSE_ERROR, "trailing junk after numeric literal");
     974             :                 }
     975             : 
     976             : :{identifier}((("->"|\.){identifier})|(\[{array}\]))*  {
     977             :                     base_yylval.str = mm_strdup(yytext+1);
     978             :                     return CVARIABLE;
     979             :                 }
     980             : 
     981             : {identifier}    {
     982             :                     if (!isdefine())
     983             :                     {
     984             :                         int     kwvalue;
     985             : 
     986             :                         /*
     987             :                          * User-defined typedefs override SQL keywords, but
     988             :                          * not C keywords.  Currently, a typedef name is just
     989             :                          * reported as IDENT, but someday we might need to
     990             :                          * return a distinct token type.
     991             :                          */
     992             :                         if (get_typedef(yytext, true) == NULL)
     993             :                         {
     994             :                             /* Is it an SQL/ECPG keyword? */
     995             :                             kwvalue = ScanECPGKeywordLookup(yytext);
     996             :                             if (kwvalue >= 0)
     997             :                                 return kwvalue;
     998             :                         }
     999             : 
    1000             :                         /* Is it a C keyword? */
    1001             :                         kwvalue = ScanCKeywordLookup(yytext);
    1002             :                         if (kwvalue >= 0)
    1003             :                             return kwvalue;
    1004             : 
    1005             :                         /*
    1006             :                          * None of the above.  Return it as an identifier.
    1007             :                          *
    1008             :                          * The backend will attempt to truncate and case-fold
    1009             :                          * the identifier, but I see no good reason for ecpg
    1010             :                          * to do so; that's just another way that ecpg could get
    1011             :                          * out of step with the backend.
    1012             :                          */
    1013             :                         base_yylval.str = mm_strdup(yytext);
    1014             :                         return IDENT;
    1015             :                     }
    1016             :                 }
    1017             : 
    1018             : {other}         {
    1019             :                     return yytext[0];
    1020             :                 }
    1021             : } /* <SQL> */
    1022             : 
    1023             :     /*
    1024             :      * Begin ECPG-specific rules
    1025             :      */
    1026             : 
    1027             : <C>{exec_sql}     { BEGIN(SQL); return SQL_START; }
    1028             : <C>{informix_special} {
    1029             :                         /* are we simulating Informix? */
    1030             :                         if (INFORMIX_MODE)
    1031             :                         {
    1032             :                             BEGIN(SQL);
    1033             :                             return SQL_START;
    1034             :                         }
    1035             :                         else
    1036             :                             return S_ANYTHING;
    1037             :                      }
    1038             : <C>{ccomment}     { ECHO; }
    1039             : <C>{xch}          {
    1040             :                         char* endptr;
    1041             : 
    1042             :                         errno = 0;
    1043             :                         base_yylval.ival = strtoul((char *) yytext, &endptr, 16);
    1044             :                         if (*endptr != '\0' || errno == ERANGE)
    1045             :                         {
    1046             :                             errno = 0;
    1047             :                             base_yylval.str = mm_strdup(yytext);
    1048             :                             return SCONST;
    1049             :                         }
    1050             :                         return ICONST;
    1051             :                     }
    1052             : <C>{cppinclude}       {
    1053             :                         if (system_includes)
    1054             :                         {
    1055             :                             include_next = false;
    1056             :                             BEGIN(incl);
    1057             :                         }
    1058             :                         else
    1059             :                         {
    1060             :                             base_yylval.str = mm_strdup(yytext);
    1061             :                             return CPP_LINE;
    1062             :                         }
    1063             :                     }
    1064             : <C>{cppinclude_next}      {
    1065             :                         if (system_includes)
    1066             :                         {
    1067             :                             include_next = true;
    1068             :                             BEGIN(incl);
    1069             :                         }
    1070             :                         else
    1071             :                         {
    1072             :                             base_yylval.str = mm_strdup(yytext);
    1073             :                             return CPP_LINE;
    1074             :                         }
    1075             :                     }
    1076             : <C,SQL>{cppline}  {
    1077             :                         base_yylval.str = mm_strdup(yytext);
    1078             :                         return CPP_LINE;
    1079             :                     }
    1080             : <C>{identifier}       {
    1081             :                         /*
    1082             :                          * Try to detect a function name:
    1083             :                          * look for identifiers at the global scope
    1084             :                          * keep the last identifier before the first '(' and '{'
    1085             :                          */
    1086             :                         if (braces_open == 0 && parenths_open == 0)
    1087             :                         {
    1088             :                             if (current_function)
    1089             :                                 free(current_function);
    1090             :                             current_function = mm_strdup(yytext);
    1091             :                         }
    1092             :                         /* Informix uses SQL defines only in SQL space */
    1093             :                         /* however, some defines have to be taken care of for compatibility */
    1094             :                         if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
    1095             :                         {
    1096             :                             int     kwvalue;
    1097             : 
    1098             :                             kwvalue = ScanCKeywordLookup(yytext);
    1099             :                             if (kwvalue >= 0)
    1100             :                                 return kwvalue;
    1101             :                             else
    1102             :                             {
    1103             :                                 base_yylval.str = mm_strdup(yytext);
    1104             :                                 return IDENT;
    1105             :                             }
    1106             :                         }
    1107             :                     }
    1108             : <C>{xcstop}           { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); }
    1109             : <C>":"              { return ':'; }
    1110             : <C>";"              { return ';'; }
    1111             : <C>","              { return ','; }
    1112             : <C>"*"              { return '*'; }
    1113             : <C>"%"              { return '%'; }
    1114             : <C>"/"              { return '/'; }
    1115             : <C>"+"              { return '+'; }
    1116             : <C>"-"              { return '-'; }
    1117             : <C>"("              { parenths_open++; return '('; }
    1118             : <C>")"              { parenths_open--; return ')'; }
    1119             : <C,xskip>{space}      { ECHO; }
    1120             : <C>\{             { return '{'; }
    1121             : <C>\}             { return '}'; }
    1122             : <C>\[             { return '['; }
    1123             : <C>\]             { return ']'; }
    1124             : <C>\=             { return '='; }
    1125             : <C>"->"              { return S_MEMBER; }
    1126             : <C>">>"               { return S_RSHIFT; }
    1127             : <C>"<<"               { return S_LSHIFT; }
    1128             : <C>"||"             { return S_OR; }
    1129             : <C>"&&"             { return S_AND; }
    1130             : <C>"++"             { return S_INC; }
    1131             : <C>"--"             { return S_DEC; }
    1132             : <C>"=="             { return S_EQUAL; }
    1133             : <C>"!="             { return S_NEQUAL; }
    1134             : <C>"+="             { return S_ADD; }
    1135             : <C>"-="             { return S_SUB; }
    1136             : <C>"*="             { return S_MUL; }
    1137             : <C>"/="             { return S_DIV; }
    1138             : <C>"%="             { return S_MOD; }
    1139             : <C>"->*"         { return S_MEMPOINT; }
    1140             : <C>".*"             { return S_DOTPOINT; }
    1141             : <C>{other}            { return S_ANYTHING; }
    1142             : <C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
    1143             : <C>{informix_special}{define}{space}* {
    1144             :                         /* are we simulating Informix? */
    1145             :                         if (INFORMIX_MODE)
    1146             :                         {
    1147             :                             BEGIN(def_ident);
    1148             :                         }
    1149             :                         else
    1150             :                         {
    1151             :                             yyless(1);
    1152             :                             return S_ANYTHING;
    1153             :                         }
    1154             :                     }
    1155             : <C>{exec_sql}{undef}{space}*      { BEGIN(undef); }
    1156             : <C>{informix_special}{undef}{space}* {
    1157             :                         /* are we simulating Informix? */
    1158             :                         if (INFORMIX_MODE)
    1159             :                         {
    1160             :                             BEGIN(undef);
    1161             :                         }
    1162             :                         else
    1163             :                         {
    1164             :                             yyless(1);
    1165             :                             return S_ANYTHING;
    1166             :                         }
    1167             :                     }
    1168             : <undef>{identifier}{space}*";" {
    1169             :                     struct _defines *ptr, *ptr2 = NULL;
    1170             :                     int i;
    1171             : 
    1172             :                     /*
    1173             :                      *  Skip the ";" and trailing whitespace. Note that yytext
    1174             :                      *  contains at least one non-space character plus the ";"
    1175             :                      */
    1176             :                     for (i = strlen(yytext)-2;
    1177             :                          i > 0 && ecpg_isspace(yytext[i]);
    1178             :                          i--)
    1179             :                         ;
    1180             :                     yytext[i+1] = '\0';
    1181             : 
    1182             : 
    1183             :                     for (ptr = defines; ptr != NULL; ptr2 = ptr, ptr = ptr->next)
    1184             :                     {
    1185             :                         if (strcmp(yytext, ptr->olddef) == 0)
    1186             :                         {
    1187             :                             if (ptr2 == NULL)
    1188             :                                 defines = ptr->next;
    1189             :                             else
    1190             :                                 ptr2->next = ptr->next;
    1191             :                             free(ptr->newdef);
    1192             :                             free(ptr->olddef);
    1193             :                             free(ptr);
    1194             :                             break;
    1195             :                         }
    1196             :                     }
    1197             : 
    1198             :                     BEGIN(C);
    1199             :                 }
    1200             : <undef>{other}|\n {
    1201             :                         mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL UNDEF command");
    1202             :                         yyterminate();
    1203             :                 }
    1204             : <C>{exec_sql}{include}{space}*    { BEGIN(incl); }
    1205             : <C>{informix_special}{include}{space}* {
    1206             :                       /* are we simulating Informix? */
    1207             :                       if (INFORMIX_MODE)
    1208             :                       {
    1209             :                           BEGIN(incl);
    1210             :                       }
    1211             :                       else
    1212             :                       {
    1213             :                           yyless(1);
    1214             :                           return S_ANYTHING;
    1215             :                       }
    1216             :                     }
    1217             : <C,xskip>{exec_sql}{ifdef}{space}* {
    1218             :                       if (preproc_tos >= MAX_NESTED_IF-1)
    1219             :                           mmfatal(PARSE_ERROR, "too many nested EXEC SQL IFDEF conditions");
    1220             :                       preproc_tos++;
    1221             :                       stacked_if_value[preproc_tos].active = false;
    1222             :                       stacked_if_value[preproc_tos].saw_active = false;
    1223             :                       stacked_if_value[preproc_tos].else_branch = false;
    1224             :                       ifcond = true;
    1225             :                       BEGIN(xcond);
    1226             :                     }
    1227             : <C,xskip>{informix_special}{ifdef}{space}* {
    1228             :                       /* are we simulating Informix? */
    1229             :                       if (INFORMIX_MODE)
    1230             :                       {
    1231             :                           if (preproc_tos >= MAX_NESTED_IF-1)
    1232             :                               mmfatal(PARSE_ERROR, "too many nested EXEC SQL IFDEF conditions");
    1233             :                           preproc_tos++;
    1234             :                           stacked_if_value[preproc_tos].active = false;
    1235             :                           stacked_if_value[preproc_tos].saw_active = false;
    1236             :                           stacked_if_value[preproc_tos].else_branch = false;
    1237             :                           ifcond = true;
    1238             :                           BEGIN(xcond);
    1239             :                       }
    1240             :                       else
    1241             :                       {
    1242             :                           yyless(1);
    1243             :                           return S_ANYTHING;
    1244             :                       }
    1245             :                     }
    1246             : <C,xskip>{exec_sql}{ifndef}{space}* {
    1247             :                       if (preproc_tos >= MAX_NESTED_IF-1)
    1248             :                           mmfatal(PARSE_ERROR, "too many nested EXEC SQL IFDEF conditions");
    1249             :                       preproc_tos++;
    1250             :                       stacked_if_value[preproc_tos].active = false;
    1251             :                       stacked_if_value[preproc_tos].saw_active = false;
    1252             :                       stacked_if_value[preproc_tos].else_branch = false;
    1253             :                       ifcond = false;
    1254             :                       BEGIN(xcond);
    1255             :                     }
    1256             : <C,xskip>{informix_special}{ifndef}{space}* {
    1257             :                       /* are we simulating Informix? */
    1258             :                       if (INFORMIX_MODE)
    1259             :                       {
    1260             :                           if (preproc_tos >= MAX_NESTED_IF-1)
    1261             :                               mmfatal(PARSE_ERROR, "too many nested EXEC SQL IFDEF conditions");
    1262             :                           preproc_tos++;
    1263             :                           stacked_if_value[preproc_tos].active = false;
    1264             :                           stacked_if_value[preproc_tos].saw_active = false;
    1265             :                           stacked_if_value[preproc_tos].else_branch = false;
    1266             :                           ifcond = false;
    1267             :                           BEGIN(xcond);
    1268             :                       }
    1269             :                       else
    1270             :                       {
    1271             :                           yyless(1);
    1272             :                           return S_ANYTHING;
    1273             :                       }
    1274             :                     }
    1275             : <C,xskip>{exec_sql}{elif}{space}* {
    1276             :                         if (preproc_tos == 0)
    1277             :                             mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
    1278             :                         if (stacked_if_value[preproc_tos].else_branch)
    1279             :                             mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\"");
    1280             :                         ifcond = true;
    1281             :                         BEGIN(xcond);
    1282             :                     }
    1283             : <C,xskip>{informix_special}{elif}{space}* {
    1284             :                     /* are we simulating Informix? */
    1285             :                     if (INFORMIX_MODE)
    1286             :                     {
    1287             :                         if (preproc_tos == 0)
    1288             :                             mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
    1289             :                         if (stacked_if_value[preproc_tos].else_branch)
    1290             :                             mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\"");
    1291             :                         ifcond = true;
    1292             :                         BEGIN(xcond);
    1293             :                     }
    1294             :                     else
    1295             :                     {
    1296             :                         yyless(1);
    1297             :                         return S_ANYTHING;
    1298             :                     }
    1299             :                 }
    1300             : 
    1301             : <C,xskip>{exec_sql}{else}{space}*";" {  /* only exec sql endif pops the stack, so take care of duplicated 'else' */
    1302             :                     if (preproc_tos == 0)
    1303             :                         mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
    1304             :                     else if (stacked_if_value[preproc_tos].else_branch)
    1305             :                         mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE");
    1306             :                     else
    1307             :                     {
    1308             :                         stacked_if_value[preproc_tos].else_branch = true;
    1309             :                         stacked_if_value[preproc_tos].active =
    1310             :                             (stacked_if_value[preproc_tos-1].active &&
    1311             :                              !stacked_if_value[preproc_tos].saw_active);
    1312             :                         stacked_if_value[preproc_tos].saw_active = true;
    1313             : 
    1314             :                         if (stacked_if_value[preproc_tos].active)
    1315             :                             BEGIN(C);
    1316             :                         else
    1317             :                             BEGIN(xskip);
    1318             :                     }
    1319             :                 }
    1320             : <C,xskip>{informix_special}{else}{space}*";"    {
    1321             :                     /* are we simulating Informix? */
    1322             :                     if (INFORMIX_MODE)
    1323             :                     {
    1324             :                         if (preproc_tos == 0)
    1325             :                             mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
    1326             :                         else if (stacked_if_value[preproc_tos].else_branch)
    1327             :                             mmfatal(PARSE_ERROR, "more than one EXEC SQL ELSE");
    1328             :                         else
    1329             :                         {
    1330             :                             stacked_if_value[preproc_tos].else_branch = true;
    1331             :                             stacked_if_value[preproc_tos].active =
    1332             :                                 (stacked_if_value[preproc_tos-1].active &&
    1333             :                                  !stacked_if_value[preproc_tos].saw_active);
    1334             :                             stacked_if_value[preproc_tos].saw_active = true;
    1335             : 
    1336             :                             if (stacked_if_value[preproc_tos].active)
    1337             :                                 BEGIN(C);
    1338             :                             else
    1339             :                                 BEGIN(xskip);
    1340             :                         }
    1341             :                     }
    1342             :                     else
    1343             :                     {
    1344             :                         yyless(1);
    1345             :                         return S_ANYTHING;
    1346             :                     }
    1347             :                 }
    1348             : <C,xskip>{exec_sql}{endif}{space}*";" {
    1349             :                     if (preproc_tos == 0)
    1350             :                         mmfatal(PARSE_ERROR, "unmatched EXEC SQL ENDIF");
    1351             :                     else
    1352             :                         preproc_tos--;
    1353             : 
    1354             :                     if (stacked_if_value[preproc_tos].active)
    1355             :                        BEGIN(C);
    1356             :                     else
    1357             :                        BEGIN(xskip);
    1358             :                 }
    1359             : <C,xskip>{informix_special}{endif}{space}*";"   {
    1360             :                     /* are we simulating Informix? */
    1361             :                     if (INFORMIX_MODE)
    1362             :                     {
    1363             :                         if (preproc_tos == 0)
    1364             :                             mmfatal(PARSE_ERROR, "unmatched EXEC SQL ENDIF");
    1365             :                         else
    1366             :                             preproc_tos--;
    1367             : 
    1368             :                         if (stacked_if_value[preproc_tos].active)
    1369             :                             BEGIN(C);
    1370             :                         else
    1371             :                             BEGIN(xskip);
    1372             :                     }
    1373             :                     else
    1374             :                     {
    1375             :                         yyless(1);
    1376             :                         return S_ANYTHING;
    1377             :                     }
    1378             :                 }
    1379             : 
    1380             : <xskip>{other}        { /* ignore */ }
    1381             : 
    1382             : <xcond>{identifier}{space}*";" {
    1383             :                     {
    1384             :                         struct _defines *defptr;
    1385             :                         unsigned int i;
    1386             :                         bool this_active;
    1387             : 
    1388             :                         /*
    1389             :                          *  Skip the ";" and trailing whitespace. Note that yytext
    1390             :                          *  contains at least one non-space character plus the ";"
    1391             :                          */
    1392             :                         for (i = strlen(yytext)-2;
    1393             :                              i > 0 && ecpg_isspace(yytext[i]);
    1394             :                              i--)
    1395             :                             ;
    1396             :                         yytext[i+1] = '\0';
    1397             : 
    1398             :                         for (defptr = defines;
    1399             :                              defptr != NULL &&
    1400             :                              strcmp(yytext, defptr->olddef) != 0;
    1401             :                              defptr = defptr->next)
    1402             :                             /* skip */ ;
    1403             : 
    1404             :                         this_active = (defptr ? ifcond : !ifcond);
    1405             :                         stacked_if_value[preproc_tos].active =
    1406             :                             (stacked_if_value[preproc_tos-1].active &&
    1407             :                              !stacked_if_value[preproc_tos].saw_active &&
    1408             :                              this_active);
    1409             :                         stacked_if_value[preproc_tos].saw_active |= this_active;
    1410             :                     }
    1411             : 
    1412             :                     if (stacked_if_value[preproc_tos].active)
    1413             :                         BEGIN(C);
    1414             :                     else
    1415             :                         BEGIN(xskip);
    1416             :                 }
    1417             : 
    1418             : <xcond>{other}|\n {
    1419             :                 mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL IFDEF command");
    1420             :                 yyterminate();
    1421             :             }
    1422             : <def_ident>{identifier} {
    1423             :                 old = mm_strdup(yytext);
    1424             :                 BEGIN(def);
    1425             :                 startlit();
    1426             :             }
    1427             : <def_ident>{other}|\n {
    1428             :                 mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL DEFINE command");
    1429             :                 yyterminate();
    1430             :             }
    1431             : <def>{space}*";"    {
    1432             :                         struct _defines *ptr, *this;
    1433             : 
    1434             :                         for (ptr = defines; ptr != NULL; ptr = ptr->next)
    1435             :                         {
    1436             :                              if (strcmp(old, ptr->olddef) == 0)
    1437             :                              {
    1438             :                                 free(ptr->newdef);
    1439             :                                 ptr->newdef = mm_strdup(literalbuf);
    1440             :                              }
    1441             :                         }
    1442             :                         if (ptr == NULL)
    1443             :                         {
    1444             :                             this = (struct _defines *) mm_alloc(sizeof(struct _defines));
    1445             : 
    1446             :                             /* initial definition */
    1447             :                             this->olddef = old;
    1448             :                             this->newdef = mm_strdup(literalbuf);
    1449             :                             this->next = defines;
    1450             :                             this->used = NULL;
    1451             :                             defines = this;
    1452             :                         }
    1453             : 
    1454             :                         BEGIN(C);
    1455             :                     }
    1456             : <def>[^;]         { addlit(yytext, yyleng); }
    1457             : <incl>\<[^\>]+\>{space}*";"?       {   parse_include(); }
    1458             : <incl>{dquote}{xdinside}{dquote}{space}*";"?    {   parse_include(); }
    1459             : <incl>[^;\<\>\"]+";"     { parse_include(); }
    1460             : <incl>{other}|\n      {
    1461             :                     mmfatal(PARSE_ERROR, "syntax error in EXEC SQL INCLUDE command");
    1462             :                     yyterminate();
    1463             :                 }
    1464             : 
    1465             : <<EOF>>             {
    1466             :                     if (yy_buffer == NULL)
    1467             :                     {
    1468             :                         if (preproc_tos > 0)
    1469             :                         {
    1470             :                             preproc_tos = 0;
    1471             :                             mmfatal(PARSE_ERROR, "missing \"EXEC SQL ENDIF;\"");
    1472             :                         }
    1473             :                         yyterminate();
    1474             :                     }
    1475             :                     else
    1476             :                     {
    1477             :                         struct _yy_buffer *yb = yy_buffer;
    1478             :                         int i;
    1479             :                         struct _defines *ptr;
    1480             : 
    1481             :                         for (ptr = defines; ptr; ptr = ptr->next)
    1482             :                             if (ptr->used == yy_buffer)
    1483             :                             {
    1484             :                                 ptr->used = NULL;
    1485             :                                 break;
    1486             :                             }
    1487             : 
    1488             :                         if (yyin != NULL)
    1489             :                             fclose(yyin);
    1490             : 
    1491             :                         yy_delete_buffer(YY_CURRENT_BUFFER);
    1492             :                         yy_switch_to_buffer(yy_buffer->buffer);
    1493             : 
    1494             :                         yylineno = yy_buffer->lineno;
    1495             : 
    1496             :                         /* We have to output the filename only if we change files here */
    1497             :                         i = strcmp(input_filename, yy_buffer->filename);
    1498             : 
    1499             :                         free(input_filename);
    1500             :                         input_filename = yy_buffer->filename;
    1501             : 
    1502             :                         yy_buffer = yy_buffer->next;
    1503             :                         free(yb);
    1504             : 
    1505             :                         if (i != 0)
    1506             :                             output_line_number();
    1507             : 
    1508             :                     }
    1509             :                 }
    1510             : 
    1511             : <INITIAL>{other}|\n   { mmfatal(PARSE_ERROR, "internal error: unreachable state; please report this to <%s>", PACKAGE_BUGREPORT); }
    1512             : 
    1513             : %%
    1514             : 
    1515             : /* LCOV_EXCL_STOP */
    1516             : 
    1517             : void
    1518             : lex_init(void)
    1519         126 : {
    1520             :     braces_open = 0;
    1521         126 :     parenths_open = 0;
    1522         126 :     current_function = NULL;
    1523         126 : 
    1524             :     yylineno = 1;
    1525         126 : 
    1526             :     /* initialize state for if/else/endif */
    1527             :     preproc_tos = 0;
    1528         126 :     stacked_if_value[preproc_tos].active = true;
    1529         126 :     stacked_if_value[preproc_tos].saw_active = true;
    1530         126 :     stacked_if_value[preproc_tos].else_branch = false;
    1531         126 : 
    1532             :     /* initialize literal buffer to a reasonable but expansible size */
    1533             :     if (literalbuf == NULL)
    1534         126 :     {
    1535             :         literalalloc = 1024;
    1536         126 :         literalbuf = (char *) mm_alloc(literalalloc);
    1537         126 :     }
    1538             :     startlit();
    1539         126 : 
    1540             :     BEGIN(C);
    1541         126 : }
    1542         126 : 
    1543             : static void
    1544             : addlit(char *ytext, int yleng)
    1545       46302 : {
    1546             :     /* enlarge buffer if needed */
    1547             :     if ((literallen+yleng) >= literalalloc)
    1548       46302 :     {
    1549             :         do
    1550             :             literalalloc *= 2;
    1551           0 :         while ((literallen+yleng) >= literalalloc);
    1552           0 :         literalbuf = (char *) realloc(literalbuf, literalalloc);
    1553           0 :     }
    1554             :     /* append new data, add trailing null */
    1555             :     memcpy(literalbuf+literallen, ytext, yleng);
    1556       46302 :     literallen += yleng;
    1557       46302 :     literalbuf[literallen] = '\0';
    1558       46302 : }
    1559       46302 : 
    1560             : static void
    1561             : addlitchar(unsigned char ychar)
    1562           0 : {
    1563             :     /* enlarge buffer if needed */
    1564             :     if ((literallen+1) >= literalalloc)
    1565           0 :     {
    1566             :         literalalloc *= 2;
    1567           0 :         literalbuf = (char *) realloc(literalbuf, literalalloc);
    1568           0 :     }
    1569             :     /* append new data, add trailing null */
    1570             :     literalbuf[literallen] = ychar;
    1571           0 :     literallen += 1;
    1572           0 :     literalbuf[literallen] = '\0';
    1573           0 : }
    1574           0 : 
    1575             : /*
    1576             :  * Process {integer}.  Note this will also do the right thing with {decimal},
    1577             :  * ie digits and a decimal point.
    1578             :  */
    1579             : static int
    1580             : process_integer_literal(const char *token, YYSTYPE *lval)
    1581        2312 : {
    1582             :     int         val;
    1583             :     char       *endptr;
    1584             : 
    1585             :     errno = 0;
    1586        2312 :     val = strtoint(token, &endptr, 10);
    1587        2312 :     if (*endptr != '\0' || errno == ERANGE)
    1588        2312 :     {
    1589             :         /* integer too large (or contains decimal pt), treat it as a float */
    1590             :         lval->str = mm_strdup(token);
    1591          12 :         return FCONST;
    1592          12 :     }
    1593             :     lval->ival = val;
    1594        2300 :     return ICONST;
    1595        2300 : }
    1596             : 
    1597             : static void
    1598             : parse_include(void)
    1599         166 : {
    1600             :     /* got the include file name */
    1601             :     struct _yy_buffer *yb;
    1602             :     struct _include_path *ip;
    1603             :     char inc_file[MAXPGPATH];
    1604             :     unsigned int i;
    1605             : 
    1606             :     yb = mm_alloc(sizeof(struct _yy_buffer));
    1607         166 : 
    1608             :     yb->buffer = YY_CURRENT_BUFFER;
    1609         166 :     yb->lineno = yylineno;
    1610         166 :     yb->filename = input_filename;
    1611         166 :     yb->next = yy_buffer;
    1612         166 : 
    1613             :     yy_buffer = yb;
    1614         166 : 
    1615             :     /*
    1616             :      * skip the ";" if there is one and trailing whitespace. Note that
    1617             :      * yytext contains at least one non-space character plus the ";"
    1618             :      */
    1619             :     for (i = strlen(yytext)-2;
    1620         168 :          i > 0 && ecpg_isspace(yytext[i]);
    1621         168 :          i--)
    1622           2 :         ;
    1623             : 
    1624             :     if (yytext[i] == ';')
    1625         166 :         i--;
    1626           0 : 
    1627             :     yytext[i+1] = '\0';
    1628         166 : 
    1629             :     yyin = NULL;
    1630         166 : 
    1631             :     /* If file name is enclosed in '"' remove these and look only in '.' */
    1632             :     /* Informix does look into all include paths though, except filename starts with '/' */
    1633             :     if (yytext[0] == '"' && yytext[i] == '"' &&
    1634         166 :         ((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/'))
    1635           0 :     {
    1636             :         yytext[i] = '\0';
    1637           0 :         memmove(yytext, yytext+1, strlen(yytext));
    1638           0 : 
    1639             :         strlcpy(inc_file, yytext, sizeof(inc_file));
    1640           0 :         yyin = fopen(inc_file, "r");
    1641           0 :         if (!yyin)
    1642           0 :         {
    1643             :             if (strlen(inc_file) <= 2 || strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
    1644           0 :             {
    1645             :                 strcat(inc_file, ".h");
    1646           0 :                 yyin = fopen(inc_file, "r");
    1647           0 :             }
    1648             :         }
    1649             : 
    1650             :     }
    1651             :     else
    1652             :     {
    1653             :         if ((yytext[0] == '"' && yytext[i] == '"') || (yytext[0] == '<' && yytext[i] == '>'))
    1654         166 :         {
    1655             :             yytext[i] = '\0';
    1656           4 :             memmove(yytext, yytext+1, strlen(yytext));
    1657           4 :         }
    1658             : 
    1659             :         for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next)
    1660         454 :         {
    1661             :             if (strlen(ip->path) + strlen(yytext) + 4 > MAXPGPATH)
    1662         288 :             {
    1663             :                 fprintf(stderr, _("Error: include path \"%s/%s\" is too long on line %d, skipping\n"), ip->path, yytext, yylineno);
    1664           0 :                 continue;
    1665           0 :             }
    1666             :             snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext);
    1667         288 :             yyin = fopen(inc_file, "r");
    1668         288 :             if (!yyin)
    1669         288 :             {
    1670             :                 if (strcmp(inc_file + strlen(inc_file) - 2, ".h") != 0)
    1671         266 :                 {
    1672             :                     strcat(inc_file, ".h");
    1673         260 :                     yyin = fopen(inc_file, "r");
    1674         260 :                 }
    1675             :             }
    1676             :             /* if the command was "include_next" we have to disregard the first hit */
    1677             :             if (yyin && include_next)
    1678         288 :             {
    1679             :                 fclose (yyin);
    1680           0 :                 yyin = NULL;
    1681           0 :                 include_next = false;
    1682           0 :             }
    1683             :         }
    1684             :     }
    1685             :     if (!yyin)
    1686         166 :         mmfatal(NO_INCLUDE_FILE, "could not open include file \"%s\" on line %d", yytext, yylineno);
    1687           0 : 
    1688             :     input_filename = mm_strdup(inc_file);
    1689         166 :     yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
    1690         166 :     yylineno = 1;
    1691         166 :     output_line_number();
    1692         166 : 
    1693             :     BEGIN(C);
    1694         166 : }
    1695         166 : 
    1696             : /*
    1697             :  * ecpg_isspace() --- return true if flex scanner considers char whitespace
    1698             :  */
    1699             : static bool
    1700             : ecpg_isspace(char ch)
    1701         194 : {
    1702             :     if (ch == ' ' ||
    1703         194 :         ch == '\t' ||
    1704         194 :         ch == '\n' ||
    1705         192 :         ch == '\r' ||
    1706         192 :         ch == '\f')
    1707             :         return true;
    1708           2 :     return false;
    1709         192 : }
    1710             : 
    1711             : static bool isdefine(void)
    1712       26914 : {
    1713             :     struct _defines *ptr;
    1714             : 
    1715             :     /* is it a define? */
    1716             :     for (ptr = defines; ptr; ptr = ptr->next)
    1717      122710 :     {
    1718             :         if (strcmp(yytext, ptr->olddef) == 0 && ptr->used == NULL)
    1719       95954 :         {
    1720             :             struct _yy_buffer *yb;
    1721             : 
    1722             :             yb = mm_alloc(sizeof(struct _yy_buffer));
    1723         158 : 
    1724             :             yb->buffer =  YY_CURRENT_BUFFER;
    1725         158 :             yb->lineno = yylineno;
    1726         158 :             yb->filename = mm_strdup(input_filename);
    1727         158 :             yb->next = yy_buffer;
    1728         158 : 
    1729             :             ptr->used = yy_buffer = yb;
    1730         158 : 
    1731             :             yy_scan_string(ptr->newdef);
    1732         158 :             return true;
    1733         158 :         }
    1734             :     }
    1735             : 
    1736             :     return false;
    1737       26756 : }
    1738             : 
    1739             : static bool isinformixdefine(void)
    1740        3464 : {
    1741             :     const char *new = NULL;
    1742        3464 : 
    1743             :     if (strcmp(yytext, "dec_t") == 0)
    1744        3464 :         new = "decimal";
    1745           2 :     else if (strcmp(yytext, "intrvl_t") == 0)
    1746        3462 :         new = "interval";
    1747           0 :     else if (strcmp(yytext, "dtime_t") == 0)
    1748        3462 :         new = "timestamp";
    1749           0 : 
    1750             :     if (new)
    1751        3464 :     {
    1752             :         struct _yy_buffer *yb;
    1753             : 
    1754             :         yb = mm_alloc(sizeof(struct _yy_buffer));
    1755           2 : 
    1756             :         yb->buffer =  YY_CURRENT_BUFFER;
    1757           2 :         yb->lineno = yylineno;
    1758           2 :         yb->filename = mm_strdup(input_filename);
    1759           2 :         yb->next = yy_buffer;
    1760           2 :         yy_buffer = yb;
    1761           2 : 
    1762             :         yy_scan_string(new);
    1763           2 :         return true;
    1764           2 :     }
    1765             : 
    1766             :     return false;
    1767        3462 : }

Generated by: LCOV version 1.14