~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/include/parser/gramparse.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * gramparse.h
 
4
 *              Shared definitions for the "raw" parser (flex and bison phases only)
 
5
 *
 
6
 * NOTE: this file is only meant to be included in the core parsing files,
 
7
 * ie, parser.c, gram.y, scan.l, and keywords.c.  Definitions that are needed
 
8
 * outside the core parser should be in parser.h.
 
9
 *
 
10
 *
 
11
 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
 
12
 * Portions Copyright (c) 1994, Regents of the University of California
 
13
 *
 
14
 * src/include/parser/gramparse.h
 
15
 *
 
16
 *-------------------------------------------------------------------------
 
17
 */
 
18
 
 
19
#ifndef GRAMPARSE_H
 
20
#define GRAMPARSE_H
 
21
 
 
22
#include "nodes/parsenodes.h"
 
23
#include "parser/scanner.h"
 
24
 
 
25
/*
 
26
 * NB: include gram.h only AFTER including scanner.h, because scanner.h
 
27
 * is what #defines YYLTYPE.
 
28
 */
 
29
#include "parser/gram.h"
 
30
 
 
31
/*
 
32
 * The YY_EXTRA data that a flex scanner allows us to pass around.      Private
 
33
 * state needed for raw parsing/lexing goes here.
 
34
 */
 
35
typedef struct base_yy_extra_type
 
36
{
 
37
        /*
 
38
         * Fields used by the core scanner.
 
39
         */
 
40
        core_yy_extra_type core_yy_extra;
 
41
 
 
42
        /*
 
43
         * State variables for base_yylex().
 
44
         */
 
45
        bool            have_lookahead; /* is lookahead info valid? */
 
46
        int                     lookahead_token;        /* one-token lookahead */
 
47
        core_YYSTYPE lookahead_yylval;          /* yylval for lookahead token */
 
48
        YYLTYPE         lookahead_yylloc;               /* yylloc for lookahead token */
 
49
 
 
50
        /*
 
51
         * State variables that belong to the grammar.
 
52
         */
 
53
        List       *parsetree;          /* final parse result is delivered here */
 
54
} base_yy_extra_type;
 
55
 
 
56
/*
 
57
 * In principle we should use yyget_extra() to fetch the yyextra field
 
58
 * from a yyscanner struct.  However, flex always puts that field first,
 
59
 * and this is sufficiently performance-critical to make it seem worth
 
60
 * cheating a bit to use an inline macro.
 
61
 */
 
62
#define pg_yyget_extra(yyscanner) (*((base_yy_extra_type **) (yyscanner)))
 
63
 
 
64
 
 
65
/* from parser.c */
 
66
extern int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp,
 
67
                   core_yyscan_t yyscanner);
 
68
 
 
69
/* from gram.y */
 
70
extern void parser_init(base_yy_extra_type *yyext);
 
71
extern int      base_yyparse(core_yyscan_t yyscanner);
 
72
 
 
73
#endif   /* GRAMPARSE_H */