PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "common/jsonapi.h"
#include "mb/pg_wchar.h"
#include "port/pg_lfind.h"
#include "miscadmin.h"
Go to the source code of this file.
Macros | |
#define | JSON_ALPHANUMERIC_CHAR(c) |
#define | FAIL_AT_CHAR_START(code) |
#define | FAIL_AT_CHAR_END(code) |
Variables | |
JsonSemAction | nullSemAction |
#define FAIL_AT_CHAR_END | ( | code | ) |
#define FAIL_AT_CHAR_START | ( | code | ) |
#define JSON_ALPHANUMERIC_CHAR | ( | c | ) |
enum JsonParseContext |
|
static |
Definition at line 1118 of file jsonapi.c.
References palloc(), token, JsonLexContext::token_start, and JsonLexContext::token_terminator.
Referenced by json_errdetail().
bool IsValidJsonNumber | ( | const char * | str, |
int | len | ||
) |
Definition at line 105 of file jsonapi.c.
References JsonLexContext::input, JsonLexContext::input_length, json_lex_number(), len, generate_unaccent_rules::str, and unconstify.
Referenced by datum_to_json(), hstore_to_json_loose(), and hstore_to_jsonb_loose().
JsonParseErrorType json_count_array_elements | ( | JsonLexContext * | lex, |
int * | elements | ||
) |
Definition at line 209 of file jsonapi.c.
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().
char* json_errdetail | ( | JsonParseErrorType | error, |
JsonLexContext * | lex | ||
) |
Definition at line 1136 of file jsonapi.c.
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().
JsonParseErrorType json_lex | ( | JsonLexContext * | lex | ) |
Definition at line 552 of file jsonapi.c.
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().
|
inlinestatic |
Definition at line 975 of file jsonapi.c.
References error(), JsonLexContext::input, JsonLexContext::input_length, JSON_ALPHANUMERIC_CHAR, JSON_INVALID_TOKEN, JSON_SUCCESS, len, JsonLexContext::prev_token_terminator, and JsonLexContext::token_terminator.
Referenced by IsValidJsonNumber(), and json_lex().
|
inlinestatic |
Definition at line 710 of file jsonapi.c.
References appendBinaryStringInfo(), appendStringInfoChar(), appendStringInfoString(), Assert(), FAIL_AT_CHAR_END, FAIL_AT_CHAR_START, i, JsonLexContext::input, JsonLexContext::input_encoding, JsonLexContext::input_length, is_utf16_surrogate_first(), is_utf16_surrogate_second(), JSON_ESCAPING_INVALID, JSON_ESCAPING_REQUIRED, JSON_INVALID_TOKEN, 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, MAX_UNICODE_EQUIVALENT_STRING, pg_lfind8(), pg_lfind8_le(), pg_unicode_to_server_noerror(), PG_UTF8, pg_utf_mblen(), JsonLexContext::prev_token_terminator, resetStringInfo(), JsonLexContext::strval, surrogate_pair_to_codepoint(), JsonLexContext::token_start, JsonLexContext::token_terminator, and unicode_to_utf8().
Referenced by json_lex().
|
inlinestatic |
Definition at line 83 of file jsonapi.c.
References json_lex(), lex_peek(), report_parse_error(), and token.
Referenced by json_count_array_elements(), parse_array(), parse_object(), parse_object_field(), and pg_parse_json().
|
inlinestatic |
Definition at line 71 of file jsonapi.c.
References JsonLexContext::token_type.
Referenced by json_count_array_elements(), lex_expect(), parse_array(), parse_array_element(), parse_object(), parse_object_field(), parse_scalar(), and pg_parse_json().
JsonLexContext* makeJsonLexContextCstringLen | ( | char * | json, |
int | len, | ||
int | encoding, | ||
bool | need_escapes | ||
) |
Definition at line 145 of file jsonapi.c.
References encoding, JsonLexContext::input, JsonLexContext::input_encoding, JsonLexContext::input_length, 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().
|
static |
Definition at line 487 of file jsonapi.c.
References JsonSemAction::array_end, JsonSemAction::array_start, check_stack_depth(), 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(), parse_array_element(), and JsonSemAction::semstate.
Referenced by parse_array_element(), parse_object_field(), and pg_parse_json().
|
static |
Definition at line 443 of file jsonapi.c.
References JsonSemAction::array_element_end, JsonSemAction::array_element_start, JSON_SUCCESS, JSON_TOKEN_ARRAY_START, JSON_TOKEN_NULL, JSON_TOKEN_OBJECT_START, lex_peek(), parse_array(), parse_object(), parse_scalar(), and JsonSemAction::semstate.
Referenced by json_count_array_elements(), and parse_array().
|
static |
Definition at line 369 of file jsonapi.c.
References Assert(), check_stack_depth(), json_lex(), JSON_PARSE_OBJECT_NEXT, JSON_PARSE_OBJECT_START, JSON_SUCCESS, JSON_TOKEN_COMMA, JSON_TOKEN_OBJECT_END, JSON_TOKEN_OBJECT_START, JSON_TOKEN_STRING, lex_expect(), JsonLexContext::lex_level, lex_peek(), JsonSemAction::object_end, JsonSemAction::object_start, parse_object_field(), report_parse_error(), and JsonSemAction::semstate.
Referenced by parse_array_element(), parse_object_field(), and pg_parse_json().
|
static |
Definition at line 307 of file jsonapi.c.
References StringInfoData::data, json_lex(), JSON_PARSE_OBJECT_LABEL, JSON_PARSE_STRING, JSON_SUCCESS, JSON_TOKEN_ARRAY_START, JSON_TOKEN_COLON, JSON_TOKEN_NULL, JSON_TOKEN_OBJECT_START, JSON_TOKEN_STRING, lex_expect(), lex_peek(), JsonSemAction::object_field_end, JsonSemAction::object_field_start, parse_array(), parse_object(), parse_scalar(), pstrdup(), report_parse_error(), JsonSemAction::semstate, and JsonLexContext::strval.
Referenced by parse_object().
|
inlinestatic |
Definition at line 263 of file jsonapi.c.
References StringInfoData::data, json_lex(), JSON_PARSE_VALUE, JSON_SUCCESS, JSON_TOKEN_FALSE, JSON_TOKEN_NULL, JSON_TOKEN_NUMBER, JSON_TOKEN_STRING, JSON_TOKEN_TRUE, len, lex_peek(), palloc(), pstrdup(), report_parse_error(), JsonSemAction::scalar, JsonSemAction::semstate, JsonLexContext::strval, JsonLexContext::token_start, JsonLexContext::token_terminator, and val.
Referenced by parse_array_element(), parse_object_field(), and pg_parse_json().
JsonParseErrorType pg_parse_json | ( | JsonLexContext * | lex, |
JsonSemAction * | sem | ||
) |
Definition at line 169 of file jsonapi.c.
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().
|
static |
Definition at line 1075 of file jsonapi.c.
References Assert(), 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_PARSE_ARRAY_NEXT, JSON_PARSE_ARRAY_START, JSON_PARSE_END, JSON_PARSE_OBJECT_COMMA, JSON_PARSE_OBJECT_LABEL, JSON_PARSE_OBJECT_NEXT, JSON_PARSE_OBJECT_START, JSON_PARSE_STRING, JSON_PARSE_VALUE, JSON_SUCCESS, JSON_TOKEN_END, JsonLexContext::token_start, and JsonLexContext::token_type.
Referenced by lex_expect(), parse_object(), parse_object_field(), and parse_scalar().
JsonSemAction nullSemAction |
Definition at line 57 of file jsonapi.c.
Referenced by json_count_array_elements(), json_in(), json_recv(), and json_validate().