PostgreSQL Source Code  git master
parser.h File Reference
#include "nodes/parsenodes.h"
Include dependency graph for parser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Enumerations

enum  RawParseMode {
  RAW_PARSE_DEFAULT = 0 , RAW_PARSE_TYPE_NAME , RAW_PARSE_PLPGSQL_EXPR , RAW_PARSE_PLPGSQL_ASSIGN1 ,
  RAW_PARSE_PLPGSQL_ASSIGN2 , RAW_PARSE_PLPGSQL_ASSIGN3
}
 
enum  BackslashQuoteType { BACKSLASH_QUOTE_OFF , BACKSLASH_QUOTE_ON , BACKSLASH_QUOTE_SAFE_ENCODING }
 

Functions

Listraw_parser (const char *str, RawParseMode mode)
 
ListSystemFuncName (char *name)
 
TypeNameSystemTypeName (char *name)
 

Variables

PGDLLIMPORT int backslash_quote
 
PGDLLIMPORT bool escape_string_warning
 
PGDLLIMPORT bool standard_conforming_strings
 

Enumeration Type Documentation

◆ BackslashQuoteType

Enumerator
BACKSLASH_QUOTE_OFF 
BACKSLASH_QUOTE_ON 
BACKSLASH_QUOTE_SAFE_ENCODING 

Definition at line 48 of file parser.h.

49 {
BackslashQuoteType
Definition: parser.h:49
@ BACKSLASH_QUOTE_ON
Definition: parser.h:51
@ BACKSLASH_QUOTE_SAFE_ENCODING
Definition: parser.h:52
@ BACKSLASH_QUOTE_OFF
Definition: parser.h:50

◆ RawParseMode

Enumerator
RAW_PARSE_DEFAULT 
RAW_PARSE_TYPE_NAME 
RAW_PARSE_PLPGSQL_EXPR 
RAW_PARSE_PLPGSQL_ASSIGN1 
RAW_PARSE_PLPGSQL_ASSIGN2 
RAW_PARSE_PLPGSQL_ASSIGN3 

Definition at line 37 of file parser.h.

38 {
45 } RawParseMode;
RawParseMode
Definition: parser.h:38
@ RAW_PARSE_PLPGSQL_EXPR
Definition: parser.h:41
@ RAW_PARSE_PLPGSQL_ASSIGN2
Definition: parser.h:43
@ RAW_PARSE_PLPGSQL_ASSIGN1
Definition: parser.h:42
@ RAW_PARSE_TYPE_NAME
Definition: parser.h:40
@ RAW_PARSE_PLPGSQL_ASSIGN3
Definition: parser.h:44
@ RAW_PARSE_DEFAULT
Definition: parser.h:39

Function Documentation

◆ raw_parser()

List* raw_parser ( const char *  str,
RawParseMode  mode 
)

Definition at line 42 of file parser.c.

43 {
45  base_yy_extra_type yyextra;
46  int yyresult;
47 
48  /* initialize the flex scanner */
51 
52  /* base_yylex() only needs us to initialize the lookahead token, if any */
53  if (mode == RAW_PARSE_DEFAULT)
54  yyextra.have_lookahead = false;
55  else
56  {
57  /* this array is indexed by RawParseMode enum */
58  static const int mode_token[] = {
59  [RAW_PARSE_DEFAULT] = 0,
60  [RAW_PARSE_TYPE_NAME] = MODE_TYPE_NAME,
61  [RAW_PARSE_PLPGSQL_EXPR] = MODE_PLPGSQL_EXPR,
62  [RAW_PARSE_PLPGSQL_ASSIGN1] = MODE_PLPGSQL_ASSIGN1,
63  [RAW_PARSE_PLPGSQL_ASSIGN2] = MODE_PLPGSQL_ASSIGN2,
64  [RAW_PARSE_PLPGSQL_ASSIGN3] = MODE_PLPGSQL_ASSIGN3,
65  };
66 
67  yyextra.have_lookahead = true;
68  yyextra.lookahead_token = mode_token[mode];
69  yyextra.lookahead_yylloc = 0;
70  yyextra.lookahead_end = NULL;
71  }
72 
73  /* initialize the bison parser */
74  parser_init(&yyextra);
75 
76  /* Parse! */
77  yyresult = base_yyparse(yyscanner);
78 
79  /* Clean up (release memory) */
81 
82  if (yyresult) /* error */
83  return NIL;
84 
85  return yyextra.parsetree;
86 }
void parser_init(base_yy_extra_type *yyext)
int base_yyparse(core_yyscan_t yyscanner)
const char * str
PGDLLIMPORT const ScanKeywordList ScanKeywords
static PgChecksumMode mode
Definition: pg_checksums.c:55
#define NIL
Definition: pg_list.h:68
static core_yyscan_t yyscanner
Definition: pl_scanner.c:106
core_yyscan_t scanner_init(const char *str, core_yy_extra_type *yyext, const ScanKeywordList *keywordlist, const uint16 *keyword_tokens)
void scanner_finish(core_yyscan_t yyscanner)
PGDLLIMPORT const uint16 ScanKeywordTokens[]
void * core_yyscan_t
Definition: scanner.h:121
YYLTYPE lookahead_yylloc
Definition: gramparse.h:48
char * lookahead_end
Definition: gramparse.h:49
core_yy_extra_type core_yy_extra
Definition: gramparse.h:40

References base_yyparse(), base_yy_extra_type::core_yy_extra, base_yy_extra_type::have_lookahead, base_yy_extra_type::lookahead_end, base_yy_extra_type::lookahead_token, base_yy_extra_type::lookahead_yylloc, mode, NIL, parser_init(), base_yy_extra_type::parsetree, RAW_PARSE_DEFAULT, RAW_PARSE_PLPGSQL_ASSIGN1, RAW_PARSE_PLPGSQL_ASSIGN2, RAW_PARSE_PLPGSQL_ASSIGN3, RAW_PARSE_PLPGSQL_EXPR, RAW_PARSE_TYPE_NAME, ScanKeywords, ScanKeywordTokens, scanner_finish(), scanner_init(), str, and yyscanner.

Referenced by _SPI_prepare_oneshot_plan(), _SPI_prepare_plan(), ATPostAlterTypeParse(), pg_parse_query(), and typeStringToTypeName().

◆ SystemFuncName()

◆ SystemTypeName()

TypeName* SystemTypeName ( char *  name)

Variable Documentation

◆ backslash_quote

PGDLLIMPORT int backslash_quote
extern

◆ escape_string_warning

PGDLLIMPORT bool escape_string_warning
extern

◆ standard_conforming_strings

PGDLLIMPORT bool standard_conforming_strings
extern

Referenced by simple_quote_literal().