We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 49207ac commit 913954eCopy full SHA for 913954e
src/common/jsonapi.c
@@ -83,6 +83,22 @@ lex_peek(JsonLexContext *lex)
83
return lex->token_type;
84
}
85
86
+static inline char *
87
+lex_peek_value(JsonLexContext *lex)
88
+{
89
+ if (lex->token_type == JSON_TOKEN_STRING)
90
+ return lex->strval ? pstrdup(lex->strval->data) : NULL;
91
+ else
92
+ {
93
+ int len = (lex->token_terminator - lex->token_start);
94
+ char *tokstr = palloc(len + 1);
95
+
96
+ memcpy(tokstr, lex->token_start, len);
97
+ tokstr[len] = '\0';
98
+ return tokstr;
99
+ }
100
+}
101
102
/*
103
* lex_expect
104
*
0 commit comments