70 state->escontext = escontext;
97 #define RESIZEPRSBUF \
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; \
131 #define WAITENDWORD 2
132 #define WAITNEXTCHAR 3
133 #define WAITENDCMPLX 4
134 #define WAITPOSINFO 5
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')
218 if (*(
state->prsbuf) ==
'\0')
220 (
errcode(ERRCODE_SYNTAX_ERROR),
221 errmsg(
"there is no escaped character: \"%s\"",
229 statecode = oldstate;
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)
328 else if (npos + 1 >= posalen)
338 (
errcode(ERRCODE_SYNTAX_ERROR),
339 errmsg(
"wrong position info in tsvector: \"%s\"",
376 *(
state->prsbuf) ==
'\0')
382 elog(
ERROR,
"unrecognized state in gettoken_tsvector: %d",
#define Assert(condition)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereturn(context, dummy_value,...)
#define errsave(context,...)
int pg_database_encoding_max_length(void)
int pg_mblen(const char *mbstr)
void pfree(void *pointer)
void * repalloc(void *pointer, Size size)
int t_isspace(const char *ptr)
int t_isdigit(const char *ptr)
#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)