2
0

parser.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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-2022, 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. #include "nodes/parsenodes.h"
  18. /*
  19. * RawParseMode determines the form of the string that raw_parser() accepts:
  20. *
  21. * RAW_PARSE_DEFAULT: parse a semicolon-separated list of SQL commands,
  22. * and return a List of RawStmt nodes.
  23. *
  24. * RAW_PARSE_TYPE_NAME: parse a type name, and return a one-element List
  25. * containing a TypeName node.
  26. *
  27. * RAW_PARSE_PLPGSQL_EXPR: parse a PL/pgSQL expression, and return
  28. * a one-element List containing a RawStmt node.
  29. *
  30. * RAW_PARSE_PLPGSQL_ASSIGNn: parse a PL/pgSQL assignment statement,
  31. * and return a one-element List containing a RawStmt node. "n"
  32. * gives the number of dotted names comprising the target ColumnRef.
  33. */
  34. typedef enum
  35. {
  36. RAW_PARSE_DEFAULT = 0,
  37. RAW_PARSE_TYPE_NAME,
  38. RAW_PARSE_PLPGSQL_EXPR,
  39. RAW_PARSE_PLPGSQL_ASSIGN1,
  40. RAW_PARSE_PLPGSQL_ASSIGN2,
  41. RAW_PARSE_PLPGSQL_ASSIGN3
  42. } RawParseMode;
  43. /* Values for the backslash_quote GUC */
  44. typedef enum
  45. {
  46. BACKSLASH_QUOTE_OFF,
  47. BACKSLASH_QUOTE_ON,
  48. BACKSLASH_QUOTE_SAFE_ENCODING
  49. } BackslashQuoteType;
  50. /* GUC variables in scan.l (every one of these is a bad idea :-() */
  51. extern PGDLLIMPORT int backslash_quote;
  52. extern PGDLLIMPORT bool escape_string_warning;
  53. extern PGDLLIMPORT bool standard_conforming_strings;
  54. /* Primary entry point for the raw parsing functions */
  55. extern List *raw_parser(const char *str, RawParseMode mode);
  56. /* Utility functions exported by gram.y (perhaps these should be elsewhere) */
  57. extern List *SystemFuncName(char *name);
  58. extern TypeName *SystemTypeName(char *name);
  59. #endif /* PARSER_H */