src/postgres/src/backend/utils/adt/jsonapi.c
/*
 * lex_accept
 *
 * accept the look_ahead token and move the lexer to the next token if the
 * look_ahead token matches the token parameter. In that case, and if required,
 * also hand back the de-escaped lexeme.
 *
 * returns true if the token matched, false otherwise.
 */
lex_accept
accept the look_ahead token and move the lexer to the next token if the
look_ahead token matches the token parameter. In that case, and if required,
also hand back the de-escaped lexeme.

returns true if the token matched, false otherwise.
lex_accept accept the look_ahead token and move the lexer to the next token if the look_ahead token matches the token parameter . In that case and if required also hand back the de - escaped lexeme . returns true if the token matched false otherwise .
static inline bool
lex_accept(JsonLexContext *lex, JsonTokenType token, char **lexeme)
{
	if (lex->token_type == token)
	{
		if (lexeme != NULL)
		{
			if (lex->token_type == JSON_TOKEN_STRING)
			{
				if (lex->strval != NULL)
					*lexeme = pstrdup(lex->strval->data);
			}
			else
			{
				int			len = (lex->token_terminator - lex->token_start);
				char	   *tokstr = palloc(len + 1);
				memcpy(tokstr, lex->token_start, len);
				tokstr[len] = '\0';
				*lexeme = tokstr;
			}
		}
		json_lex(lex);
		return true;
	}
	return false;
}
static inline bool lex_accept ( JsonLexContext * lex , JsonTokenType token , char * * lexeme ) { if ( lex -> token_type == token ) { if ( lexeme != NULL ) { if ( lex -> token_type == JSON_TOKEN_STRING ) { if ( lex -> strval != NULL ) * lexeme = pstrdup ( lex -> strval -> data ) ; } else { int len = ( lex -> token_terminator - lex -> token_start ) ; char * tokstr = palloc ( len + 1 ) ; memcpy ( tokstr , lex -> token_start , len ) ; tokstr [ len ] = ' \0 ' ; * lexeme = tokstr ; } } json_lex ( lex ) ; return true ; } return false ; }
lex_accept
 accept the look_ahead token and move the lexer to the next token if the
 look_ahead token matches the token parameter.
lex_accept accept the look_ahead token and move the lexer to the next token if the look_ahead token matches the token parameter .