codekingpro/portable-devtools
115k
1/*-------------------------------------------------------------------------2 *3 * parser.h4 * 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-2023, PostgreSQL Global Development Group9 * Portions Copyright (c) 1994, Regents of the University of California10 *11 * src/include/parser/parser.h12 *13 *-------------------------------------------------------------------------14 */15#ifndef PARSER_H16#define PARSER_H17 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 List28 * containing a TypeName node.29 *30 * RAW_PARSE_PLPGSQL_EXPR: parse a PL/pgSQL expression, and return31 * 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 */37typedef enum38{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_ASSIGN345} RawParseMode;46 47/* Values for the backslash_quote GUC */48typedef enum49{50 BACKSLASH_QUOTE_OFF,51 BACKSLASH_QUOTE_ON,52 BACKSLASH_QUOTE_SAFE_ENCODING53} BackslashQuoteType;54 55/* GUC variables in scan.l (every one of these is a bad idea :-() */56extern PGDLLIMPORT int backslash_quote;57extern PGDLLIMPORT bool escape_string_warning;58extern PGDLLIMPORT bool standard_conforming_strings;59 60 61/* Primary entry point for the raw parsing functions */62extern List *raw_parser(const char *str, RawParseMode mode);63 64/* Utility functions exported by gram.y (perhaps these should be elsewhere) */65extern List *SystemFuncName(char *name);66extern TypeName *SystemTypeName(char *name);67 68#endif /* PARSER_H */69 