70 state->escontext = escontext;
99 int clen = curpos - state->word; \
100 if ( clen + state->eml >= state->len ) \
103 state->word = (char *) repalloc(state->word, state->len); \
104 curpos = state->word + clen; \
109#define RETURN_TOKEN \
111 if (pos_ptr != NULL) \
116 else if (pos != NULL) \
119 if (strval != NULL) \
120 *strval = state->word; \
121 if (lenval != NULL) \
122 *lenval = curpos - state->word; \
123 if (endptr != NULL) \
124 *endptr = state->prsbuf; \
132#define WAITNEXTCHAR 3
133#define WAITENDCMPLX 4
136#define WAITPOSDELIM 7
137#define WAITCHARCMPLX 8
139#define PRSSYNTAXERROR return prssyntaxerror(state)
145 (
errcode(ERRCODE_SYNTAX_ERROR),
147 errmsg(
"syntax error in tsquery: \"%s\"",
state->bufstart) :
148 errmsg(
"syntax error in tsvector: \"%s\"",
state->bufstart)));
177 char **strval,
int *lenval,
182 char *curpos =
state->word;
197 if (*(
state->prsbuf) ==
'\0')
209 else if (!isspace((
unsigned char) *
state->prsbuf))
218 if (*(
state->prsbuf) ==
'\0')
220 (
errcode(ERRCODE_SYNTAX_ERROR),
221 errmsg(
"there is no escaped character: \"%s\"",
229 statecode = oldstate;
239 else if (isspace((
unsigned char) *
state->prsbuf) || *(
state->prsbuf) ==
'\0' ||
244 if (curpos ==
state->word)
251 if (curpos ==
state->word)
254 if (
state->oprisdelim)
277 else if (*(
state->prsbuf) ==
'\0')
299 if (curpos ==
state->word)
301 if (
state->oprisdelim)
320 if (isdigit((
unsigned char) *
state->prsbuf))
328 else if (npos + 1 >= posalen)
338 (
errcode(ERRCODE_SYNTAX_ERROR),
339 errmsg(
"wrong position info in tsvector: \"%s\"",
375 else if (isspace((
unsigned char) *
state->prsbuf) ||
376 *(
state->prsbuf) ==
'\0')
378 else if (!isdigit((
unsigned char) *
state->prsbuf))
382 elog(
ERROR,
"unrecognized state in gettoken_tsvector: %d",
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define errsave(context,...)
Assert(PointerIsAligned(start, uint64))
int pg_database_encoding_max_length(void)
int pg_mblen(const char *mbstr)
void * repalloc(void *pointer, Size size)
void pfree(void *pointer)
#define WEP_SETWEIGHT(x, v)
struct TSVectorParseStateData * TSVectorParseState
#define P_TSV_OPR_IS_DELIM
void reset_tsvector_parser(TSVectorParseState state, char *input)
void close_tsvector_parser(TSVectorParseState state)
static bool prssyntaxerror(TSVectorParseState state)
bool gettoken_tsvector(TSVectorParseState state, char **strval, int *lenval, WordEntryPos **pos_ptr, int *poslen, char **endptr)
TSVectorParseState init_tsvector_parser(char *input, int flags, Node *escontext)