| 1 |
/*------------------------------------------------------------------------- |
| 2 |
* |
| 3 |
* parser.h |
| 4 |
* Definitions for the "raw" parser (flex and bison phases only) |
| 5 |
* |
| 6 |
* This is the external API for the raw lexing/parsing functions. |
| 7 |
* |
| 8 |
* Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group |
| 9 |
* Portions Copyright (c) 1994, Regents of the University of California |
| 10 |
* |
| 11 |
* src/include/parser/parser.h |
| 12 |
* |
| 13 |
*------------------------------------------------------------------------- |
| 14 |
*/ |
| 15 |
#ifndef PARSER_H |
| 16 |
#define PARSER_H |
| 17 |
|
| 18 |
#include "nodes/parsenodes.h" |
| 19 |
|
| 20 |
|
| 21 |
/* |
| 22 |
* RawParseMode determines the form of the string that raw_parser() accepts: |
| 23 |
* |
| 24 |
* RAW_PARSE_DEFAULT: parse a semicolon-separated list of SQL commands, |
| 25 |
* and return a List of RawStmt nodes. |
| 26 |
* |
| 27 |
* RAW_PARSE_TYPE_NAME: parse a type name, and return a one-element List |
| 28 |
* containing a TypeName node. |
| 29 |
* |
| 30 |
* RAW_PARSE_PLPGSQL_EXPR: parse a PL/pgSQL expression, and return |
| 31 |
* a one-element List containing a RawStmt node. |
| 32 |
* |
| 33 |
* RAW_PARSE_PLPGSQL_ASSIGNn: parse a PL/pgSQL assignment statement, |
| 34 |
* and return a one-element List containing a RawStmt node. "n" |
| 35 |
* gives the number of dotted names comprising the target ColumnRef. |
| 36 |
*/ |
| 37 |
typedef enum |
| 38 |
{ |
| 39 |
RAW_PARSE_DEFAULT = 0, |
| 40 |
RAW_PARSE_TYPE_NAME, |
| 41 |
RAW_PARSE_PLPGSQL_EXPR, |
| 42 |
RAW_PARSE_PLPGSQL_ASSIGN1, |
| 43 |
RAW_PARSE_PLPGSQL_ASSIGN2, |
| 44 |
RAW_PARSE_PLPGSQL_ASSIGN3, |
| 45 |
} RawParseMode; |
| 46 |
|
| 47 |
/* Values for the backslash_quote GUC */ |
| 48 |
typedef enum |
| 49 |
{ |
| 50 |
BACKSLASH_QUOTE_OFF, |
| 51 |
BACKSLASH_QUOTE_ON, |
| 52 |
BACKSLASH_QUOTE_SAFE_ENCODING, |
| 53 |
} BackslashQuoteType; |
| 54 |
|
| 55 |
/* GUC variables in scan.l (every one of these is a bad idea :-() */ |
| 56 |
extern PGDLLIMPORT int backslash_quote; |
| 57 |
extern PGDLLIMPORT bool escape_string_warning; |
| 58 |
extern PGDLLIMPORT bool standard_conforming_strings; |
| 59 |
|
| 60 |
|
| 61 |
/* Primary entry point for the raw parsing functions */ |
| 62 |
extern List *raw_parser(const char *str, RawParseMode mode); |
| 63 |
|
| 64 |
/* Utility functions exported by gram.y (perhaps these should be elsewhere) */ |
| 65 |
extern List *SystemFuncName(char *name); |
| 66 |
extern TypeName *SystemTypeName(char *name); |
| 67 |
|
| 68 |
#endif /* PARSER_H */ |