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

int backslash_quote
 
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.

◆ 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.

Function Documentation

◆ raw_parser()

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

Definition at line 42 of file parser.c.

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, ScanKeywords, ScanKeywordTokens, scanner_finish(), scanner_init(), and yyscanner.

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

43 {
45  base_yy_extra_type yyextra;
46  int yyresult;
47 
48  /* initialize the flex scanner */
49  yyscanner = scanner_init(str, &yyextra.core_yy_extra,
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  0, /* RAW_PARSE_DEFAULT */
60  MODE_TYPE_NAME, /* RAW_PARSE_TYPE_NAME */
61  MODE_PLPGSQL_EXPR, /* RAW_PARSE_PLPGSQL_EXPR */
62  MODE_PLPGSQL_ASSIGN1, /* RAW_PARSE_PLPGSQL_ASSIGN1 */
63  MODE_PLPGSQL_ASSIGN2, /* RAW_PARSE_PLPGSQL_ASSIGN2 */
64  MODE_PLPGSQL_ASSIGN3 /* RAW_PARSE_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) */
80  scanner_finish(yyscanner);
81 
82  if (yyresult) /* error */
83  return NIL;
84 
85  return yyextra.parsetree;
86 }
#define NIL
Definition: pg_list.h:65
static PgChecksumMode mode
Definition: pg_checksums.c:61
char * lookahead_end
Definition: gramparse.h:49
int base_yyparse(core_yyscan_t yyscanner)
void * core_yyscan_t
Definition: scanner.h:121
PGDLLIMPORT const uint16 ScanKeywordTokens[]
core_yy_extra_type core_yy_extra
Definition: gramparse.h:40
PGDLLIMPORT const ScanKeywordList ScanKeywords
void parser_init(base_yy_extra_type *yyext)
core_yyscan_t scanner_init(const char *str, core_yy_extra_type *yyext, const ScanKeywordList *keywordlist, const uint16 *keyword_tokens)
YYLTYPE lookahead_yylloc
Definition: gramparse.h:48
static core_yyscan_t yyscanner
Definition: pl_scanner.c:106
void scanner_finish(core_yyscan_t yyscanner)

◆ SystemFuncName()

◆ SystemTypeName()

TypeName* SystemTypeName ( char *  name)

Variable Documentation

◆ backslash_quote

int backslash_quote

◆ escape_string_warning

bool escape_string_warning

◆ standard_conforming_strings

PGDLLIMPORT bool standard_conforming_strings

Referenced by simple_quote_literal().