81 #define RESIZEPRSBUF \
83 int clen = curpos - state->word; \
84 if ( clen + state->eml >= state->len ) \
87 state->word = (char *) repalloc(state->word, state->len); \
88 curpos = state->word + clen; \
93 #define ISOPERATOR(x) \
94 ( pg_mblen(x) == 1 && ( *(x) == '!' || \
103 #define RETURN_TOKEN \
105 if (pos_ptr != NULL) \
110 else if (pos != NULL) \
113 if (strval != NULL) \
114 *strval = state->word; \
115 if (lenval != NULL) \
116 *lenval = curpos - state->word; \
117 if (endptr != NULL) \
118 *endptr = state->prsbuf; \
125 #define WAITENDWORD 2
126 #define WAITNEXTCHAR 3
127 #define WAITENDCMPLX 4
128 #define WAITPOSINFO 5
130 #define WAITPOSDELIM 7
131 #define WAITCHARCMPLX 8
133 #define PRSSYNTAXERROR prssyntaxerror(state)
139 (
errcode(ERRCODE_SYNTAX_ERROR),
164 char **strval,
int *lenval,
169 char *curpos = state->
word;
184 if (*(state->
prsbuf) ==
'\0')
204 if (*(state->
prsbuf) ==
'\0')
206 (
errcode(ERRCODE_SYNTAX_ERROR),
207 errmsg(
"there is no escaped character: \"%s\"",
215 statecode = oldstate;
229 if (curpos == state->
word)
236 if (curpos == state->
word)
262 else if (*(state->
prsbuf) ==
'\0')
284 if (curpos == state->
word)
313 else if (npos + 1 >= posalen)
323 (
errcode(ERRCODE_SYNTAX_ERROR),
324 errmsg(
"wrong position info in tsvector: \"%s\"",
367 elog(
ERROR,
"unrecognized state in gettoken_tsvector: %d",
struct TSVectorParseStateData * TSVectorParseState
bool gettoken_tsvector(TSVectorParseState state, char **strval, int *lenval, WordEntryPos **pos_ptr, int *poslen, char **endptr)
void close_tsvector_parser(TSVectorParseState state)
int errcode(int sqlerrcode)
void pfree(void *pointer)
static void prssyntaxerror(TSVectorParseState state)
#define WEP_SETWEIGHT(x, v)
int pg_database_encoding_max_length(void)
TSVectorParseState init_tsvector_parser(char *input, bool oprisdelim, bool is_tsquery)
#define ereport(elevel, rest)
void reset_tsvector_parser(TSVectorParseState state, char *input)
#define Assert(condition)
int pg_mblen(const char *mbstr)
void * repalloc(void *pointer, Size size)
int errmsg(const char *fmt,...)