aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/jsonapi.h
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2020-01-24 10:17:43 -0800
committerRobert Haas <rhaas@postgresql.org>2020-01-24 10:17:43 -0800
commit11b5e3e35d3900164cb36754ee4e4dcab0bd02f0 (patch)
tree6555b0d178f7f0f5785eb2cc5ef83687dc24702c /src/include/utils/jsonapi.h
parentce0425b162d0a8c168e1fbab5324fb1cbca4b6b7 (diff)
downloadpostgresql-11b5e3e35d3900164cb36754ee4e4dcab0bd02f0.tar.gz
postgresql-11b5e3e35d3900164cb36754ee4e4dcab0bd02f0.zip
Split JSON lexer/parser from 'json' data type support.
Keep the code that pertains to the 'json' data type in json.c, but move the lexing and parsing code to a new file jsonapi.c, a name I chose because the corresponding prototypes are in jsonapi.h. This seems like a logical division, because the JSON lexer and parser are also used by the 'jsonb' data type, but the SQL-callable functions in json.c are a separate thing. Also, the new jsonapi.c file needs to include far fewer header files than json.c, which seems like a good sign that this is an appropriate place to insert an abstraction boundary. I took the opportunity to remove a few apparently-unneeded includes from json.c at the same time. Patch by me, reviewed by David Steele, Mark Dilger, and Andrew Dunstan. The previous commit was, too, but I forgot to note it in the commit message. Discussion: http://postgr.es/m/CA+TgmoYfOXhd27MUDGioVh6QtpD0C1K-f6ObSA10AWiHBAL5bA@mail.gmail.com
Diffstat (limited to 'src/include/utils/jsonapi.h')
-rw-r--r--src/include/utils/jsonapi.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/include/utils/jsonapi.h b/src/include/utils/jsonapi.h
index 11909474766..bbca121bb72 100644
--- a/src/include/utils/jsonapi.h
+++ b/src/include/utils/jsonapi.h
@@ -103,6 +103,9 @@ typedef struct JsonSemAction
*/
extern void pg_parse_json(JsonLexContext *lex, JsonSemAction *sem);
+/* the null action object used for pure validation */
+extern JsonSemAction nullSemAction;
+
/*
* json_count_array_elements performs a fast secondary parse to determine the
* number of elements in passed array lex context. It should be called from an
@@ -124,6 +127,9 @@ extern JsonLexContext *makeJsonLexContextCstringLen(char *json,
int len,
bool need_escapes);
+/* lex one token */
+extern void json_lex(JsonLexContext *lex);
+
/*
* Utility function to check if a string is a valid JSON number.
*