Header And Logo

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

Data Structures | Defines | Typedefs | Functions

gramparse.h File Reference

#include "nodes/parsenodes.h"
#include "parser/scanner.h"
#include "parser/gram.h"
Include dependency graph for gramparse.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  base_yy_extra_type

Defines

#define pg_yyget_extra(yyscanner)   (*((base_yy_extra_type **) (yyscanner)))

Typedefs

typedef struct base_yy_extra_type base_yy_extra_type

Functions

int base_yylex (YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
void parser_init (base_yy_extra_type *yyext)
int base_yyparse (core_yyscan_t yyscanner)

Define Documentation

#define pg_yyget_extra (   yyscanner  )     (*((base_yy_extra_type **) (yyscanner)))

Definition at line 62 of file gramparse.h.

Referenced by base_yylex().


Typedef Documentation


Function Documentation

int base_yylex ( YYSTYPE *  lvalp,
YYLTYPE *  llocp,
core_yyscan_t  yyscanner 
)

Definition at line 82 of file parser.c.

References core_yylex(), base_yy_extra_type::have_lookahead, base_yy_extra_type::lookahead_token, base_yy_extra_type::lookahead_yylloc, base_yy_extra_type::lookahead_yylval, pg_yyget_extra, and YYLTYPE.

Referenced by filtered_base_yylex().

{
    base_yy_extra_type *yyextra = pg_yyget_extra(yyscanner);
    int         cur_token;
    int         next_token;
    core_YYSTYPE cur_yylval;
    YYLTYPE     cur_yylloc;

    /* Get next token --- we might already have it */
    if (yyextra->have_lookahead)
    {
        cur_token = yyextra->lookahead_token;
        lvalp->core_yystype = yyextra->lookahead_yylval;
        *llocp = yyextra->lookahead_yylloc;
        yyextra->have_lookahead = false;
    }
    else
        cur_token = core_yylex(&(lvalp->core_yystype), llocp, yyscanner);

    /* 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 = lvalp->core_yystype;
            cur_yylloc = *llocp;
            next_token = core_yylex(&(lvalp->core_yystype), llocp, yyscanner);
            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 */
                    yyextra->lookahead_token = next_token;
                    yyextra->lookahead_yylval = lvalp->core_yystype;
                    yyextra->lookahead_yylloc = *llocp;
                    yyextra->have_lookahead = true;
                    /* and back up the output info to cur_token */
                    lvalp->core_yystype = cur_yylval;
                    *llocp = cur_yylloc;
                    break;
            }
            break;

        case WITH:

            /*
             * WITH TIME must be reduced to one token
             */
            cur_yylval = lvalp->core_yystype;
            cur_yylloc = *llocp;
            next_token = core_yylex(&(lvalp->core_yystype), llocp, yyscanner);
            switch (next_token)
            {
                case TIME:
                    cur_token = WITH_TIME;
                    break;
                default:
                    /* save the lookahead token for next time */
                    yyextra->lookahead_token = next_token;
                    yyextra->lookahead_yylval = lvalp->core_yystype;
                    yyextra->lookahead_yylloc = *llocp;
                    yyextra->have_lookahead = true;
                    /* and back up the output info to cur_token */
                    lvalp->core_yystype = cur_yylval;
                    *llocp = cur_yylloc;
                    break;
            }
            break;

        default:
            break;
    }

    return cur_token;
}

int base_yyparse ( core_yyscan_t  yyscanner  ) 

Referenced by main(), and raw_parser().

void parser_init ( base_yy_extra_type yyext  ) 

Referenced by raw_parser().