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

Go to the source code of this file.

Data Structures

struct  JsonLexContext
 
struct  JsonSemAction
 

Macros

#define JSONLEX_FREE_STRUCT   (1 << 0)
 
#define JSONLEX_FREE_STRVAL   (1 << 1)
 

Typedefs

typedef enum JsonTokenType JsonTokenType
 
typedef enum JsonParseErrorType JsonParseErrorType
 
typedef struct JsonLexContext JsonLexContext
 
typedef JsonParseErrorType(* json_struct_action) (void *state)
 
typedef JsonParseErrorType(* json_ofield_action) (void *state, char *fname, bool isnull)
 
typedef JsonParseErrorType(* json_aelem_action) (void *state, bool isnull)
 
typedef JsonParseErrorType(* json_scalar_action) (void *state, char *token, JsonTokenType tokentype)
 
typedef struct JsonSemAction JsonSemAction
 

Enumerations

enum  JsonTokenType {
  JSON_TOKEN_INVALID , JSON_TOKEN_STRING , JSON_TOKEN_NUMBER , JSON_TOKEN_OBJECT_START ,
  JSON_TOKEN_OBJECT_END , JSON_TOKEN_ARRAY_START , JSON_TOKEN_ARRAY_END , JSON_TOKEN_COMMA ,
  JSON_TOKEN_COLON , JSON_TOKEN_TRUE , JSON_TOKEN_FALSE , JSON_TOKEN_NULL ,
  JSON_TOKEN_END
}
 
enum  JsonParseErrorType {
  JSON_SUCCESS , JSON_ESCAPING_INVALID , JSON_ESCAPING_REQUIRED , JSON_EXPECTED_ARRAY_FIRST ,
  JSON_EXPECTED_ARRAY_NEXT , JSON_EXPECTED_COLON , JSON_EXPECTED_END , JSON_EXPECTED_JSON ,
  JSON_EXPECTED_MORE , JSON_EXPECTED_OBJECT_FIRST , JSON_EXPECTED_OBJECT_NEXT , JSON_EXPECTED_STRING ,
  JSON_INVALID_TOKEN , JSON_UNICODE_CODE_POINT_ZERO , JSON_UNICODE_ESCAPE_FORMAT , JSON_UNICODE_HIGH_ESCAPE ,
  JSON_UNICODE_UNTRANSLATABLE , JSON_UNICODE_HIGH_SURROGATE , JSON_UNICODE_LOW_SURROGATE , JSON_SEM_ACTION_FAILED
}
 

Functions

JsonParseErrorType pg_parse_json (JsonLexContext *lex, JsonSemAction *sem)
 
JsonParseErrorType json_count_array_elements (JsonLexContext *lex, int *elements)
 
JsonLexContextmakeJsonLexContextCstringLen (JsonLexContext *lex, char *json, int len, int encoding, bool need_escapes)
 
void freeJsonLexContext (JsonLexContext *lex)
 
JsonParseErrorType json_lex (JsonLexContext *lex)
 
char * json_errdetail (JsonParseErrorType error, JsonLexContext *lex)
 
bool IsValidJsonNumber (const char *str, int len)
 

Variables

PGDLLIMPORT JsonSemAction nullSemAction
 

Macro Definition Documentation

◆ JSONLEX_FREE_STRUCT

#define JSONLEX_FREE_STRUCT   (1 << 0)

Definition at line 76 of file jsonapi.h.

◆ JSONLEX_FREE_STRVAL

#define JSONLEX_FREE_STRVAL   (1 << 1)

Definition at line 77 of file jsonapi.h.

Typedef Documentation

◆ json_aelem_action

typedef JsonParseErrorType(* json_aelem_action) (void *state, bool isnull)

Definition at line 96 of file jsonapi.h.

◆ json_ofield_action

typedef JsonParseErrorType(* json_ofield_action) (void *state, char *fname, bool isnull)

Definition at line 95 of file jsonapi.h.

◆ json_scalar_action

typedef JsonParseErrorType(* json_scalar_action) (void *state, char *token, JsonTokenType tokentype)

Definition at line 97 of file jsonapi.h.

◆ json_struct_action

typedef JsonParseErrorType(* json_struct_action) (void *state)

Definition at line 94 of file jsonapi.h.

◆ JsonLexContext

◆ JsonParseErrorType

◆ JsonSemAction

typedef struct JsonSemAction JsonSemAction

◆ JsonTokenType

Enumeration Type Documentation

◆ JsonParseErrorType

Enumerator
JSON_SUCCESS 
JSON_ESCAPING_INVALID 
JSON_ESCAPING_REQUIRED 
JSON_EXPECTED_ARRAY_FIRST 
JSON_EXPECTED_ARRAY_NEXT 
JSON_EXPECTED_COLON 
JSON_EXPECTED_END 
JSON_EXPECTED_JSON 
JSON_EXPECTED_MORE 
JSON_EXPECTED_OBJECT_FIRST 
JSON_EXPECTED_OBJECT_NEXT 
JSON_EXPECTED_STRING 
JSON_INVALID_TOKEN 
JSON_UNICODE_CODE_POINT_ZERO 
JSON_UNICODE_ESCAPE_FORMAT 
JSON_UNICODE_HIGH_ESCAPE 
JSON_UNICODE_UNTRANSLATABLE 
JSON_UNICODE_HIGH_SURROGATE 
JSON_UNICODE_LOW_SURROGATE 
JSON_SEM_ACTION_FAILED 

Definition at line 36 of file jsonapi.h.

37 {
57  JSON_SEM_ACTION_FAILED, /* error should already be reported */
JsonParseErrorType
Definition: jsonapi.h:37
@ JSON_SEM_ACTION_FAILED
Definition: jsonapi.h:57
@ JSON_EXPECTED_ARRAY_FIRST
Definition: jsonapi.h:41
@ JSON_EXPECTED_MORE
Definition: jsonapi.h:46
@ JSON_UNICODE_HIGH_SURROGATE
Definition: jsonapi.h:55
@ JSON_EXPECTED_COLON
Definition: jsonapi.h:43
@ JSON_EXPECTED_OBJECT_FIRST
Definition: jsonapi.h:47
@ JSON_UNICODE_CODE_POINT_ZERO
Definition: jsonapi.h:51
@ JSON_EXPECTED_STRING
Definition: jsonapi.h:49
@ JSON_UNICODE_ESCAPE_FORMAT
Definition: jsonapi.h:52
@ JSON_SUCCESS
Definition: jsonapi.h:38
@ JSON_UNICODE_UNTRANSLATABLE
Definition: jsonapi.h:54
@ JSON_EXPECTED_OBJECT_NEXT
Definition: jsonapi.h:48
@ JSON_ESCAPING_REQUIRED
Definition: jsonapi.h:40
@ JSON_EXPECTED_JSON
Definition: jsonapi.h:45
@ JSON_INVALID_TOKEN
Definition: jsonapi.h:50
@ JSON_ESCAPING_INVALID
Definition: jsonapi.h:39
@ JSON_EXPECTED_END
Definition: jsonapi.h:44
@ JSON_EXPECTED_ARRAY_NEXT
Definition: jsonapi.h:42
@ JSON_UNICODE_HIGH_ESCAPE
Definition: jsonapi.h:53
@ JSON_UNICODE_LOW_SURROGATE
Definition: jsonapi.h:56

◆ JsonTokenType

Enumerator
JSON_TOKEN_INVALID 
JSON_TOKEN_STRING 
JSON_TOKEN_NUMBER 
JSON_TOKEN_OBJECT_START 
JSON_TOKEN_OBJECT_END 
JSON_TOKEN_ARRAY_START 
JSON_TOKEN_ARRAY_END 
JSON_TOKEN_COMMA 
JSON_TOKEN_COLON 
JSON_TOKEN_TRUE 
JSON_TOKEN_FALSE 
JSON_TOKEN_NULL 
JSON_TOKEN_END 

Definition at line 19 of file jsonapi.h.

20 {
JsonTokenType
Definition: jsonapi.h:20
@ JSON_TOKEN_INVALID
Definition: jsonapi.h:21
@ JSON_TOKEN_COMMA
Definition: jsonapi.h:28
@ JSON_TOKEN_FALSE
Definition: jsonapi.h:31
@ JSON_TOKEN_END
Definition: jsonapi.h:33
@ JSON_TOKEN_TRUE
Definition: jsonapi.h:30
@ JSON_TOKEN_OBJECT_END
Definition: jsonapi.h:25
@ JSON_TOKEN_NULL
Definition: jsonapi.h:32
@ JSON_TOKEN_ARRAY_END
Definition: jsonapi.h:27
@ JSON_TOKEN_OBJECT_START
Definition: jsonapi.h:24
@ JSON_TOKEN_NUMBER
Definition: jsonapi.h:23
@ JSON_TOKEN_STRING
Definition: jsonapi.h:22
@ JSON_TOKEN_COLON
Definition: jsonapi.h:29
@ JSON_TOKEN_ARRAY_START
Definition: jsonapi.h:26

Function Documentation

◆ freeJsonLexContext()

void freeJsonLexContext ( JsonLexContext lex)

◆ IsValidJsonNumber()

bool IsValidJsonNumber ( const char *  str,
int  len 
)

Definition at line 105 of file jsonapi.c.

106 {
107  bool numeric_error;
108  int total_len;
109  JsonLexContext dummy_lex;
110 
111  if (len <= 0)
112  return false;
113 
114  /*
115  * json_lex_number expects a leading '-' to have been eaten already.
116  *
117  * having to cast away the constness of str is ugly, but there's not much
118  * easy alternative.
119  */
120  if (*str == '-')
121  {
122  dummy_lex.input = unconstify(char *, str) + 1;
123  dummy_lex.input_length = len - 1;
124  }
125  else
126  {
127  dummy_lex.input = unconstify(char *, str);
128  dummy_lex.input_length = len;
129  }
130 
131  json_lex_number(&dummy_lex, dummy_lex.input, &numeric_error, &total_len);
132 
133  return (!numeric_error) && (total_len == dummy_lex.input_length);
134 }
#define unconstify(underlying_type, expr)
Definition: c.h:1234
static JsonParseErrorType json_lex_number(JsonLexContext *lex, char *s, bool *num_err, int *total_len)
Definition: jsonapi.c:1011
const void size_t len
char * input
Definition: jsonapi.h:80
int input_length
Definition: jsonapi.h:81

References JsonLexContext::input, JsonLexContext::input_length, json_lex_number(), len, generate_unaccent_rules::str, and unconstify.

Referenced by hstore_to_json_loose(), and hstore_to_jsonb_loose().

◆ json_count_array_elements()

JsonParseErrorType json_count_array_elements ( JsonLexContext lex,
int *  elements 
)

Definition at line 245 of file jsonapi.c.

246 {
247  JsonLexContext copylex;
248  int count;
249  JsonParseErrorType result;
250 
251  /*
252  * It's safe to do this with a shallow copy because the lexical routines
253  * don't scribble on the input. They do scribble on the other pointers
254  * etc, so doing this with a copy makes that safe.
255  */
256  memcpy(&copylex, lex, sizeof(JsonLexContext));
257  copylex.strval = NULL; /* not interested in values here */
258  copylex.lex_level++;
259 
260  count = 0;
261  result = lex_expect(JSON_PARSE_ARRAY_START, &copylex,
263  if (result != JSON_SUCCESS)
264  return result;
265  if (lex_peek(&copylex) != JSON_TOKEN_ARRAY_END)
266  {
267  while (1)
268  {
269  count++;
270  result = parse_array_element(&copylex, &nullSemAction);
271  if (result != JSON_SUCCESS)
272  return result;
273  if (copylex.token_type != JSON_TOKEN_COMMA)
274  break;
275  result = json_lex(&copylex);
276  if (result != JSON_SUCCESS)
277  return result;
278  }
279  }
280  result = lex_expect(JSON_PARSE_ARRAY_NEXT, &copylex,
282  if (result != JSON_SUCCESS)
283  return result;
284 
285  *elements = count;
286  return JSON_SUCCESS;
287 }
@ JSON_PARSE_ARRAY_START
Definition: jsonapi.c:37
@ JSON_PARSE_ARRAY_NEXT
Definition: jsonapi.c:38
static JsonParseErrorType parse_array_element(JsonLexContext *lex, JsonSemAction *sem)
Definition: jsonapi.c:479
static JsonTokenType lex_peek(JsonLexContext *lex)
Definition: jsonapi.c:71
JsonSemAction nullSemAction
Definition: jsonapi.c:57
static JsonParseErrorType lex_expect(JsonParseContext ctx, JsonLexContext *lex, JsonTokenType token)
Definition: jsonapi.c:83
JsonParseErrorType json_lex(JsonLexContext *lex)
Definition: jsonapi.c:588
int lex_level
Definition: jsonapi.h:87
JsonTokenType token_type
Definition: jsonapi.h:86

References json_lex(), JSON_PARSE_ARRAY_NEXT, JSON_PARSE_ARRAY_START, JSON_SUCCESS, JSON_TOKEN_ARRAY_END, JSON_TOKEN_ARRAY_START, JSON_TOKEN_COMMA, lex_expect(), JsonLexContext::lex_level, lex_peek(), nullSemAction, parse_array_element(), JsonLexContext::strval, and JsonLexContext::token_type.

Referenced by get_array_start().

◆ json_errdetail()

char* json_errdetail ( JsonParseErrorType  error,
JsonLexContext lex 
)

Definition at line 1172 of file jsonapi.c.

1173 {
1174  switch (error)
1175  {
1176  case JSON_SUCCESS:
1177  /* fall through to the error code after switch */
1178  break;
1179  case JSON_ESCAPING_INVALID:
1180  return psprintf(_("Escape sequence \"\\%s\" is invalid."),
1181  extract_token(lex));
1183  return psprintf(_("Character with value 0x%02x must be escaped."),
1184  (unsigned char) *(lex->token_terminator));
1185  case JSON_EXPECTED_END:
1186  return psprintf(_("Expected end of input, but found \"%s\"."),
1187  extract_token(lex));
1189  return psprintf(_("Expected array element or \"]\", but found \"%s\"."),
1190  extract_token(lex));
1192  return psprintf(_("Expected \",\" or \"]\", but found \"%s\"."),
1193  extract_token(lex));
1194  case JSON_EXPECTED_COLON:
1195  return psprintf(_("Expected \":\", but found \"%s\"."),
1196  extract_token(lex));
1197  case JSON_EXPECTED_JSON:
1198  return psprintf(_("Expected JSON value, but found \"%s\"."),
1199  extract_token(lex));
1200  case JSON_EXPECTED_MORE:
1201  return _("The input string ended unexpectedly.");
1203  return psprintf(_("Expected string or \"}\", but found \"%s\"."),
1204  extract_token(lex));
1206  return psprintf(_("Expected \",\" or \"}\", but found \"%s\"."),
1207  extract_token(lex));
1208  case JSON_EXPECTED_STRING:
1209  return psprintf(_("Expected string, but found \"%s\"."),
1210  extract_token(lex));
1211  case JSON_INVALID_TOKEN:
1212  return psprintf(_("Token \"%s\" is invalid."),
1213  extract_token(lex));
1215  return _("\\u0000 cannot be converted to text.");
1217  return _("\"\\u\" must be followed by four hexadecimal digits.");
1219  /* note: this case is only reachable in frontend not backend */
1220  return _("Unicode escape values cannot be used for code point values above 007F when the encoding is not UTF8.");
1222  /* note: this case is only reachable in backend not frontend */
1223  return psprintf(_("Unicode escape value could not be translated to the server's encoding %s."),
1226  return _("Unicode high surrogate must not follow a high surrogate.");
1228  return _("Unicode low surrogate must follow a high surrogate.");
1230  /* fall through to the error code after switch */
1231  break;
1232  }
1233 
1234  /*
1235  * We don't use a default: case, so that the compiler will warn about
1236  * unhandled enum values. But this needs to be here anyway to cover the
1237  * possibility of an incorrect input.
1238  */
1239  elog(ERROR, "unexpected json parse error type: %d", (int) error);
1240  return NULL;
1241 }
#define _(x)
Definition: elog.c:91
#define ERROR
Definition: elog.h:39
static char * extract_token(JsonLexContext *lex)
Definition: jsonapi.c:1154
const char * GetDatabaseEncodingName(void)
Definition: mbutils.c:1274
char * psprintf(const char *fmt,...)
Definition: psprintf.c:46
static void error(void)
Definition: sql-dyntest.c:147
char * token_terminator
Definition: jsonapi.h:84

References _, elog(), ERROR, error(), extract_token(), GetDatabaseEncodingName(), JSON_ESCAPING_INVALID, JSON_ESCAPING_REQUIRED, JSON_EXPECTED_ARRAY_FIRST, JSON_EXPECTED_ARRAY_NEXT, JSON_EXPECTED_COLON, JSON_EXPECTED_END, JSON_EXPECTED_JSON, JSON_EXPECTED_MORE, JSON_EXPECTED_OBJECT_FIRST, JSON_EXPECTED_OBJECT_NEXT, JSON_EXPECTED_STRING, JSON_INVALID_TOKEN, JSON_SEM_ACTION_FAILED, JSON_SUCCESS, JSON_UNICODE_CODE_POINT_ZERO, JSON_UNICODE_ESCAPE_FORMAT, JSON_UNICODE_HIGH_ESCAPE, JSON_UNICODE_HIGH_SURROGATE, JSON_UNICODE_LOW_SURROGATE, JSON_UNICODE_UNTRANSLATABLE, psprintf(), and JsonLexContext::token_terminator.

Referenced by json_errsave_error().

◆ json_lex()

JsonParseErrorType json_lex ( JsonLexContext lex)

Definition at line 588 of file jsonapi.c.

589 {
590  char *s;
591  char *const end = lex->input + lex->input_length;
592  JsonParseErrorType result;
593 
594  /* Skip leading whitespace. */
595  s = lex->token_terminator;
596  while (s < end && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r'))
597  {
598  if (*s++ == '\n')
599  {
600  ++lex->line_number;
601  lex->line_start = s;
602  }
603  }
604  lex->token_start = s;
605 
606  /* Determine token type. */
607  if (s >= end)
608  {
609  lex->token_start = NULL;
611  lex->token_terminator = s;
612  lex->token_type = JSON_TOKEN_END;
613  }
614  else
615  {
616  switch (*s)
617  {
618  /* Single-character token, some kind of punctuation mark. */
619  case '{':
621  lex->token_terminator = s + 1;
623  break;
624  case '}':
626  lex->token_terminator = s + 1;
628  break;
629  case '[':
631  lex->token_terminator = s + 1;
633  break;
634  case ']':
636  lex->token_terminator = s + 1;
638  break;
639  case ',':
641  lex->token_terminator = s + 1;
643  break;
644  case ':':
646  lex->token_terminator = s + 1;
648  break;
649  case '"':
650  /* string */
651  result = json_lex_string(lex);
652  if (result != JSON_SUCCESS)
653  return result;
655  break;
656  case '-':
657  /* Negative number. */
658  result = json_lex_number(lex, s + 1, NULL, NULL);
659  if (result != JSON_SUCCESS)
660  return result;
662  break;
663  case '0':
664  case '1':
665  case '2':
666  case '3':
667  case '4':
668  case '5':
669  case '6':
670  case '7':
671  case '8':
672  case '9':
673  /* Positive number. */
674  result = json_lex_number(lex, s, NULL, NULL);
675  if (result != JSON_SUCCESS)
676  return result;
678  break;
679  default:
680  {
681  char *p;
682 
683  /*
684  * We're not dealing with a string, number, legal
685  * punctuation mark, or end of string. The only legal
686  * tokens we might find here are true, false, and null,
687  * but for error reporting purposes we scan until we see a
688  * non-alphanumeric character. That way, we can report
689  * the whole word as an unexpected token, rather than just
690  * some unintuitive prefix thereof.
691  */
692  for (p = s; p < end && JSON_ALPHANUMERIC_CHAR(*p); p++)
693  /* skip */ ;
694 
695  /*
696  * We got some sort of unexpected punctuation or an
697  * otherwise unexpected character, so just complain about
698  * that one character.
699  */
700  if (p == s)
701  {
703  lex->token_terminator = s + 1;
704  return JSON_INVALID_TOKEN;
705  }
706 
707  /*
708  * We've got a real alphanumeric token here. If it
709  * happens to be true, false, or null, all is well. If
710  * not, error out.
711  */
713  lex->token_terminator = p;
714  if (p - s == 4)
715  {
716  if (memcmp(s, "true", 4) == 0)
718  else if (memcmp(s, "null", 4) == 0)
720  else
721  return JSON_INVALID_TOKEN;
722  }
723  else if (p - s == 5 && memcmp(s, "false", 5) == 0)
725  else
726  return JSON_INVALID_TOKEN;
727  }
728  } /* end of switch */
729  }
730 
731  return JSON_SUCCESS;
732 }
if(TABLE==NULL||TABLE_index==NULL)
Definition: isn.c:77
static JsonParseErrorType json_lex_string(JsonLexContext *lex)
Definition: jsonapi.c:746
#define JSON_ALPHANUMERIC_CHAR(c)
Definition: jsonapi.c:92
char * token_start
Definition: jsonapi.h:83
char * prev_token_terminator
Definition: jsonapi.h:85
char * line_start
Definition: jsonapi.h:90
int line_number
Definition: jsonapi.h:89

References if(), JsonLexContext::input, JsonLexContext::input_length, JSON_ALPHANUMERIC_CHAR, JSON_INVALID_TOKEN, json_lex_number(), json_lex_string(), JSON_SUCCESS, JSON_TOKEN_ARRAY_END, JSON_TOKEN_ARRAY_START, JSON_TOKEN_COLON, JSON_TOKEN_COMMA, JSON_TOKEN_END, JSON_TOKEN_FALSE, JSON_TOKEN_NULL, JSON_TOKEN_NUMBER, JSON_TOKEN_OBJECT_END, JSON_TOKEN_OBJECT_START, JSON_TOKEN_STRING, JSON_TOKEN_TRUE, JsonLexContext::line_number, JsonLexContext::line_start, JsonLexContext::prev_token_terminator, JsonLexContext::token_start, JsonLexContext::token_terminator, and JsonLexContext::token_type.

Referenced by json_count_array_elements(), json_get_first_token(), json_typeof(), lex_expect(), parse_array(), parse_object(), parse_object_field(), parse_scalar(), and pg_parse_json().

◆ makeJsonLexContextCstringLen()

JsonLexContext* makeJsonLexContextCstringLen ( JsonLexContext lex,
char *  json,
int  len,
int  encoding,
bool  need_escapes 
)

Definition at line 153 of file jsonapi.c.

155 {
156  if (lex == NULL)
157  {
158  lex = palloc0(sizeof(JsonLexContext));
159  lex->flags |= JSONLEX_FREE_STRUCT;
160  }
161  else
162  memset(lex, 0, sizeof(JsonLexContext));
163 
164  lex->input = lex->token_terminator = lex->line_start = json;
165  lex->line_number = 1;
166  lex->input_length = len;
167  lex->input_encoding = encoding;
168  if (need_escapes)
169  {
170  lex->strval = makeStringInfo();
171  lex->flags |= JSONLEX_FREE_STRVAL;
172  }
173 
174  return lex;
175 }
void * palloc0(Size size)
Definition: mcxt.c:1232
int32 encoding
Definition: pg_database.h:41
StringInfo makeStringInfo(void)
Definition: stringinfo.c:41
int input_encoding
Definition: jsonapi.h:82

References encoding, JsonLexContext::flags, JsonLexContext::input, JsonLexContext::input_encoding, JsonLexContext::input_length, JSONLEX_FREE_STRUCT, JSONLEX_FREE_STRVAL, len, JsonLexContext::line_number, JsonLexContext::line_start, makeStringInfo(), palloc0(), JsonLexContext::strval, and JsonLexContext::token_terminator.

Referenced by get_json_object_as_hash(), json_parse_manifest(), json_recv(), jsonb_from_cstring(), makeJsonLexContext(), and populate_array_json().

◆ pg_parse_json()

JsonParseErrorType pg_parse_json ( JsonLexContext lex,
JsonSemAction sem 
)

Definition at line 205 of file jsonapi.c.

206 {
207  JsonTokenType tok;
208  JsonParseErrorType result;
209 
210  /* get the initial token */
211  result = json_lex(lex);
212  if (result != JSON_SUCCESS)
213  return result;
214 
215  tok = lex_peek(lex);
216 
217  /* parse by recursive descent */
218  switch (tok)
219  {
221  result = parse_object(lex, sem);
222  break;
224  result = parse_array(lex, sem);
225  break;
226  default:
227  result = parse_scalar(lex, sem); /* json can be a bare scalar */
228  }
229 
230  if (result == JSON_SUCCESS)
231  result = lex_expect(JSON_PARSE_END, lex, JSON_TOKEN_END);
232 
233  return result;
234 }
@ JSON_PARSE_END
Definition: jsonapi.c:43
static JsonParseErrorType parse_object(JsonLexContext *lex, JsonSemAction *sem)
Definition: jsonapi.c:405
static JsonParseErrorType parse_array(JsonLexContext *lex, JsonSemAction *sem)
Definition: jsonapi.c:523
static JsonParseErrorType parse_scalar(JsonLexContext *lex, JsonSemAction *sem)
Definition: jsonapi.c:299

References json_lex(), JSON_PARSE_END, JSON_SUCCESS, JSON_TOKEN_ARRAY_START, JSON_TOKEN_END, JSON_TOKEN_OBJECT_START, lex_expect(), lex_peek(), parse_array(), parse_object(), and parse_scalar().

Referenced by json_parse_manifest(), json_validate(), and pg_parse_json_or_errsave().

Variable Documentation

◆ nullSemAction

PGDLLIMPORT JsonSemAction nullSemAction
extern

Definition at line 57 of file jsonapi.c.

Referenced by json_count_array_elements(), json_in(), json_recv(), and json_validate().