Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

parser.c File Reference

#include "postgres_fe.h"
#include "extern.h"
#include "preproc.h"
Include dependency graph for parser.c:

Go to the source code of this file.

Functions

int filtered_base_yylex (void)

Variables

static bool have_lookahead
static int lookahead_token
static YYSTYPE lookahead_yylval
static YYLTYPE lookahead_yylloc

Function Documentation

int filtered_base_yylex ( void   ) 

Definition at line 48 of file parser.c.

References base_yylex(), have_lookahead, lookahead_token, lookahead_yylloc, lookahead_yylval, and YYLTYPE.

{
    int         cur_token;
    int         next_token;
    YYSTYPE     cur_yylval;
    YYLTYPE     cur_yylloc;

    /* Get next token --- we might already have it */
    if (have_lookahead)
    {
        cur_token = lookahead_token;
        base_yylval = lookahead_yylval;
        base_yylloc = lookahead_yylloc;
        have_lookahead = false;
    }
    else
        cur_token = base_yylex();

    /* Do we need to look ahead for a possible multiword token? */
    switch (cur_token)
    {
        case NULLS_P:

            /*
             * NULLS FIRST and NULLS LAST must be reduced to one token
             */
            cur_yylval = base_yylval;
            cur_yylloc = base_yylloc;
            next_token = base_yylex();
            switch (next_token)
            {
                case FIRST_P:
                    cur_token = NULLS_FIRST;
                    break;
                case LAST_P:
                    cur_token = NULLS_LAST;
                    break;
                default:
                    /* save the lookahead token for next time */
                    lookahead_token = next_token;
                    lookahead_yylval = base_yylval;
                    lookahead_yylloc = base_yylloc;
                    have_lookahead = true;
                    /* and back up the output info to cur_token */
                    base_yylval = cur_yylval;
                    base_yylloc = cur_yylloc;
                    break;
            }
            break;

        case WITH:

            /*
             * WITH TIME must be reduced to one token
             */
            cur_yylval = base_yylval;
            cur_yylloc = base_yylloc;
            next_token = base_yylex();
            switch (next_token)
            {
                case TIME:
                    cur_token = WITH_TIME;
                    break;
                default:
                    /* save the lookahead token for next time */
                    lookahead_token = next_token;
                    lookahead_yylval = base_yylval;
                    lookahead_yylloc = base_yylloc;
                    have_lookahead = true;
                    /* and back up the output info to cur_token */
                    base_yylval = cur_yylval;
                    base_yylloc = cur_yylloc;
                    break;
            }
            break;

        default:
            break;
    }

    return cur_token;
}


Variable Documentation

bool have_lookahead [static]

Definition at line 28 of file parser.c.

Referenced by filtered_base_yylex().

int lookahead_token [static]

Definition at line 29 of file parser.c.

Referenced by filtered_base_yylex().

YYLTYPE lookahead_yylloc [static]

Definition at line 31 of file parser.c.

Referenced by filtered_base_yylex().

YYSTYPE lookahead_yylval [static]

Definition at line 30 of file parser.c.

Referenced by filtered_base_yylex().