PostgreSQL Source Code
git master
gramparse.h
Go to the documentation of this file.
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
* i.e., parser.c, gram.y, and scan.l.
8
* Definitions that are needed outside the core parser should be in parser.h.
9
*
10
*
11
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
12
* Portions Copyright (c) 1994, Regents of the University of California
13
*
14
* src/backend/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 "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
char
*
lookahead_end
;
/* end of current token */
50
char
lookahead_hold_char
;
/* to be put back at *lookahead_end */
51
52
/*
53
* State variables that belong to the grammar.
54
*/
55
List
*
parsetree
;
/* final parse result is delivered here */
56
}
base_yy_extra_type
;
57
58
/*
59
* In principle we should use yyget_extra() to fetch the yyextra field
60
* from a yyscanner struct. However, flex always puts that field first,
61
* and this is sufficiently performance-critical to make it seem worth
62
* cheating a bit to use an inline macro.
63
*/
64
#define pg_yyget_extra(yyscanner) (*((base_yy_extra_type **) (yyscanner)))
65
66
67
/* from parser.c */
68
extern
int
base_yylex
(YYSTYPE *lvalp,
YYLTYPE
*llocp,
69
core_yyscan_t
yyscanner
);
70
71
/* from gram.y */
72
extern
void
parser_init
(
base_yy_extra_type
*yyext);
73
extern
int
base_yyparse
(
core_yyscan_t
yyscanner
);
74
75
#endif
/* GRAMPARSE_H */
base_yy_extra_type
struct base_yy_extra_type base_yy_extra_type
parser_init
void parser_init(base_yy_extra_type *yyext)
base_yyparse
int base_yyparse(core_yyscan_t yyscanner)
base_yylex
int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner)
Definition:
parser.c:111
parsenodes.h
yyscanner
static core_yyscan_t yyscanner
Definition:
pl_scanner.c:106
scanner.h
YYLTYPE
#define YYLTYPE
Definition:
scanner.h:44
core_yyscan_t
void * core_yyscan_t
Definition:
scanner.h:121
List
Definition:
pg_list.h:54
base_yy_extra_type
Definition:
gramparse.h:36
base_yy_extra_type::lookahead_yylloc
YYLTYPE lookahead_yylloc
Definition:
gramparse.h:48
base_yy_extra_type::lookahead_end
char * lookahead_end
Definition:
gramparse.h:49
base_yy_extra_type::core_yy_extra
core_yy_extra_type core_yy_extra
Definition:
gramparse.h:40
base_yy_extra_type::have_lookahead
bool have_lookahead
Definition:
gramparse.h:45
base_yy_extra_type::lookahead_hold_char
char lookahead_hold_char
Definition:
gramparse.h:50
base_yy_extra_type::lookahead_token
int lookahead_token
Definition:
gramparse.h:46
base_yy_extra_type::parsetree
List * parsetree
Definition:
gramparse.h:55
base_yy_extra_type::lookahead_yylval
core_YYSTYPE lookahead_yylval
Definition:
gramparse.h:47
core_yy_extra_type
Definition:
scanner.h:67
core_YYSTYPE
Definition:
scanner.h:30
src
backend
parser
gramparse.h
Generated on Fri Oct 11 2024 00:13:18 for PostgreSQL Source Code by
1.9.1