* Extract the current token from a lexing context, for error reporting. */
| 1123 | * Extract the current token from a lexing context, for error reporting. |
| 1124 | */ |
| 1125 | static char * |
| 1126 | extract_token(JsonLexContext *lex) |
| 1127 | { |
| 1128 | int toklen = lex->token_terminator - lex->token_start; |
| 1129 | char *token = palloc(toklen + 1); |
| 1130 | |
| 1131 | memcpy(token, lex->token_start, toklen); |
| 1132 | token[toklen] = '\0'; |
| 1133 | return token; |
| 1134 | } |
no test coverage detected