PostgreSQL Source Code  git master
wparser_def.c File Reference
#include "postgres.h"
#include <limits.h>
#include <wctype.h>
#include "commands/defrem.h"
#include "mb/pg_wchar.h"
#include "miscadmin.h"
#include "tsearch/ts_public.h"
#include "tsearch/ts_type.h"
#include "tsearch/ts_utils.h"
#include "utils/builtins.h"
#include "utils/pg_locale.h"
Include dependency graph for wparser_def.c:

Go to the source code of this file.

Data Structures

struct  TParserStateActionItem
 
struct  TParserPosition
 
struct  TParser
 
struct  TParserStateAction
 
struct  CoverPos
 
struct  hlCheck
 

Macros

#define ASCIIWORD   1
 
#define WORD_T   2
 
#define NUMWORD   3
 
#define EMAIL   4
 
#define URL_T   5
 
#define HOST   6
 
#define SCIENTIFIC   7
 
#define VERSIONNUMBER   8
 
#define NUMPARTHWORD   9
 
#define PARTHWORD   10
 
#define ASCIIPARTHWORD   11
 
#define SPACE   12
 
#define TAG_T   13
 
#define PROTOCOL   14
 
#define NUMHWORD   15
 
#define ASCIIHWORD   16
 
#define HWORD   17
 
#define URLPATH   18
 
#define FILEPATH   19
 
#define DECIMAL_T   20
 
#define SIGNEDINT   21
 
#define UNSIGNEDINT   22
 
#define XMLENTITY   23
 
#define LASTNUM   23
 
#define A_NEXT   0x0000
 
#define A_BINGO   0x0001
 
#define A_POP   0x0002
 
#define A_PUSH   0x0004
 
#define A_RERUN   0x0008
 
#define A_CLEAR   0x0010
 
#define A_MERGE   0x0020
 
#define A_CLRALL   0x0040
 
#define p_iswhat(type, nonascii)
 
#define TPARSERSTATEACTION(state)    { CppConcat(action,state), state }
 
#define TS_IDIGNORE(x)   ( (x)==TAG_T || (x)==PROTOCOL || (x)==SPACE || (x)==XMLENTITY )
 
#define HLIDREPLACE(x)   ( (x)==TAG_T )
 
#define HLIDSKIP(x)   ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
 
#define XMLHLIDSKIP(x)   ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )
 
#define NONWORDTOKEN(x)   ( (x)==SPACE || HLIDREPLACE(x) || HLIDSKIP(x) )
 
#define NOENDTOKEN(x)   ( NONWORDTOKEN(x) || (x)==SCIENTIFIC || (x)==VERSIONNUMBER || (x)==DECIMAL_T || (x)==SIGNEDINT || (x)==UNSIGNEDINT || TS_IDIGNORE(x) )
 
#define INTERESTINGWORD(j)    (prs->words[j].item && !prs->words[j].repeated)
 
#define BADENDPOINT(j)
 

Typedefs

typedef int(* TParserCharTest) (struct TParser *)
 
typedef void(* TParserSpecial) (struct TParser *)
 
typedef struct TParserPosition TParserPosition
 
typedef struct TParser TParser
 

Enumerations

enum  TParserState {
  TPS_Base = 0 , TPS_InNumWord , TPS_InAsciiWord , TPS_InWord ,
  TPS_InUnsignedInt , TPS_InSignedIntFirst , TPS_InSignedInt , TPS_InSpace ,
  TPS_InUDecimalFirst , TPS_InUDecimal , TPS_InDecimalFirst , TPS_InDecimal ,
  TPS_InVerVersion , TPS_InSVerVersion , TPS_InVersionFirst , TPS_InVersion ,
  TPS_InMantissaFirst , TPS_InMantissaSign , TPS_InMantissa , TPS_InXMLEntityFirst ,
  TPS_InXMLEntity , TPS_InXMLEntityNumFirst , TPS_InXMLEntityNum , TPS_InXMLEntityHexNumFirst ,
  TPS_InXMLEntityHexNum , TPS_InXMLEntityEnd , TPS_InTagFirst , TPS_InXMLBegin ,
  TPS_InTagCloseFirst , TPS_InTagName , TPS_InTagBeginEnd , TPS_InTag ,
  TPS_InTagEscapeK , TPS_InTagEscapeKK , TPS_InTagBackSleshed , TPS_InTagEnd ,
  TPS_InCommentFirst , TPS_InCommentLast , TPS_InComment , TPS_InCloseCommentFirst ,
  TPS_InCloseCommentLast , TPS_InCommentEnd , TPS_InHostFirstDomain , TPS_InHostDomainSecond ,
  TPS_InHostDomain , TPS_InPortFirst , TPS_InPort , TPS_InHostFirstAN ,
  TPS_InHost , TPS_InEmail , TPS_InFileFirst , TPS_InFileTwiddle ,
  TPS_InPathFirst , TPS_InPathFirstFirst , TPS_InPathSecond , TPS_InFile ,
  TPS_InFileNext , TPS_InURLPathFirst , TPS_InURLPathStart , TPS_InURLPath ,
  TPS_InFURL , TPS_InProtocolFirst , TPS_InProtocolSecond , TPS_InProtocolEnd ,
  TPS_InHyphenAsciiWordFirst , TPS_InHyphenAsciiWord , TPS_InHyphenWordFirst , TPS_InHyphenWord ,
  TPS_InHyphenNumWordFirst , TPS_InHyphenNumWord , TPS_InHyphenDigitLookahead , TPS_InParseHyphen ,
  TPS_InParseHyphenHyphen , TPS_InHyphenWordPart , TPS_InHyphenAsciiWordPart , TPS_InHyphenNumWordPart ,
  TPS_InHyphenUnsignedInt , TPS_Null
}
 

Functions

static bool TParserGet (TParser *prs)
 
static TParserPositionnewTParserPosition (TParserPosition *prev)
 
static TParserTParserInit (char *str, int len)
 
static TParserTParserCopyInit (const TParser *orig)
 
static void TParserClose (TParser *prs)
 
static void TParserCopyClose (TParser *prs)
 
 p_iswhat (alnum, 1)
 
static int p_isEOF (TParser *prs)
 
static int p_iseqC (TParser *prs)
 
static int p_isneC (TParser *prs)
 
static int p_isascii (TParser *prs)
 
static int p_isasclet (TParser *prs)
 
static int p_isurlchar (TParser *prs)
 
void _make_compiler_happy (void)
 
static void SpecialTags (TParser *prs)
 
static void SpecialFURL (TParser *prs)
 
static void SpecialHyphen (TParser *prs)
 
static void SpecialVerVersion (TParser *prs)
 
static int p_isstophost (TParser *prs)
 
static int p_isignore (TParser *prs)
 
static int p_ishost (TParser *prs)
 
static int p_isURLPath (TParser *prs)
 
static int p_isspecial (TParser *prs)
 
Datum prsd_lextype (PG_FUNCTION_ARGS)
 
Datum prsd_start (PG_FUNCTION_ARGS)
 
Datum prsd_nexttoken (PG_FUNCTION_ARGS)
 
Datum prsd_end (PG_FUNCTION_ARGS)
 
static TSTernaryValue checkcondition_HL (void *opaque, QueryOperand *val, ExecPhraseData *data)
 
static bool hlCover (HeadlineParsedText *prs, TSQuery query, List *locations, int *nextpos, int *p, int *q)
 
static void mark_fragment (HeadlineParsedText *prs, bool highlightall, int startpos, int endpos)
 
static void get_next_fragment (HeadlineParsedText *prs, int *startpos, int *endpos, int *curlen, int *poslen, int max_words)
 
static void mark_hl_fragments (HeadlineParsedText *prs, TSQuery query, List *locations, bool highlightall, int shortword, int min_words, int max_words, int max_fragments)
 
static void mark_hl_words (HeadlineParsedText *prs, TSQuery query, List *locations, bool highlightall, int shortword, int min_words, int max_words)
 
Datum prsd_headline (PG_FUNCTION_ARGS)
 

Variables

static const char *const tok_alias []
 
static const char *const lex_descr []
 
static const TParserStateActionItem actionTPS_Base []
 
static const TParserStateActionItem actionTPS_InNumWord []
 
static const TParserStateActionItem actionTPS_InAsciiWord []
 
static const TParserStateActionItem actionTPS_InWord []
 
static const TParserStateActionItem actionTPS_InUnsignedInt []
 
static const TParserStateActionItem actionTPS_InSignedIntFirst []
 
static const TParserStateActionItem actionTPS_InSignedInt []
 
static const TParserStateActionItem actionTPS_InSpace []
 
static const TParserStateActionItem actionTPS_InUDecimalFirst []
 
static const TParserStateActionItem actionTPS_InUDecimal []
 
static const TParserStateActionItem actionTPS_InDecimalFirst []
 
static const TParserStateActionItem actionTPS_InDecimal []
 
static const TParserStateActionItem actionTPS_InVerVersion []
 
static const TParserStateActionItem actionTPS_InSVerVersion []
 
static const TParserStateActionItem actionTPS_InVersionFirst []
 
static const TParserStateActionItem actionTPS_InVersion []
 
static const TParserStateActionItem actionTPS_InMantissaFirst []
 
static const TParserStateActionItem actionTPS_InMantissaSign []
 
static const TParserStateActionItem actionTPS_InMantissa []
 
static const TParserStateActionItem actionTPS_InXMLEntityFirst []
 
static const TParserStateActionItem actionTPS_InXMLEntity []
 
static const TParserStateActionItem actionTPS_InXMLEntityNumFirst []
 
static const TParserStateActionItem actionTPS_InXMLEntityHexNumFirst []
 
static const TParserStateActionItem actionTPS_InXMLEntityNum []
 
static const TParserStateActionItem actionTPS_InXMLEntityHexNum []
 
static const TParserStateActionItem actionTPS_InXMLEntityEnd []
 
static const TParserStateActionItem actionTPS_InTagFirst []
 
static const TParserStateActionItem actionTPS_InXMLBegin []
 
static const TParserStateActionItem actionTPS_InTagCloseFirst []
 
static const TParserStateActionItem actionTPS_InTagName []
 
static const TParserStateActionItem actionTPS_InTagBeginEnd []
 
static const TParserStateActionItem actionTPS_InTag []
 
static const TParserStateActionItem actionTPS_InTagEscapeK []
 
static const TParserStateActionItem actionTPS_InTagEscapeKK []
 
static const TParserStateActionItem actionTPS_InTagBackSleshed []
 
static const TParserStateActionItem actionTPS_InTagEnd []
 
static const TParserStateActionItem actionTPS_InCommentFirst []
 
static const TParserStateActionItem actionTPS_InCommentLast []
 
static const TParserStateActionItem actionTPS_InComment []
 
static const TParserStateActionItem actionTPS_InCloseCommentFirst []
 
static const TParserStateActionItem actionTPS_InCloseCommentLast []
 
static const TParserStateActionItem actionTPS_InCommentEnd []
 
static const TParserStateActionItem actionTPS_InHostFirstDomain []
 
static const TParserStateActionItem actionTPS_InHostDomainSecond []
 
static const TParserStateActionItem actionTPS_InHostDomain []
 
static const TParserStateActionItem actionTPS_InPortFirst []
 
static const TParserStateActionItem actionTPS_InPort []
 
static const TParserStateActionItem actionTPS_InHostFirstAN []
 
static const TParserStateActionItem actionTPS_InHost []
 
static const TParserStateActionItem actionTPS_InEmail []
 
static const TParserStateActionItem actionTPS_InFileFirst []
 
static const TParserStateActionItem actionTPS_InFileTwiddle []
 
static const TParserStateActionItem actionTPS_InPathFirst []
 
static const TParserStateActionItem actionTPS_InPathFirstFirst []
 
static const TParserStateActionItem actionTPS_InPathSecond []
 
static const TParserStateActionItem actionTPS_InFile []
 
static const TParserStateActionItem actionTPS_InFileNext []
 
static const TParserStateActionItem actionTPS_InURLPathFirst []
 
static const TParserStateActionItem actionTPS_InURLPathStart []
 
static const TParserStateActionItem actionTPS_InURLPath []
 
static const TParserStateActionItem actionTPS_InFURL []
 
static const TParserStateActionItem actionTPS_InProtocolFirst []
 
static const TParserStateActionItem actionTPS_InProtocolSecond []
 
static const TParserStateActionItem actionTPS_InProtocolEnd []
 
static const TParserStateActionItem actionTPS_InHyphenAsciiWordFirst []
 
static const TParserStateActionItem actionTPS_InHyphenAsciiWord []
 
static const TParserStateActionItem actionTPS_InHyphenWordFirst []
 
static const TParserStateActionItem actionTPS_InHyphenWord []
 
static const TParserStateActionItem actionTPS_InHyphenNumWordFirst []
 
static const TParserStateActionItem actionTPS_InHyphenNumWord []
 
static const TParserStateActionItem actionTPS_InHyphenDigitLookahead []
 
static const TParserStateActionItem actionTPS_InParseHyphen []
 
static const TParserStateActionItem actionTPS_InParseHyphenHyphen []
 
static const TParserStateActionItem actionTPS_InHyphenWordPart []
 
static const TParserStateActionItem actionTPS_InHyphenAsciiWordPart []
 
static const TParserStateActionItem actionTPS_InHyphenNumWordPart []
 
static const TParserStateActionItem actionTPS_InHyphenUnsignedInt []
 
static const TParserStateAction Actions []
 

Macro Definition Documentation

◆ A_BINGO

#define A_BINGO   0x0001

Definition at line 221 of file wparser_def.c.

◆ A_CLEAR

#define A_CLEAR   0x0010

Definition at line 225 of file wparser_def.c.

◆ A_CLRALL

#define A_CLRALL   0x0040

Definition at line 227 of file wparser_def.c.

◆ A_MERGE

#define A_MERGE   0x0020

Definition at line 226 of file wparser_def.c.

◆ A_NEXT

#define A_NEXT   0x0000

Definition at line 220 of file wparser_def.c.

◆ A_POP

#define A_POP   0x0002

Definition at line 222 of file wparser_def.c.

◆ A_PUSH

#define A_PUSH   0x0004

Definition at line 223 of file wparser_def.c.

◆ A_RERUN

#define A_RERUN   0x0008

Definition at line 224 of file wparser_def.c.

◆ ASCIIHWORD

#define ASCIIHWORD   16

Definition at line 51 of file wparser_def.c.

◆ ASCIIPARTHWORD

#define ASCIIPARTHWORD   11

Definition at line 46 of file wparser_def.c.

◆ ASCIIWORD

#define ASCIIWORD   1

Definition at line 36 of file wparser_def.c.

◆ BADENDPOINT

#define BADENDPOINT (   j)
Value:
((NOENDTOKEN(prs->words[j].type) || prs->words[j].len <= shortword) && \
int j
Definition: isn.c:74
#define NOENDTOKEN(x)
Definition: wparser_def.c:1937
#define INTERESTINGWORD(j)
Definition: wparser_def.c:1946

Definition at line 1950 of file wparser_def.c.

◆ DECIMAL_T

#define DECIMAL_T   20

Definition at line 55 of file wparser_def.c.

◆ EMAIL

#define EMAIL   4

Definition at line 39 of file wparser_def.c.

◆ FILEPATH

#define FILEPATH   19

Definition at line 54 of file wparser_def.c.

◆ HLIDREPLACE

#define HLIDREPLACE (   x)    ( (x)==TAG_T )

Definition at line 1933 of file wparser_def.c.

◆ HLIDSKIP

#define HLIDSKIP (   x)    ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )

Definition at line 1934 of file wparser_def.c.

◆ HOST

#define HOST   6

Definition at line 41 of file wparser_def.c.

◆ HWORD

#define HWORD   17

Definition at line 52 of file wparser_def.c.

◆ INTERESTINGWORD

#define INTERESTINGWORD (   j)     (prs->words[j].item && !prs->words[j].repeated)

Definition at line 1946 of file wparser_def.c.

◆ LASTNUM

#define LASTNUM   23

Definition at line 60 of file wparser_def.c.

◆ NOENDTOKEN

#define NOENDTOKEN (   x)    ( NONWORDTOKEN(x) || (x)==SCIENTIFIC || (x)==VERSIONNUMBER || (x)==DECIMAL_T || (x)==SIGNEDINT || (x)==UNSIGNEDINT || TS_IDIGNORE(x) )

Definition at line 1937 of file wparser_def.c.

◆ NONWORDTOKEN

#define NONWORDTOKEN (   x)    ( (x)==SPACE || HLIDREPLACE(x) || HLIDSKIP(x) )

Definition at line 1936 of file wparser_def.c.

◆ NUMHWORD

#define NUMHWORD   15

Definition at line 50 of file wparser_def.c.

◆ NUMPARTHWORD

#define NUMPARTHWORD   9

Definition at line 44 of file wparser_def.c.

◆ NUMWORD

#define NUMWORD   3

Definition at line 38 of file wparser_def.c.

◆ p_iswhat

#define p_iswhat (   type,
  nonascii 
)
Value:
\
static int \
p_is##type(TParser *prs) \
{ \
Assert(prs->state); \
if (prs->usewide) \
{ \
if (prs->pgwstr) \
{ \
unsigned int c = *(prs->pgwstr + prs->state->poschar); \
if (c > 0x7f) \
return nonascii; \
return is##type(c); \
} \
return isw##type(*(prs->wstr + prs->state->poschar)); \
} \
return is##type(*(unsigned char *) (prs->str + prs->state->posbyte)); \
} \
\
static int \
p_isnot##type(TParser *prs) \
{ \
return !p_is##type(prs); \
}
char * c
const char * type

Definition at line 424 of file wparser_def.c.

◆ PARTHWORD

#define PARTHWORD   10

Definition at line 45 of file wparser_def.c.

◆ PROTOCOL

#define PROTOCOL   14

Definition at line 49 of file wparser_def.c.

◆ SCIENTIFIC

#define SCIENTIFIC   7

Definition at line 42 of file wparser_def.c.

◆ SIGNEDINT

#define SIGNEDINT   21

Definition at line 56 of file wparser_def.c.

◆ SPACE

#define SPACE   12

Definition at line 47 of file wparser_def.c.

◆ TAG_T

#define TAG_T   13

Definition at line 48 of file wparser_def.c.

◆ TPARSERSTATEACTION

#define TPARSERSTATEACTION (   state)     { CppConcat(action,state), state }

Definition at line 1620 of file wparser_def.c.

◆ TS_IDIGNORE

#define TS_IDIGNORE (   x)    ( (x)==TAG_T || (x)==PROTOCOL || (x)==SPACE || (x)==XMLENTITY )

Definition at line 1932 of file wparser_def.c.

◆ UNSIGNEDINT

#define UNSIGNEDINT   22

Definition at line 57 of file wparser_def.c.

◆ URL_T

#define URL_T   5

Definition at line 40 of file wparser_def.c.

◆ URLPATH

#define URLPATH   18

Definition at line 53 of file wparser_def.c.

◆ VERSIONNUMBER

#define VERSIONNUMBER   8

Definition at line 43 of file wparser_def.c.

◆ WORD_T

#define WORD_T   2

Definition at line 37 of file wparser_def.c.

◆ XMLENTITY

#define XMLENTITY   23

Definition at line 58 of file wparser_def.c.

◆ XMLHLIDSKIP

#define XMLHLIDSKIP (   x)    ( (x)==URL_T || (x)==NUMHWORD || (x)==ASCIIHWORD || (x)==HWORD )

Definition at line 1935 of file wparser_def.c.

Typedef Documentation

◆ TParser

typedef struct TParser TParser

◆ TParserCharTest

typedef int(* TParserCharTest) (struct TParser *)

Definition at line 204 of file wparser_def.c.

◆ TParserPosition

◆ TParserSpecial

typedef void(* TParserSpecial) (struct TParser *)

Definition at line 206 of file wparser_def.c.

Enumeration Type Documentation

◆ TParserState

Enumerator
TPS_Base 
TPS_InNumWord 
TPS_InAsciiWord 
TPS_InWord 
TPS_InUnsignedInt 
TPS_InSignedIntFirst 
TPS_InSignedInt 
TPS_InSpace 
TPS_InUDecimalFirst 
TPS_InUDecimal 
TPS_InDecimalFirst 
TPS_InDecimal 
TPS_InVerVersion 
TPS_InSVerVersion 
TPS_InVersionFirst 
TPS_InVersion 
TPS_InMantissaFirst 
TPS_InMantissaSign 
TPS_InMantissa 
TPS_InXMLEntityFirst 
TPS_InXMLEntity 
TPS_InXMLEntityNumFirst 
TPS_InXMLEntityNum 
TPS_InXMLEntityHexNumFirst 
TPS_InXMLEntityHexNum 
TPS_InXMLEntityEnd 
TPS_InTagFirst 
TPS_InXMLBegin 
TPS_InTagCloseFirst 
TPS_InTagName 
TPS_InTagBeginEnd 
TPS_InTag 
TPS_InTagEscapeK 
TPS_InTagEscapeKK 
TPS_InTagBackSleshed 
TPS_InTagEnd 
TPS_InCommentFirst 
TPS_InCommentLast 
TPS_InComment 
TPS_InCloseCommentFirst 
TPS_InCloseCommentLast 
TPS_InCommentEnd 
TPS_InHostFirstDomain 
TPS_InHostDomainSecond 
TPS_InHostDomain 
TPS_InPortFirst 
TPS_InPort 
TPS_InHostFirstAN 
TPS_InHost 
TPS_InEmail 
TPS_InFileFirst 
TPS_InFileTwiddle 
TPS_InPathFirst 
TPS_InPathFirstFirst 
TPS_InPathSecond 
TPS_InFile 
TPS_InFileNext 
TPS_InURLPathFirst 
TPS_InURLPathStart 
TPS_InURLPath 
TPS_InFURL 
TPS_InProtocolFirst 
TPS_InProtocolSecond 
TPS_InProtocolEnd 
TPS_InHyphenAsciiWordFirst 
TPS_InHyphenAsciiWord 
TPS_InHyphenWordFirst 
TPS_InHyphenWord 
TPS_InHyphenNumWordFirst 
TPS_InHyphenNumWord 
TPS_InHyphenDigitLookahead 
TPS_InParseHyphen 
TPS_InParseHyphenHyphen 
TPS_InHyphenWordPart 
TPS_InHyphenAsciiWordPart 
TPS_InHyphenNumWordPart 
TPS_InHyphenUnsignedInt 
TPS_Null 

Definition at line 119 of file wparser_def.c.

120 {
121  TPS_Base = 0,
124  TPS_InWord,
128  TPS_InSpace,
152  TPS_InTag,
156  TPS_InTagEnd,
167  TPS_InPort,
169  TPS_InHost,
170  TPS_InEmail,
176  TPS_InFile,
181  TPS_InFURL,
198  TPS_Null /* last state (fake value) */
199 } TParserState;
TParserState
Definition: wparser_def.c:120
@ TPS_InXMLEntityHexNumFirst
Definition: wparser_def.c:144
@ TPS_InPort
Definition: wparser_def.c:167
@ TPS_InXMLEntityHexNum
Definition: wparser_def.c:145
@ TPS_InHostDomainSecond
Definition: wparser_def.c:164
@ TPS_InMantissaFirst
Definition: wparser_def.c:137
@ TPS_InTagName
Definition: wparser_def.c:150
@ TPS_InHyphenAsciiWordFirst
Definition: wparser_def.c:185
@ TPS_Null
Definition: wparser_def.c:198
@ TPS_InPathFirstFirst
Definition: wparser_def.c:174
@ TPS_InSignedIntFirst
Definition: wparser_def.c:126
@ TPS_InSignedInt
Definition: wparser_def.c:127
@ TPS_InUnsignedInt
Definition: wparser_def.c:125
@ TPS_InMantissa
Definition: wparser_def.c:139
@ TPS_InProtocolFirst
Definition: wparser_def.c:182
@ TPS_InFURL
Definition: wparser_def.c:181
@ TPS_InMantissaSign
Definition: wparser_def.c:138
@ TPS_InXMLBegin
Definition: wparser_def.c:148
@ TPS_InCommentEnd
Definition: wparser_def.c:162
@ TPS_InHyphenWordFirst
Definition: wparser_def.c:187
@ TPS_InHyphenNumWordPart
Definition: wparser_def.c:196
@ TPS_InPortFirst
Definition: wparser_def.c:166
@ TPS_InProtocolEnd
Definition: wparser_def.c:184
@ TPS_InXMLEntityFirst
Definition: wparser_def.c:140
@ TPS_InHyphenNumWordFirst
Definition: wparser_def.c:189
@ TPS_InCommentLast
Definition: wparser_def.c:158
@ TPS_InFileTwiddle
Definition: wparser_def.c:172
@ TPS_InURLPathStart
Definition: wparser_def.c:179
@ TPS_InURLPathFirst
Definition: wparser_def.c:178
@ TPS_InPathFirst
Definition: wparser_def.c:173
@ TPS_InPathSecond
Definition: wparser_def.c:175
@ TPS_InHyphenUnsignedInt
Definition: wparser_def.c:197
@ TPS_InFileFirst
Definition: wparser_def.c:171
@ TPS_InXMLEntityNumFirst
Definition: wparser_def.c:142
@ TPS_InHyphenWordPart
Definition: wparser_def.c:194
@ TPS_InNumWord
Definition: wparser_def.c:122
@ TPS_InAsciiWord
Definition: wparser_def.c:123
@ TPS_InVersion
Definition: wparser_def.c:136
@ TPS_InHost
Definition: wparser_def.c:169
@ TPS_InFile
Definition: wparser_def.c:176
@ TPS_InProtocolSecond
Definition: wparser_def.c:183
@ TPS_InCloseCommentFirst
Definition: wparser_def.c:160
@ TPS_InTagEscapeK
Definition: wparser_def.c:153
@ TPS_InParseHyphenHyphen
Definition: wparser_def.c:193
@ TPS_InTagBackSleshed
Definition: wparser_def.c:155
@ TPS_InTagFirst
Definition: wparser_def.c:147
@ TPS_InTagEnd
Definition: wparser_def.c:156
@ TPS_InComment
Definition: wparser_def.c:159
@ TPS_InHyphenWord
Definition: wparser_def.c:188
@ TPS_InHyphenAsciiWord
Definition: wparser_def.c:186
@ TPS_InWord
Definition: wparser_def.c:124
@ TPS_InXMLEntityEnd
Definition: wparser_def.c:146
@ TPS_InTagEscapeKK
Definition: wparser_def.c:154
@ TPS_InSpace
Definition: wparser_def.c:128
@ TPS_InFileNext
Definition: wparser_def.c:177
@ TPS_InURLPath
Definition: wparser_def.c:180
@ TPS_Base
Definition: wparser_def.c:121
@ TPS_InUDecimal
Definition: wparser_def.c:130
@ TPS_InParseHyphen
Definition: wparser_def.c:192
@ TPS_InHostFirstAN
Definition: wparser_def.c:168
@ TPS_InEmail
Definition: wparser_def.c:170
@ TPS_InDecimalFirst
Definition: wparser_def.c:131
@ TPS_InVersionFirst
Definition: wparser_def.c:135
@ TPS_InCloseCommentLast
Definition: wparser_def.c:161
@ TPS_InSVerVersion
Definition: wparser_def.c:134
@ TPS_InHyphenAsciiWordPart
Definition: wparser_def.c:195
@ TPS_InCommentFirst
Definition: wparser_def.c:157
@ TPS_InUDecimalFirst
Definition: wparser_def.c:129
@ TPS_InHostFirstDomain
Definition: wparser_def.c:163
@ TPS_InHostDomain
Definition: wparser_def.c:165
@ TPS_InHyphenDigitLookahead
Definition: wparser_def.c:191
@ TPS_InVerVersion
Definition: wparser_def.c:133
@ TPS_InXMLEntityNum
Definition: wparser_def.c:143
@ TPS_InTag
Definition: wparser_def.c:152
@ TPS_InDecimal
Definition: wparser_def.c:132
@ TPS_InTagCloseFirst
Definition: wparser_def.c:149
@ TPS_InXMLEntity
Definition: wparser_def.c:141
@ TPS_InHyphenNumWord
Definition: wparser_def.c:190
@ TPS_InTagBeginEnd
Definition: wparser_def.c:151

Function Documentation

◆ _make_compiler_happy()

void _make_compiler_happy ( void  )

Definition at line 537 of file wparser_def.c.

538 {
539  p_isalnum(NULL);
540  p_isnotalnum(NULL);
541  p_isalpha(NULL);
542  p_isnotalpha(NULL);
543  p_isdigit(NULL);
544  p_isnotdigit(NULL);
545  p_islower(NULL);
546  p_isnotlower(NULL);
547  p_isprint(NULL);
548  p_isnotprint(NULL);
549  p_ispunct(NULL);
550  p_isnotpunct(NULL);
551  p_isspace(NULL);
552  p_isnotspace(NULL);
553  p_isupper(NULL);
554  p_isnotupper(NULL);
555  p_isxdigit(NULL);
556  p_isnotxdigit(NULL);
557  p_isEOF(NULL);
558  p_iseqC(NULL);
559  p_isneC(NULL);
560 }
static int p_iseqC(TParser *prs)
Definition: wparser_def.c:481
static int p_isneC(TParser *prs)
Definition: wparser_def.c:487
static int p_isEOF(TParser *prs)
Definition: wparser_def.c:474

References p_isEOF(), p_iseqC(), and p_isneC().

◆ checkcondition_HL()

static TSTernaryValue checkcondition_HL ( void *  opaque,
QueryOperand val,
ExecPhraseData data 
)
static

Definition at line 1981 of file wparser_def.c.

1982 {
1983  hlCheck *checkval = (hlCheck *) opaque;
1984  int i;
1985 
1986  /* scan words array for matching items */
1987  for (i = 0; i < checkval->len; i++)
1988  {
1989  if (checkval->words[i].item == val)
1990  {
1991  /* if data == NULL, don't need to report positions */
1992  if (!data)
1993  return TS_YES;
1994 
1995  if (!data->pos)
1996  {
1997  data->pos = palloc(sizeof(WordEntryPos) * checkval->len);
1998  data->allocated = true;
1999  data->npos = 1;
2000  data->pos[0] = checkval->words[i].pos;
2001  }
2002  else if (data->pos[data->npos - 1] < checkval->words[i].pos)
2003  {
2004  data->pos[data->npos++] = checkval->words[i].pos;
2005  }
2006  }
2007  }
2008 
2009  if (data && data->npos > 0)
2010  return TS_YES;
2011 
2012  return TS_NO;
2013 }
long val
Definition: informix.c:670
int i
Definition: isn.c:73
void * palloc(Size size)
Definition: mcxt.c:1316
const void * data
WordEntryPos pos
Definition: ts_public.h:68
QueryOperand * item
Definition: ts_public.h:70
HeadlineWordEntry * words
Definition: wparser_def.c:1968
uint16 WordEntryPos
Definition: ts_type.h:63
@ TS_NO
Definition: ts_utils.h:134
@ TS_YES
Definition: ts_utils.h:135

References data, i, HeadlineWordEntry::item, hlCheck::len, palloc(), HeadlineWordEntry::pos, TS_NO, TS_YES, val, and hlCheck::words.

Referenced by hlCover(), and prsd_headline().

◆ get_next_fragment()

static void get_next_fragment ( HeadlineParsedText prs,
int *  startpos,
int *  endpos,
int *  curlen,
int *  poslen,
int  max_words 
)
static

Definition at line 2220 of file wparser_def.c.

2222 {
2223  int i;
2224 
2225  /*
2226  * Objective: select a fragment of words between startpos and endpos such
2227  * that it has at most max_words and both ends have query words. If the
2228  * startpos and endpos are the endpoints of the cover and the cover has
2229  * fewer words than max_words, then this function should just return the
2230  * cover
2231  */
2232  /* first move startpos to an item */
2233  for (i = *startpos; i <= *endpos; i++)
2234  {
2235  *startpos = i;
2236  if (INTERESTINGWORD(i))
2237  break;
2238  }
2239  /* cut endpos to have only max_words */
2240  *curlen = 0;
2241  *poslen = 0;
2242  for (i = *startpos; i <= *endpos && *curlen < max_words; i++)
2243  {
2244  if (!NONWORDTOKEN(prs->words[i].type))
2245  *curlen += 1;
2246  if (INTERESTINGWORD(i))
2247  *poslen += 1;
2248  }
2249  /* if the cover was cut then move back endpos to a query item */
2250  if (*endpos > i)
2251  {
2252  *endpos = i;
2253  for (i = *endpos; i >= *startpos; i--)
2254  {
2255  *endpos = i;
2256  if (INTERESTINGWORD(i))
2257  break;
2258  if (!NONWORDTOKEN(prs->words[i].type))
2259  *curlen -= 1;
2260  }
2261  }
2262 }
static XLogRecPtr endpos
Definition: pg_receivewal.c:56
static XLogRecPtr startpos
HeadlineWordEntry * words
Definition: ts_public.h:76
#define NONWORDTOKEN(x)
Definition: wparser_def.c:1936

References endpos, i, INTERESTINGWORD, NONWORDTOKEN, startpos, HeadlineWordEntry::type, and HeadlineParsedText::words.

Referenced by mark_hl_fragments().

◆ hlCover()

static bool hlCover ( HeadlineParsedText prs,
TSQuery  query,
List locations,
int *  nextpos,
int *  p,
int *  q 
)
static

Definition at line 2032 of file wparser_def.c.

2034 {
2035  int pos = *nextpos;
2036 
2037  /* This loop repeats when our selected word-range fails the query */
2038  for (;;)
2039  {
2040  int posb,
2041  pose;
2042  ListCell *lc;
2043 
2044  /*
2045  * For each AND'ed query term or phrase, find its first occurrence at
2046  * or after pos; set pose to the maximum of those positions.
2047  *
2048  * We need not consider ORs or NOTs here; see the comments for
2049  * TS_execute_locations(). Rechecking the match with TS_execute(),
2050  * below, will deal with any ensuing imprecision.
2051  */
2052  pose = -1;
2053  foreach(lc, locations)
2054  {
2055  ExecPhraseData *pdata = (ExecPhraseData *) lfirst(lc);
2056  int first = -1;
2057 
2058  for (int i = 0; i < pdata->npos; i++)
2059  {
2060  /* For phrase matches, use the ending lexeme */
2061  int endp = pdata->pos[i];
2062 
2063  if (endp >= pos)
2064  {
2065  first = endp;
2066  break;
2067  }
2068  }
2069  if (first < 0)
2070  return false; /* no more matches for this term */
2071  if (first > pose)
2072  pose = first;
2073  }
2074 
2075  if (pose < 0)
2076  return false; /* we only get here if empty list */
2077 
2078  /*
2079  * Now, for each AND'ed query term or phrase, find its last occurrence
2080  * at or before pose; set posb to the minimum of those positions.
2081  *
2082  * We start posb at INT_MAX - 1 to guarantee no overflow if we compute
2083  * posb + 1 below.
2084  */
2085  posb = INT_MAX - 1;
2086  foreach(lc, locations)
2087  {
2088  ExecPhraseData *pdata = (ExecPhraseData *) lfirst(lc);
2089  int last = -1;
2090 
2091  for (int i = pdata->npos - 1; i >= 0; i--)
2092  {
2093  /* For phrase matches, use the starting lexeme */
2094  int startp = pdata->pos[i] - pdata->width;
2095 
2096  if (startp <= pose)
2097  {
2098  last = startp;
2099  break;
2100  }
2101  }
2102  if (last < posb)
2103  posb = last;
2104  }
2105 
2106  /*
2107  * We could end up with posb to the left of pos, in case some phrase
2108  * match crosses pos. Try the match starting at pos anyway, since the
2109  * result of TS_execute_locations is imprecise for phrase matches OR'd
2110  * with plain matches; that is, if the query is "(A <-> B) | C" then C
2111  * could match at pos even though the phrase match would have to
2112  * extend to the left of pos.
2113  */
2114  posb = Max(posb, pos);
2115 
2116  /* This test probably always succeeds, but be paranoid */
2117  if (posb <= pose)
2118  {
2119  /*
2120  * posb .. pose is now the shortest, earliest-after-pos range of
2121  * lexeme positions containing all the query terms. It will
2122  * contain all phrase matches, too, except in the corner case
2123  * described just above.
2124  *
2125  * Now convert these lexeme positions to indexes in prs->words[].
2126  */
2127  int idxb = -1;
2128  int idxe = -1;
2129 
2130  for (int i = 0; i < prs->curwords; i++)
2131  {
2132  if (prs->words[i].item == NULL)
2133  continue;
2134  if (idxb < 0 && prs->words[i].pos >= posb)
2135  idxb = i;
2136  if (prs->words[i].pos <= pose)
2137  idxe = i;
2138  else
2139  break;
2140  }
2141 
2142  /* This test probably always succeeds, but be paranoid */
2143  if (idxb >= 0 && idxe >= idxb)
2144  {
2145  /*
2146  * Finally, check that the selected range satisfies the query.
2147  * This should succeed in all simple cases; but odd cases
2148  * involving non-top-level NOT conditions or phrase matches
2149  * OR'd with other things could fail, since the result of
2150  * TS_execute_locations doesn't fully represent such things.
2151  */
2152  hlCheck ch;
2153 
2154  ch.words = &(prs->words[idxb]);
2155  ch.len = idxe - idxb + 1;
2156  if (TS_execute(GETQUERY(query), &ch,
2158  {
2159  /* Match! Advance *nextpos and return the word range. */
2160  *nextpos = posb + 1;
2161  *p = idxb;
2162  *q = idxe;
2163  return true;
2164  }
2165  }
2166  }
2167 
2168  /*
2169  * Advance pos and try again. Any later workable match must start
2170  * beyond posb.
2171  */
2172  pos = posb + 1;
2173  }
2174  /* Can't get here, but stupider compilers complain if we leave it off */
2175  return false;
2176 }
#define GETQUERY(x)
Definition: _int.h:157
#define Max(x, y)
Definition: c.h:998
#define lfirst(lc)
Definition: pg_list.h:172
WordEntryPos * pos
Definition: ts_utils.h:166
#define TS_EXEC_EMPTY
Definition: ts_utils.h:188
bool TS_execute(QueryItem *curitem, void *arg, uint32 flags, TSExecuteCallback chkcond)
Definition: tsvector_op.c:1854
static TSTernaryValue checkcondition_HL(void *opaque, QueryOperand *val, ExecPhraseData *data)
Definition: wparser_def.c:1981

References checkcondition_HL(), HeadlineParsedText::curwords, GETQUERY, i, HeadlineWordEntry::item, hlCheck::len, lfirst, Max, ExecPhraseData::npos, HeadlineWordEntry::pos, ExecPhraseData::pos, TS_EXEC_EMPTY, TS_execute(), ExecPhraseData::width, hlCheck::words, and HeadlineParsedText::words.

Referenced by mark_hl_fragments(), and mark_hl_words().

◆ mark_fragment()

static void mark_fragment ( HeadlineParsedText prs,
bool  highlightall,
int  startpos,
int  endpos 
)
static

Definition at line 2184 of file wparser_def.c.

2186 {
2187  int i;
2188 
2189  for (i = startpos; i <= endpos; i++)
2190  {
2191  if (prs->words[i].item)
2192  prs->words[i].selected = 1;
2193  if (!highlightall)
2194  {
2195  if (HLIDREPLACE(prs->words[i].type))
2196  prs->words[i].replace = 1;
2197  else if (HLIDSKIP(prs->words[i].type))
2198  prs->words[i].skip = 1;
2199  }
2200  else
2201  {
2202  if (XMLHLIDSKIP(prs->words[i].type))
2203  prs->words[i].skip = 1;
2204  }
2205 
2206  prs->words[i].in = (prs->words[i].repeated) ? 0 : 1;
2207  }
2208 }
#define XMLHLIDSKIP(x)
Definition: wparser_def.c:1935
#define HLIDSKIP(x)
Definition: wparser_def.c:1934
#define HLIDREPLACE(x)
Definition: wparser_def.c:1933

References endpos, HLIDREPLACE, HLIDSKIP, i, HeadlineWordEntry::in, HeadlineWordEntry::item, HeadlineWordEntry::repeated, HeadlineWordEntry::replace, HeadlineWordEntry::selected, HeadlineWordEntry::skip, startpos, HeadlineWordEntry::type, HeadlineParsedText::words, and XMLHLIDSKIP.

Referenced by mark_hl_fragments(), and mark_hl_words().

◆ mark_hl_fragments()

static void mark_hl_fragments ( HeadlineParsedText prs,
TSQuery  query,
List locations,
bool  highlightall,
int  shortword,
int  min_words,
int  max_words,
int  max_fragments 
)
static

Definition at line 2271 of file wparser_def.c.

2275 {
2276  int32 poslen,
2277  curlen,
2278  i,
2279  f,
2280  num_f = 0;
2281  int32 stretch,
2282  maxstretch,
2283  posmarker;
2284 
2285  int32 startpos = 0,
2286  endpos = 0,
2287  nextpos = 0,
2288  p = 0,
2289  q = 0;
2290 
2291  int32 numcovers = 0,
2292  maxcovers = 32;
2293 
2294  int32 minI,
2295  minwords,
2296  maxitems;
2297  CoverPos *covers;
2298 
2299  covers = palloc(maxcovers * sizeof(CoverPos));
2300 
2301  /* get all covers */
2302  while (hlCover(prs, query, locations, &nextpos, &p, &q))
2303  {
2304  startpos = p;
2305  endpos = q;
2306 
2307  /*
2308  * Break the cover into smaller fragments such that each fragment has
2309  * at most max_words. Also ensure that each end of each fragment is a
2310  * query word. This will allow us to stretch the fragment in either
2311  * direction
2312  */
2313 
2314  while (startpos <= endpos)
2315  {
2316  get_next_fragment(prs, &startpos, &endpos, &curlen, &poslen, max_words);
2317  if (numcovers >= maxcovers)
2318  {
2319  maxcovers *= 2;
2320  covers = repalloc(covers, sizeof(CoverPos) * maxcovers);
2321  }
2322  covers[numcovers].startpos = startpos;
2323  covers[numcovers].endpos = endpos;
2324  covers[numcovers].curlen = curlen;
2325  covers[numcovers].poslen = poslen;
2326  covers[numcovers].chosen = false;
2327  covers[numcovers].excluded = false;
2328  numcovers++;
2329  startpos = endpos + 1;
2330  endpos = q;
2331  }
2332  }
2333 
2334  /* choose best covers */
2335  for (f = 0; f < max_fragments; f++)
2336  {
2337  maxitems = 0;
2338  minwords = PG_INT32_MAX;
2339  minI = -1;
2340 
2341  /*
2342  * Choose the cover that contains max items. In case of tie choose the
2343  * one with smaller number of words.
2344  */
2345  for (i = 0; i < numcovers; i++)
2346  {
2347  if (!covers[i].chosen && !covers[i].excluded &&
2348  (maxitems < covers[i].poslen ||
2349  (maxitems == covers[i].poslen &&
2350  minwords > covers[i].curlen)))
2351  {
2352  maxitems = covers[i].poslen;
2353  minwords = covers[i].curlen;
2354  minI = i;
2355  }
2356  }
2357  /* if a cover was found mark it */
2358  if (minI >= 0)
2359  {
2360  covers[minI].chosen = true;
2361  /* adjust the size of cover */
2362  startpos = covers[minI].startpos;
2363  endpos = covers[minI].endpos;
2364  curlen = covers[minI].curlen;
2365  /* stretch the cover if cover size is lower than max_words */
2366  if (curlen < max_words)
2367  {
2368  /* divide the stretch on both sides of cover */
2369  maxstretch = (max_words - curlen) / 2;
2370 
2371  /*
2372  * first stretch the startpos stop stretching if 1. we hit the
2373  * beginning of document 2. exceed maxstretch 3. we hit an
2374  * already marked fragment
2375  */
2376  stretch = 0;
2377  posmarker = startpos;
2378  for (i = startpos - 1; i >= 0 && stretch < maxstretch && !prs->words[i].in; i--)
2379  {
2380  if (!NONWORDTOKEN(prs->words[i].type))
2381  {
2382  curlen++;
2383  stretch++;
2384  }
2385  posmarker = i;
2386  }
2387  /* cut back startpos till we find a good endpoint */
2388  for (i = posmarker; i < startpos && BADENDPOINT(i); i++)
2389  {
2390  if (!NONWORDTOKEN(prs->words[i].type))
2391  curlen--;
2392  }
2393  startpos = i;
2394  /* now stretch the endpos as much as possible */
2395  posmarker = endpos;
2396  for (i = endpos + 1; i < prs->curwords && curlen < max_words && !prs->words[i].in; i++)
2397  {
2398  if (!NONWORDTOKEN(prs->words[i].type))
2399  curlen++;
2400  posmarker = i;
2401  }
2402  /* cut back endpos till we find a good endpoint */
2403  for (i = posmarker; i > endpos && BADENDPOINT(i); i--)
2404  {
2405  if (!NONWORDTOKEN(prs->words[i].type))
2406  curlen--;
2407  }
2408  endpos = i;
2409  }
2410  covers[minI].startpos = startpos;
2411  covers[minI].endpos = endpos;
2412  covers[minI].curlen = curlen;
2413  /* Mark the chosen fragments (covers) */
2414  mark_fragment(prs, highlightall, startpos, endpos);
2415  num_f++;
2416  /* Exclude covers overlapping this one from future consideration */
2417  for (i = 0; i < numcovers; i++)
2418  {
2419  if (i != minI &&
2420  ((covers[i].startpos >= startpos &&
2421  covers[i].startpos <= endpos) ||
2422  (covers[i].endpos >= startpos &&
2423  covers[i].endpos <= endpos) ||
2424  (covers[i].startpos < startpos &&
2425  covers[i].endpos > endpos)))
2426  covers[i].excluded = true;
2427  }
2428  }
2429  else
2430  break; /* no selectable covers remain */
2431  }
2432 
2433  /* show the first min_words words if we have not marked anything */
2434  if (num_f <= 0)
2435  {
2436  startpos = curlen = 0;
2437  endpos = -1;
2438  for (i = 0; i < prs->curwords && curlen < min_words; i++)
2439  {
2440  if (!NONWORDTOKEN(prs->words[i].type))
2441  curlen++;
2442  endpos = i;
2443  }
2444  mark_fragment(prs, highlightall, startpos, endpos);
2445  }
2446 
2447  pfree(covers);
2448 }
#define PG_INT32_MAX
Definition: c.h:589
signed int int32
Definition: c.h:494
void pfree(void *pointer)
Definition: mcxt.c:1520
void * repalloc(void *pointer, Size size)
Definition: mcxt.c:1540
bool chosen
Definition: wparser_def.c:1961
int32 endpos
Definition: wparser_def.c:1958
int32 curlen
Definition: wparser_def.c:1960
int32 startpos
Definition: wparser_def.c:1957
bool excluded
Definition: wparser_def.c:1962
int32 poslen
Definition: wparser_def.c:1959
#define BADENDPOINT(j)
Definition: wparser_def.c:1950
static void mark_fragment(HeadlineParsedText *prs, bool highlightall, int startpos, int endpos)
Definition: wparser_def.c:2184
static bool hlCover(HeadlineParsedText *prs, TSQuery query, List *locations, int *nextpos, int *p, int *q)
Definition: wparser_def.c:2032
static void get_next_fragment(HeadlineParsedText *prs, int *startpos, int *endpos, int *curlen, int *poslen, int max_words)
Definition: wparser_def.c:2220

References BADENDPOINT, CoverPos::chosen, CoverPos::curlen, HeadlineParsedText::curwords, CoverPos::endpos, endpos, CoverPos::excluded, get_next_fragment(), hlCover(), i, HeadlineWordEntry::in, mark_fragment(), NONWORDTOKEN, palloc(), pfree(), PG_INT32_MAX, CoverPos::poslen, repalloc(), CoverPos::startpos, startpos, HeadlineWordEntry::type, and HeadlineParsedText::words.

Referenced by prsd_headline().

◆ mark_hl_words()

static void mark_hl_words ( HeadlineParsedText prs,
TSQuery  query,
List locations,
bool  highlightall,
int  shortword,
int  min_words,
int  max_words 
)
static

Definition at line 2454 of file wparser_def.c.

2457 {
2458  int nextpos = 0,
2459  p = 0,
2460  q = 0;
2461  int bestb = -1,
2462  beste = -1;
2463  int bestlen = -1;
2464  bool bestcover = false;
2465  int pose,
2466  posb,
2467  poslen,
2468  curlen;
2469  bool poscover;
2470  int i;
2471 
2472  if (!highlightall)
2473  {
2474  /* examine all covers, select a headline using the best one */
2475  while (hlCover(prs, query, locations, &nextpos, &p, &q))
2476  {
2477  /*
2478  * Count words (curlen) and interesting words (poslen) within
2479  * cover, but stop once we reach max_words. This step doesn't
2480  * consider whether that's a good stopping point. posb and pose
2481  * are set to the start and end indexes of the possible headline.
2482  */
2483  curlen = 0;
2484  poslen = 0;
2485  posb = pose = p;
2486  for (i = p; i <= q && curlen < max_words; i++)
2487  {
2488  if (!NONWORDTOKEN(prs->words[i].type))
2489  curlen++;
2490  if (INTERESTINGWORD(i))
2491  poslen++;
2492  pose = i;
2493  }
2494 
2495  if (curlen < max_words)
2496  {
2497  /*
2498  * We have room to lengthen the headline, so search forward
2499  * until it's full or we find a good stopping point. We'll
2500  * reconsider the word at "q", then move forward.
2501  */
2502  for (i = i - 1; i < prs->curwords && curlen < max_words; i++)
2503  {
2504  if (i > q)
2505  {
2506  if (!NONWORDTOKEN(prs->words[i].type))
2507  curlen++;
2508  if (INTERESTINGWORD(i))
2509  poslen++;
2510  }
2511  pose = i;
2512  if (BADENDPOINT(i))
2513  continue;
2514  if (curlen >= min_words)
2515  break;
2516  }
2517  if (curlen < min_words)
2518  {
2519  /*
2520  * Reached end of text and our headline is still shorter
2521  * than min_words, so try to extend it to the left.
2522  */
2523  for (i = p - 1; i >= 0; i--)
2524  {
2525  if (!NONWORDTOKEN(prs->words[i].type))
2526  curlen++;
2527  if (INTERESTINGWORD(i))
2528  poslen++;
2529  if (curlen >= max_words)
2530  break;
2531  if (BADENDPOINT(i))
2532  continue;
2533  if (curlen >= min_words)
2534  break;
2535  }
2536  posb = (i >= 0) ? i : 0;
2537  }
2538  }
2539  else
2540  {
2541  /*
2542  * Can't make headline longer, so consider making it shorter
2543  * if needed to avoid a bad endpoint.
2544  */
2545  if (i > q)
2546  i = q;
2547  for (; curlen > min_words; i--)
2548  {
2549  if (!BADENDPOINT(i))
2550  break;
2551  if (!NONWORDTOKEN(prs->words[i].type))
2552  curlen--;
2553  if (INTERESTINGWORD(i))
2554  poslen--;
2555  pose = i - 1;
2556  }
2557  }
2558 
2559  /*
2560  * Check whether the proposed headline includes the original
2561  * cover; it might not if we trimmed it due to max_words.
2562  */
2563  poscover = (posb <= p && pose >= q);
2564 
2565  /*
2566  * Adopt this headline if it's better than the last one, giving
2567  * highest priority to headlines including the cover, then to
2568  * headlines with more interesting words, then to headlines with
2569  * good stopping points. (Since bestlen is initially -1, we will
2570  * certainly adopt the first headline.)
2571  */
2572  if (poscover > bestcover ||
2573  (poscover == bestcover && poslen > bestlen) ||
2574  (poscover == bestcover && poslen == bestlen &&
2575  !BADENDPOINT(pose) && BADENDPOINT(beste)))
2576  {
2577  bestb = posb;
2578  beste = pose;
2579  bestlen = poslen;
2580  bestcover = poscover;
2581  }
2582  }
2583 
2584  /*
2585  * If we found nothing acceptable, select min_words words starting at
2586  * the beginning.
2587  */
2588  if (bestlen < 0)
2589  {
2590  curlen = 0;
2591  pose = -1;
2592  for (i = 0; i < prs->curwords && curlen < min_words; i++)
2593  {
2594  if (!NONWORDTOKEN(prs->words[i].type))
2595  curlen++;
2596  pose = i;
2597  }
2598  bestb = 0;
2599  beste = pose;
2600  }
2601  }
2602  else
2603  {
2604  /* highlightall mode: headline is whole document */
2605  bestb = 0;
2606  beste = prs->curwords - 1;
2607  }
2608 
2609  mark_fragment(prs, highlightall, bestb, beste);
2610 }

References BADENDPOINT, HeadlineParsedText::curwords, hlCover(), i, INTERESTINGWORD, mark_fragment(), NONWORDTOKEN, HeadlineWordEntry::type, and HeadlineParsedText::words.

Referenced by prsd_headline().

◆ newTParserPosition()

static TParserPosition* newTParserPosition ( TParserPosition prev)
static

Definition at line 272 of file wparser_def.c.

273 {
275 
276  if (prev)
277  memcpy(res, prev, sizeof(TParserPosition));
278  else
279  memset(res, 0, sizeof(TParserPosition));
280 
281  res->prev = prev;
282 
283  res->pushedAtAction = NULL;
284 
285  return res;
286 }

References palloc(), and res.

Referenced by p_isURLPath(), TParserCopyInit(), TParserGet(), and TParserInit().

◆ p_isascii()

static int p_isascii ( TParser prs)
static

Definition at line 493 of file wparser_def.c.

494 {
495  return (prs->state->charlen == 1 && isascii((unsigned char) *(prs->str + prs->state->posbyte))) ? 1 : 0;
496 }
char * str
Definition: wparser_def.c:244
TParserPosition * state
Definition: wparser_def.c:252

References TParserPosition::charlen, TParserPosition::posbyte, TParser::state, and TParser::str.

Referenced by p_isasclet().

◆ p_isasclet()

static int p_isasclet ( TParser prs)
static

Definition at line 499 of file wparser_def.c.

500 {
501  return (p_isascii(prs) && p_isalpha(prs)) ? 1 : 0;
502 }
static int p_isascii(TParser *prs)
Definition: wparser_def.c:493

References p_isascii().

◆ p_isEOF()

static int p_isEOF ( TParser prs)
static

Definition at line 474 of file wparser_def.c.

475 {
476  Assert(prs->state);
477  return (prs->state->posbyte == prs->lenstr || prs->state->charlen == 0) ? 1 : 0;
478 }
#define Assert(condition)
Definition: c.h:858
int lenstr
Definition: wparser_def.c:245

References Assert, TParserPosition::charlen, TParser::lenstr, TParserPosition::posbyte, and TParser::state.

Referenced by _make_compiler_happy().

◆ p_iseqC()

static int p_iseqC ( TParser prs)
static

Definition at line 481 of file wparser_def.c.

482 {
483  return p_iseq(prs, prs->c);
484 }
char c
Definition: wparser_def.c:257

References TParser::c.

Referenced by _make_compiler_happy().

◆ p_ishost()

static int p_ishost ( TParser prs)
static

Definition at line 629 of file wparser_def.c.

630 {
631  TParser *tmpprs = TParserCopyInit(prs);
632  int res = 0;
633 
634  tmpprs->wanthost = true;
635 
636  /*
637  * Check stack depth before recursing. (Since TParserGet() doesn't
638  * normally recurse, we put the cost of checking here not there.)
639  */
641 
642  if (TParserGet(tmpprs) && tmpprs->type == HOST)
643  {
644  prs->state->posbyte += tmpprs->lenbytetoken;
645  prs->state->poschar += tmpprs->lenchartoken;
646  prs->state->lenbytetoken += tmpprs->lenbytetoken;
647  prs->state->lenchartoken += tmpprs->lenchartoken;
648  prs->state->charlen = tmpprs->state->charlen;
649  res = 1;
650  }
651  TParserCopyClose(tmpprs);
652 
653  return res;
654 }
void check_stack_depth(void)
Definition: postgres.c:3531
int type
Definition: wparser_def.c:263
bool wanthost
Definition: wparser_def.c:254
int lenbytetoken
Definition: wparser_def.c:261
int lenchartoken
Definition: wparser_def.c:262
static TParser * TParserCopyInit(const TParser *orig)
Definition: wparser_def.c:346
#define HOST
Definition: wparser_def.c:41
static bool TParserGet(TParser *prs)
Definition: wparser_def.c:1710
static void TParserCopyClose(TParser *prs)
Definition: wparser_def.c:397

References TParserPosition::charlen, check_stack_depth(), HOST, TParserPosition::lenbytetoken, TParser::lenbytetoken, TParserPosition::lenchartoken, TParser::lenchartoken, TParserPosition::posbyte, TParserPosition::poschar, res, TParser::state, TParserCopyClose(), TParserCopyInit(), TParserGet(), TParser::type, and TParser::wanthost.

◆ p_isignore()

static int p_isignore ( TParser prs)
static

Definition at line 623 of file wparser_def.c.

624 {
625  return (prs->ignore) ? 1 : 0;
626 }
bool ignore
Definition: wparser_def.c:253

References TParser::ignore.

◆ p_isneC()

static int p_isneC ( TParser prs)
static

Definition at line 487 of file wparser_def.c.

488 {
489  return !p_iseq(prs, prs->c);
490 }

References TParser::c.

Referenced by _make_compiler_happy().

◆ p_isspecial()

static int p_isspecial ( TParser prs)
static

Definition at line 692 of file wparser_def.c.

693 {
694  /*
695  * pg_dsplen could return -1 which means error or control character
696  */
697  if (pg_dsplen(prs->str + prs->state->posbyte) == 0)
698  return 1;
699 
700  /*
701  * Unicode Characters in the 'Mark, Spacing Combining' Category That
702  * characters are not alpha although they are not breakers of word too.
703  * Check that only in utf encoding, because other encodings aren't
704  * supported by postgres or even exists.
705  */
706  if (GetDatabaseEncoding() == PG_UTF8 && prs->usewide)
707  {
708  static const pg_wchar strange_letter[] = {
709  /*
710  * use binary search, so elements should be ordered
711  */
712  0x0903, /* DEVANAGARI SIGN VISARGA */
713  0x093E, /* DEVANAGARI VOWEL SIGN AA */
714  0x093F, /* DEVANAGARI VOWEL SIGN I */
715  0x0940, /* DEVANAGARI VOWEL SIGN II */
716  0x0949, /* DEVANAGARI VOWEL SIGN CANDRA O */
717  0x094A, /* DEVANAGARI VOWEL SIGN SHORT O */
718  0x094B, /* DEVANAGARI VOWEL SIGN O */
719  0x094C, /* DEVANAGARI VOWEL SIGN AU */
720  0x0982, /* BENGALI SIGN ANUSVARA */
721  0x0983, /* BENGALI SIGN VISARGA */
722  0x09BE, /* BENGALI VOWEL SIGN AA */
723  0x09BF, /* BENGALI VOWEL SIGN I */
724  0x09C0, /* BENGALI VOWEL SIGN II */
725  0x09C7, /* BENGALI VOWEL SIGN E */
726  0x09C8, /* BENGALI VOWEL SIGN AI */
727  0x09CB, /* BENGALI VOWEL SIGN O */
728  0x09CC, /* BENGALI VOWEL SIGN AU */
729  0x09D7, /* BENGALI AU LENGTH MARK */
730  0x0A03, /* GURMUKHI SIGN VISARGA */
731  0x0A3E, /* GURMUKHI VOWEL SIGN AA */
732  0x0A3F, /* GURMUKHI VOWEL SIGN I */
733  0x0A40, /* GURMUKHI VOWEL SIGN II */
734  0x0A83, /* GUJARATI SIGN VISARGA */
735  0x0ABE, /* GUJARATI VOWEL SIGN AA */
736  0x0ABF, /* GUJARATI VOWEL SIGN I */
737  0x0AC0, /* GUJARATI VOWEL SIGN II */
738  0x0AC9, /* GUJARATI VOWEL SIGN CANDRA O */
739  0x0ACB, /* GUJARATI VOWEL SIGN O */
740  0x0ACC, /* GUJARATI VOWEL SIGN AU */
741  0x0B02, /* ORIYA SIGN ANUSVARA */
742  0x0B03, /* ORIYA SIGN VISARGA */
743  0x0B3E, /* ORIYA VOWEL SIGN AA */
744  0x0B40, /* ORIYA VOWEL SIGN II */
745  0x0B47, /* ORIYA VOWEL SIGN E */
746  0x0B48, /* ORIYA VOWEL SIGN AI */
747  0x0B4B, /* ORIYA VOWEL SIGN O */
748  0x0B4C, /* ORIYA VOWEL SIGN AU */
749  0x0B57, /* ORIYA AU LENGTH MARK */
750  0x0BBE, /* TAMIL VOWEL SIGN AA */
751  0x0BBF, /* TAMIL VOWEL SIGN I */
752  0x0BC1, /* TAMIL VOWEL SIGN U */
753  0x0BC2, /* TAMIL VOWEL SIGN UU */
754  0x0BC6, /* TAMIL VOWEL SIGN E */
755  0x0BC7, /* TAMIL VOWEL SIGN EE */
756  0x0BC8, /* TAMIL VOWEL SIGN AI */
757  0x0BCA, /* TAMIL VOWEL SIGN O */
758  0x0BCB, /* TAMIL VOWEL SIGN OO */
759  0x0BCC, /* TAMIL VOWEL SIGN AU */
760  0x0BD7, /* TAMIL AU LENGTH MARK */
761  0x0C01, /* TELUGU SIGN CANDRABINDU */
762  0x0C02, /* TELUGU SIGN ANUSVARA */
763  0x0C03, /* TELUGU SIGN VISARGA */
764  0x0C41, /* TELUGU VOWEL SIGN U */
765  0x0C42, /* TELUGU VOWEL SIGN UU */
766  0x0C43, /* TELUGU VOWEL SIGN VOCALIC R */
767  0x0C44, /* TELUGU VOWEL SIGN VOCALIC RR */
768  0x0C82, /* KANNADA SIGN ANUSVARA */
769  0x0C83, /* KANNADA SIGN VISARGA */
770  0x0CBE, /* KANNADA VOWEL SIGN AA */
771  0x0CC0, /* KANNADA VOWEL SIGN II */
772  0x0CC1, /* KANNADA VOWEL SIGN U */
773  0x0CC2, /* KANNADA VOWEL SIGN UU */
774  0x0CC3, /* KANNADA VOWEL SIGN VOCALIC R */
775  0x0CC4, /* KANNADA VOWEL SIGN VOCALIC RR */
776  0x0CC7, /* KANNADA VOWEL SIGN EE */
777  0x0CC8, /* KANNADA VOWEL SIGN AI */
778  0x0CCA, /* KANNADA VOWEL SIGN O */
779  0x0CCB, /* KANNADA VOWEL SIGN OO */
780  0x0CD5, /* KANNADA LENGTH MARK */
781  0x0CD6, /* KANNADA AI LENGTH MARK */
782  0x0D02, /* MALAYALAM SIGN ANUSVARA */
783  0x0D03, /* MALAYALAM SIGN VISARGA */
784  0x0D3E, /* MALAYALAM VOWEL SIGN AA */
785  0x0D3F, /* MALAYALAM VOWEL SIGN I */
786  0x0D40, /* MALAYALAM VOWEL SIGN II */
787  0x0D46, /* MALAYALAM VOWEL SIGN E */
788  0x0D47, /* MALAYALAM VOWEL SIGN EE */
789  0x0D48, /* MALAYALAM VOWEL SIGN AI */
790  0x0D4A, /* MALAYALAM VOWEL SIGN O */
791  0x0D4B, /* MALAYALAM VOWEL SIGN OO */
792  0x0D4C, /* MALAYALAM VOWEL SIGN AU */
793  0x0D57, /* MALAYALAM AU LENGTH MARK */
794  0x0D82, /* SINHALA SIGN ANUSVARAYA */
795  0x0D83, /* SINHALA SIGN VISARGAYA */
796  0x0DCF, /* SINHALA VOWEL SIGN AELA-PILLA */
797  0x0DD0, /* SINHALA VOWEL SIGN KETTI AEDA-PILLA */
798  0x0DD1, /* SINHALA VOWEL SIGN DIGA AEDA-PILLA */
799  0x0DD8, /* SINHALA VOWEL SIGN GAETTA-PILLA */
800  0x0DD9, /* SINHALA VOWEL SIGN KOMBUVA */
801  0x0DDA, /* SINHALA VOWEL SIGN DIGA KOMBUVA */
802  0x0DDB, /* SINHALA VOWEL SIGN KOMBU DEKA */
803  0x0DDC, /* SINHALA VOWEL SIGN KOMBUVA HAA AELA-PILLA */
804  0x0DDD, /* SINHALA VOWEL SIGN KOMBUVA HAA DIGA
805  * AELA-PILLA */
806  0x0DDE, /* SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA */
807  0x0DDF, /* SINHALA VOWEL SIGN GAYANUKITTA */
808  0x0DF2, /* SINHALA VOWEL SIGN DIGA GAETTA-PILLA */
809  0x0DF3, /* SINHALA VOWEL SIGN DIGA GAYANUKITTA */
810  0x0F3E, /* TIBETAN SIGN YAR TSHES */
811  0x0F3F, /* TIBETAN SIGN MAR TSHES */
812  0x0F7F, /* TIBETAN SIGN RNAM BCAD */
813  0x102B, /* MYANMAR VOWEL SIGN TALL AA */
814  0x102C, /* MYANMAR VOWEL SIGN AA */
815  0x1031, /* MYANMAR VOWEL SIGN E */
816  0x1038, /* MYANMAR SIGN VISARGA */
817  0x103B, /* MYANMAR CONSONANT SIGN MEDIAL YA */
818  0x103C, /* MYANMAR CONSONANT SIGN MEDIAL RA */
819  0x1056, /* MYANMAR VOWEL SIGN VOCALIC R */
820  0x1057, /* MYANMAR VOWEL SIGN VOCALIC RR */
821  0x1062, /* MYANMAR VOWEL SIGN SGAW KAREN EU */
822  0x1063, /* MYANMAR TONE MARK SGAW KAREN HATHI */
823  0x1064, /* MYANMAR TONE MARK SGAW KAREN KE PHO */
824  0x1067, /* MYANMAR VOWEL SIGN WESTERN PWO KAREN EU */
825  0x1068, /* MYANMAR VOWEL SIGN WESTERN PWO KAREN UE */
826  0x1069, /* MYANMAR SIGN WESTERN PWO KAREN TONE-1 */
827  0x106A, /* MYANMAR SIGN WESTERN PWO KAREN TONE-2 */
828  0x106B, /* MYANMAR SIGN WESTERN PWO KAREN TONE-3 */
829  0x106C, /* MYANMAR SIGN WESTERN PWO KAREN TONE-4 */
830  0x106D, /* MYANMAR SIGN WESTERN PWO KAREN TONE-5 */
831  0x1083, /* MYANMAR VOWEL SIGN SHAN AA */
832  0x1084, /* MYANMAR VOWEL SIGN SHAN E */
833  0x1087, /* MYANMAR SIGN SHAN TONE-2 */
834  0x1088, /* MYANMAR SIGN SHAN TONE-3 */
835  0x1089, /* MYANMAR SIGN SHAN TONE-5 */
836  0x108A, /* MYANMAR SIGN SHAN TONE-6 */
837  0x108B, /* MYANMAR SIGN SHAN COUNCIL TONE-2 */
838  0x108C, /* MYANMAR SIGN SHAN COUNCIL TONE-3 */
839  0x108F, /* MYANMAR SIGN RUMAI PALAUNG TONE-5 */
840  0x17B6, /* KHMER VOWEL SIGN AA */
841  0x17BE, /* KHMER VOWEL SIGN OE */
842  0x17BF, /* KHMER VOWEL SIGN YA */
843  0x17C0, /* KHMER VOWEL SIGN IE */
844  0x17C1, /* KHMER VOWEL SIGN E */
845  0x17C2, /* KHMER VOWEL SIGN AE */
846  0x17C3, /* KHMER VOWEL SIGN AI */
847  0x17C4, /* KHMER VOWEL SIGN OO */
848  0x17C5, /* KHMER VOWEL SIGN AU */
849  0x17C7, /* KHMER SIGN REAHMUK */
850  0x17C8, /* KHMER SIGN YUUKALEAPINTU */
851  0x1923, /* LIMBU VOWEL SIGN EE */
852  0x1924, /* LIMBU VOWEL SIGN AI */
853  0x1925, /* LIMBU VOWEL SIGN OO */
854  0x1926, /* LIMBU VOWEL SIGN AU */
855  0x1929, /* LIMBU SUBJOINED LETTER YA */
856  0x192A, /* LIMBU SUBJOINED LETTER RA */
857  0x192B, /* LIMBU SUBJOINED LETTER WA */
858  0x1930, /* LIMBU SMALL LETTER KA */
859  0x1931, /* LIMBU SMALL LETTER NGA */
860  0x1933, /* LIMBU SMALL LETTER TA */
861  0x1934, /* LIMBU SMALL LETTER NA */
862  0x1935, /* LIMBU SMALL LETTER PA */
863  0x1936, /* LIMBU SMALL LETTER MA */
864  0x1937, /* LIMBU SMALL LETTER RA */
865  0x1938, /* LIMBU SMALL LETTER LA */
866  0x19B0, /* NEW TAI LUE VOWEL SIGN VOWEL SHORTENER */
867  0x19B1, /* NEW TAI LUE VOWEL SIGN AA */
868  0x19B2, /* NEW TAI LUE VOWEL SIGN II */
869  0x19B3, /* NEW TAI LUE VOWEL SIGN U */
870  0x19B4, /* NEW TAI LUE VOWEL SIGN UU */
871  0x19B5, /* NEW TAI LUE VOWEL SIGN E */
872  0x19B6, /* NEW TAI LUE VOWEL SIGN AE */
873  0x19B7, /* NEW TAI LUE VOWEL SIGN O */
874  0x19B8, /* NEW TAI LUE VOWEL SIGN OA */
875  0x19B9, /* NEW TAI LUE VOWEL SIGN UE */
876  0x19BA, /* NEW TAI LUE VOWEL SIGN AY */
877  0x19BB, /* NEW TAI LUE VOWEL SIGN AAY */
878  0x19BC, /* NEW TAI LUE VOWEL SIGN UY */
879  0x19BD, /* NEW TAI LUE VOWEL SIGN OY */
880  0x19BE, /* NEW TAI LUE VOWEL SIGN OAY */
881  0x19BF, /* NEW TAI LUE VOWEL SIGN UEY */
882  0x19C0, /* NEW TAI LUE VOWEL SIGN IY */
883  0x19C8, /* NEW TAI LUE TONE MARK-1 */
884  0x19C9, /* NEW TAI LUE TONE MARK-2 */
885  0x1A19, /* BUGINESE VOWEL SIGN E */
886  0x1A1A, /* BUGINESE VOWEL SIGN O */
887  0x1A1B, /* BUGINESE VOWEL SIGN AE */
888  0x1B04, /* BALINESE SIGN BISAH */
889  0x1B35, /* BALINESE VOWEL SIGN TEDUNG */
890  0x1B3B, /* BALINESE VOWEL SIGN RA REPA TEDUNG */
891  0x1B3D, /* BALINESE VOWEL SIGN LA LENGA TEDUNG */
892  0x1B3E, /* BALINESE VOWEL SIGN TALING */
893  0x1B3F, /* BALINESE VOWEL SIGN TALING REPA */
894  0x1B40, /* BALINESE VOWEL SIGN TALING TEDUNG */
895  0x1B41, /* BALINESE VOWEL SIGN TALING REPA TEDUNG */
896  0x1B43, /* BALINESE VOWEL SIGN PEPET TEDUNG */
897  0x1B44, /* BALINESE ADEG ADEG */
898  0x1B82, /* SUNDANESE SIGN PANGWISAD */
899  0x1BA1, /* SUNDANESE CONSONANT SIGN PAMINGKAL */
900  0x1BA6, /* SUNDANESE VOWEL SIGN PANAELAENG */
901  0x1BA7, /* SUNDANESE VOWEL SIGN PANOLONG */
902  0x1BAA, /* SUNDANESE SIGN PAMAAEH */
903  0x1C24, /* LEPCHA SUBJOINED LETTER YA */
904  0x1C25, /* LEPCHA SUBJOINED LETTER RA */
905  0x1C26, /* LEPCHA VOWEL SIGN AA */
906  0x1C27, /* LEPCHA VOWEL SIGN I */
907  0x1C28, /* LEPCHA VOWEL SIGN O */
908  0x1C29, /* LEPCHA VOWEL SIGN OO */
909  0x1C2A, /* LEPCHA VOWEL SIGN U */
910  0x1C2B, /* LEPCHA VOWEL SIGN UU */
911  0x1C34, /* LEPCHA CONSONANT SIGN NYIN-DO */
912  0x1C35, /* LEPCHA CONSONANT SIGN KANG */
913  0xA823, /* SYLOTI NAGRI VOWEL SIGN A */
914  0xA824, /* SYLOTI NAGRI VOWEL SIGN I */
915  0xA827, /* SYLOTI NAGRI VOWEL SIGN OO */
916  0xA880, /* SAURASHTRA SIGN ANUSVARA */
917  0xA881, /* SAURASHTRA SIGN VISARGA */
918  0xA8B4, /* SAURASHTRA CONSONANT SIGN HAARU */
919  0xA8B5, /* SAURASHTRA VOWEL SIGN AA */
920  0xA8B6, /* SAURASHTRA VOWEL SIGN I */
921  0xA8B7, /* SAURASHTRA VOWEL SIGN II */
922  0xA8B8, /* SAURASHTRA VOWEL SIGN U */
923  0xA8B9, /* SAURASHTRA VOWEL SIGN UU */
924  0xA8BA, /* SAURASHTRA VOWEL SIGN VOCALIC R */
925  0xA8BB, /* SAURASHTRA VOWEL SIGN VOCALIC RR */
926  0xA8BC, /* SAURASHTRA VOWEL SIGN VOCALIC L */
927  0xA8BD, /* SAURASHTRA VOWEL SIGN VOCALIC LL */
928  0xA8BE, /* SAURASHTRA VOWEL SIGN E */
929  0xA8BF, /* SAURASHTRA VOWEL SIGN EE */
930  0xA8C0, /* SAURASHTRA VOWEL SIGN AI */
931  0xA8C1, /* SAURASHTRA VOWEL SIGN O */
932  0xA8C2, /* SAURASHTRA VOWEL SIGN OO */
933  0xA8C3, /* SAURASHTRA VOWEL SIGN AU */
934  0xA952, /* REJANG CONSONANT SIGN H */
935  0xA953, /* REJANG VIRAMA */
936  0xAA2F, /* CHAM VOWEL SIGN O */
937  0xAA30, /* CHAM VOWEL SIGN AI */
938  0xAA33, /* CHAM CONSONANT SIGN YA */
939  0xAA34, /* CHAM CONSONANT SIGN RA */
940  0xAA4D /* CHAM CONSONANT SIGN FINAL H */
941  };
942  const pg_wchar *StopLow = strange_letter,
943  *StopHigh = strange_letter + lengthof(strange_letter),
944  *StopMiddle;
945  pg_wchar c;
946 
947  if (prs->pgwstr)
948  c = *(prs->pgwstr + prs->state->poschar);
949  else
950  c = (pg_wchar) *(prs->wstr + prs->state->poschar);
951 
952  while (StopLow < StopHigh)
953  {
954  StopMiddle = StopLow + ((StopHigh - StopLow) >> 1);
955  if (*StopMiddle == c)
956  return 1;
957  else if (*StopMiddle < c)
958  StopLow = StopMiddle + 1;
959  else
960  StopHigh = StopMiddle;
961  }
962  }
963 
964  return 0;
965 }
#define lengthof(array)
Definition: c.h:788
unsigned int pg_wchar
Definition: mbprint.c:31
int GetDatabaseEncoding(void)
Definition: mbutils.c:1261
int pg_dsplen(const char *mbstr)
Definition: mbutils.c:1030
@ PG_UTF8
Definition: pg_wchar.h:232
pg_wchar * pgwstr
Definition: wparser_def.c:247
wchar_t * wstr
Definition: wparser_def.c:246
bool usewide
Definition: wparser_def.c:248

References GetDatabaseEncoding(), lengthof, pg_dsplen(), PG_UTF8, TParser::pgwstr, TParserPosition::posbyte, TParserPosition::poschar, TParser::state, TParser::str, TParser::usewide, and TParser::wstr.

◆ p_isstophost()

static int p_isstophost ( TParser prs)
static

Definition at line 612 of file wparser_def.c.

613 {
614  if (prs->wanthost)
615  {
616  prs->wanthost = false;
617  return 1;
618  }
619  return 0;
620 }

References TParser::wanthost.

◆ p_isurlchar()

static int p_isurlchar ( TParser prs)
static

Definition at line 505 of file wparser_def.c.

506 {
507  char ch;
508 
509  /* no non-ASCII need apply */
510  if (prs->state->charlen != 1)
511  return 0;
512  ch = *(prs->str + prs->state->posbyte);
513  /* no spaces or control characters */
514  if (ch <= 0x20 || ch >= 0x7F)
515  return 0;
516  /* reject characters disallowed by RFC 3986 */
517  switch (ch)
518  {
519  case '"':
520  case '<':
521  case '>':
522  case '\\':
523  case '^':
524  case '`':
525  case '{':
526  case '|':
527  case '}':
528  return 0;
529  }
530  return 1;
531 }

References TParserPosition::charlen, TParserPosition::posbyte, TParser::state, and TParser::str.

◆ p_isURLPath()

static int p_isURLPath ( TParser prs)
static

Definition at line 657 of file wparser_def.c.

658 {
659  TParser *tmpprs = TParserCopyInit(prs);
660  int res = 0;
661 
662  tmpprs->state = newTParserPosition(tmpprs->state);
663  tmpprs->state->state = TPS_InURLPathFirst;
664 
665  /*
666  * Check stack depth before recursing. (Since TParserGet() doesn't
667  * normally recurse, we put the cost of checking here not there.)
668  */
670 
671  if (TParserGet(tmpprs) && tmpprs->type == URLPATH)
672  {
673  prs->state->posbyte += tmpprs->lenbytetoken;
674  prs->state->poschar += tmpprs->lenchartoken;
675  prs->state->lenbytetoken += tmpprs->lenbytetoken;
676  prs->state->lenchartoken += tmpprs->lenchartoken;
677  prs->state->charlen = tmpprs->state->charlen;
678  res = 1;
679  }
680  TParserCopyClose(tmpprs);
681 
682  return res;
683 }
TParserState state
Definition: wparser_def.c:236
static TParserPosition * newTParserPosition(TParserPosition *prev)
Definition: wparser_def.c:272
#define URLPATH
Definition: wparser_def.c:53

References TParserPosition::charlen, check_stack_depth(), TParserPosition::lenbytetoken, TParser::lenbytetoken, TParserPosition::lenchartoken, TParser::lenchartoken, newTParserPosition(), TParserPosition::posbyte, TParserPosition::poschar, res, TParserPosition::state, TParser::state, TParserCopyClose(), TParserCopyInit(), TParserGet(), TPS_InURLPathFirst, TParser::type, and URLPATH.

◆ p_iswhat()

p_iswhat ( alnum  ,
 
)

Definition at line 454 of file wparser_def.c.

468 {
469  Assert(prs->state);
470  return ((prs->state->charlen == 1 && *(prs->str + prs->state->posbyte) == c)) ? 1 : 0;
471 }

References Assert.

◆ prsd_end()

Datum prsd_end ( PG_FUNCTION_ARGS  )

Definition at line 1918 of file wparser_def.c.

1919 {
1920  TParser *p = (TParser *) PG_GETARG_POINTER(0);
1921 
1922  TParserClose(p);
1923  PG_RETURN_VOID();
1924 }
#define PG_RETURN_VOID()
Definition: fmgr.h:349
#define PG_GETARG_POINTER(n)
Definition: fmgr.h:276
static void TParserClose(TParser *prs)
Definition: wparser_def.c:372

References PG_GETARG_POINTER, PG_RETURN_VOID, and TParserClose().

◆ prsd_headline()

Datum prsd_headline ( PG_FUNCTION_ARGS  )

Definition at line 2616 of file wparser_def.c.

2617 {
2619  List *prsoptions = (List *) PG_GETARG_POINTER(1);
2620  TSQuery query = PG_GETARG_TSQUERY(2);
2621  List *locations;
2622 
2623  /* default option values: */
2624  int min_words = 15;
2625  int max_words = 35;
2626  int shortword = 3;
2627  int max_fragments = 0;
2628  bool highlightall = false;
2629  ListCell *l;
2630 
2631  /* Extract configuration option values */
2632  prs->startsel = NULL;
2633  prs->stopsel = NULL;
2634  prs->fragdelim = NULL;
2635  foreach(l, prsoptions)
2636  {
2637  DefElem *defel = (DefElem *) lfirst(l);
2638  char *val = defGetString(defel);
2639 
2640  if (pg_strcasecmp(defel->defname, "MaxWords") == 0)
2641  max_words = pg_strtoint32(val);
2642  else if (pg_strcasecmp(defel->defname, "MinWords") == 0)
2643  min_words = pg_strtoint32(val);
2644  else if (pg_strcasecmp(defel->defname, "ShortWord") == 0)
2645  shortword = pg_strtoint32(val);
2646  else if (pg_strcasecmp(defel->defname, "MaxFragments") == 0)
2647  max_fragments = pg_strtoint32(val);
2648  else if (pg_strcasecmp(defel->defname, "StartSel") == 0)
2649  prs->startsel = pstrdup(val);
2650  else if (pg_strcasecmp(defel->defname, "StopSel") == 0)
2651  prs->stopsel = pstrdup(val);
2652  else if (pg_strcasecmp(defel->defname, "FragmentDelimiter") == 0)
2653  prs->fragdelim = pstrdup(val);
2654  else if (pg_strcasecmp(defel->defname, "HighlightAll") == 0)
2655  highlightall = (pg_strcasecmp(val, "1") == 0 ||
2656  pg_strcasecmp(val, "on") == 0 ||
2657  pg_strcasecmp(val, "true") == 0 ||
2658  pg_strcasecmp(val, "t") == 0 ||
2659  pg_strcasecmp(val, "y") == 0 ||
2660  pg_strcasecmp(val, "yes") == 0);
2661  else
2662  ereport(ERROR,
2663  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2664  errmsg("unrecognized headline parameter: \"%s\"",
2665  defel->defname)));
2666  }
2667 
2668  /* in HighlightAll mode these parameters are ignored */
2669  if (!highlightall)
2670  {
2671  if (min_words >= max_words)
2672  ereport(ERROR,
2673  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2674  errmsg("MinWords should be less than MaxWords")));
2675  if (min_words <= 0)
2676  ereport(ERROR,
2677  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2678  errmsg("MinWords should be positive")));
2679  if (shortword < 0)
2680  ereport(ERROR,
2681  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2682  errmsg("ShortWord should be >= 0")));
2683  if (max_fragments < 0)
2684  ereport(ERROR,
2685  (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
2686  errmsg("MaxFragments should be >= 0")));
2687  }
2688 
2689  /* Locate words and phrases matching the query */
2690  if (query->size > 0)
2691  {
2692  hlCheck ch;
2693 
2694  ch.words = prs->words;
2695  ch.len = prs->curwords;
2696  locations = TS_execute_locations(GETQUERY(query), &ch, TS_EXEC_EMPTY,
2698  }
2699  else
2700  locations = NIL; /* empty query matches nothing */
2701 
2702  /* Apply appropriate headline selector */
2703  if (max_fragments == 0)
2704  mark_hl_words(prs, query, locations, highlightall, shortword,
2705  min_words, max_words);
2706  else
2707  mark_hl_fragments(prs, query, locations, highlightall, shortword,
2708  min_words, max_words, max_fragments);
2709 
2710  /* Fill in default values for string options */
2711  if (!prs->startsel)
2712  prs->startsel = pstrdup("<b>");
2713  if (!prs->stopsel)
2714  prs->stopsel = pstrdup("</b>");
2715  if (!prs->fragdelim)
2716  prs->fragdelim = pstrdup(" ... ");
2717 
2718  /* Caller will need these lengths, too */
2719  prs->startsellen = strlen(prs->startsel);
2720  prs->stopsellen = strlen(prs->stopsel);
2721  prs->fragdelimlen = strlen(prs->fragdelim);
2722 
2723  PG_RETURN_POINTER(prs);
2724 }
char * defGetString(DefElem *def)
Definition: define.c:48
int errcode(int sqlerrcode)
Definition: elog.c:859
int errmsg(const char *fmt,...)
Definition: elog.c:1072
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
#define PG_RETURN_POINTER(x)
Definition: fmgr.h:361
char * pstrdup(const char *in)
Definition: mcxt.c:1695
int32 pg_strtoint32(const char *s)
Definition: numutils.c:383
#define NIL
Definition: pg_list.h:68
int pg_strcasecmp(const char *s1, const char *s2)
Definition: pgstrcasecmp.c:36
char * defname
Definition: parsenodes.h:815
Definition: pg_list.h:54
int32 size
Definition: ts_type.h:221
#define PG_GETARG_TSQUERY(n)
Definition: ts_type.h:266
List * TS_execute_locations(QueryItem *curitem, void *arg, uint32 flags, TSExecuteCallback chkcond)
Definition: tsvector_op.c:2007
static void mark_hl_fragments(HeadlineParsedText *prs, TSQuery query, List *locations, bool highlightall, int shortword, int min_words, int max_words, int max_fragments)
Definition: wparser_def.c:2271
static void mark_hl_words(HeadlineParsedText *prs, TSQuery query, List *locations, bool highlightall, int shortword, int min_words, int max_words)
Definition: wparser_def.c:2454

References checkcondition_HL(), HeadlineParsedText::curwords, defGetString(), DefElem::defname, ereport, errcode(), errmsg(), ERROR, HeadlineParsedText::fragdelim, HeadlineParsedText::fragdelimlen, GETQUERY, hlCheck::len, lfirst, mark_hl_fragments(), mark_hl_words(), NIL, PG_GETARG_POINTER, PG_GETARG_TSQUERY, PG_RETURN_POINTER, pg_strcasecmp(), pg_strtoint32(), pstrdup(), TSQueryData::size, HeadlineParsedText::startsel, HeadlineParsedText::startsellen, HeadlineParsedText::stopsel, HeadlineParsedText::stopsellen, TS_EXEC_EMPTY, TS_execute_locations(), val, hlCheck::words, and HeadlineParsedText::words.

◆ prsd_lextype()

Datum prsd_lextype ( PG_FUNCTION_ARGS  )

Definition at line 1878 of file wparser_def.c.

1879 {
1880  LexDescr *descr = (LexDescr *) palloc(sizeof(LexDescr) * (LASTNUM + 1));
1881  int i;
1882 
1883  for (i = 1; i <= LASTNUM; i++)
1884  {
1885  descr[i - 1].lexid = i;
1886  descr[i - 1].alias = pstrdup(tok_alias[i]);
1887  descr[i - 1].descr = pstrdup(lex_descr[i]);
1888  }
1889 
1890  descr[LASTNUM].lexid = 0;
1891 
1892  PG_RETURN_POINTER(descr);
1893 }
char * alias
Definition: ts_public.h:28
int lexid
Definition: ts_public.h:27
char * descr
Definition: ts_public.h:29
#define LASTNUM
Definition: wparser_def.c:60
static const char *const tok_alias[]
Definition: wparser_def.c:62
static const char *const lex_descr[]
Definition: wparser_def.c:89

References LexDescr::alias, LexDescr::descr, i, LASTNUM, lex_descr, LexDescr::lexid, palloc(), PG_RETURN_POINTER, pstrdup(), and tok_alias.

◆ prsd_nexttoken()

Datum prsd_nexttoken ( PG_FUNCTION_ARGS  )

Definition at line 1902 of file wparser_def.c.

1903 {
1904  TParser *p = (TParser *) PG_GETARG_POINTER(0);
1905  char **t = (char **) PG_GETARG_POINTER(1);
1906  int *tlen = (int *) PG_GETARG_POINTER(2);
1907 
1908  if (!TParserGet(p))
1909  PG_RETURN_INT32(0);
1910 
1911  *t = p->token;
1912  *tlen = p->lenbytetoken;
1913 
1914  PG_RETURN_INT32(p->type);
1915 }
#define PG_RETURN_INT32(x)
Definition: fmgr.h:354
char * token
Definition: wparser_def.c:260

References TParser::lenbytetoken, PG_GETARG_POINTER, PG_RETURN_INT32, TParser::token, TParserGet(), and TParser::type.

◆ prsd_start()

Datum prsd_start ( PG_FUNCTION_ARGS  )

Definition at line 1896 of file wparser_def.c.

1897 {
1899 }
#define PG_GETARG_INT32(n)
Definition: fmgr.h:269
static TParser * TParserInit(char *str, int len)
Definition: wparser_def.c:289

References PG_GETARG_INT32, PG_GETARG_POINTER, PG_RETURN_POINTER, and TParserInit().

◆ SpecialFURL()

static void SpecialFURL ( TParser prs)
static

◆ SpecialHyphen()

static void SpecialHyphen ( TParser prs)
static

◆ SpecialTags()

static void SpecialTags ( TParser prs)
static

Definition at line 564 of file wparser_def.c.

565 {
566  switch (prs->state->lenchartoken)
567  {
568  case 8: /* </script */
569  if (pg_strncasecmp(prs->token, "</script", 8) == 0)
570  prs->ignore = false;
571  break;
572  case 7: /* <script || </style */
573  if (pg_strncasecmp(prs->token, "</style", 7) == 0)
574  prs->ignore = false;
575  else if (pg_strncasecmp(prs->token, "<script", 7) == 0)
576  prs->ignore = true;
577  break;
578  case 6: /* <style */
579  if (pg_strncasecmp(prs->token, "<style", 6) == 0)
580  prs->ignore = true;
581  break;
582  default:
583  break;
584  }
585 }
int pg_strncasecmp(const char *s1, const char *s2, size_t n)
Definition: pgstrcasecmp.c:69

References TParser::ignore, TParserPosition::lenchartoken, pg_strncasecmp(), TParser::state, and TParser::token.

◆ SpecialVerVersion()

static void SpecialVerVersion ( TParser prs)
static

Definition at line 603 of file wparser_def.c.

604 {
605  prs->state->posbyte -= prs->state->lenbytetoken;
606  prs->state->poschar -= prs->state->lenchartoken;
607  prs->state->lenbytetoken = 0;
608  prs->state->lenchartoken = 0;
609 }

References TParserPosition::lenbytetoken, TParserPosition::lenchartoken, TParserPosition::posbyte, TParserPosition::poschar, and TParser::state.

◆ TParserClose()

static void TParserClose ( TParser prs)
static

Definition at line 372 of file wparser_def.c.

373 {
374  while (prs->state)
375  {
376  TParserPosition *ptr = prs->state->prev;
377 
378  pfree(prs->state);
379  prs->state = ptr;
380  }
381 
382  if (prs->wstr)
383  pfree(prs->wstr);
384  if (prs->pgwstr)
385  pfree(prs->pgwstr);
386 
387 #ifdef WPARSER_TRACE
388  fprintf(stderr, "closing parser\n");
389 #endif
390  pfree(prs);
391 }
#define fprintf
Definition: port.h:242
struct TParserPosition * prev
Definition: wparser_def.c:237

References fprintf, pfree(), TParser::pgwstr, TParserPosition::prev, TParser::state, and TParser::wstr.

Referenced by prsd_end().

◆ TParserCopyClose()

static void TParserCopyClose ( TParser prs)
static

Definition at line 397 of file wparser_def.c.

398 {
399  while (prs->state)
400  {
401  TParserPosition *ptr = prs->state->prev;
402 
403  pfree(prs->state);
404  prs->state = ptr;
405  }
406 
407 #ifdef WPARSER_TRACE
408  fprintf(stderr, "closing parser copy\n");
409 #endif
410  pfree(prs);
411 }

References fprintf, pfree(), TParserPosition::prev, and TParser::state.

Referenced by p_ishost(), and p_isURLPath().

◆ TParserCopyInit()

static TParser* TParserCopyInit ( const TParser orig)
static

Definition at line 346 of file wparser_def.c.

347 {
348  TParser *prs = (TParser *) palloc0(sizeof(TParser));
349 
350  prs->charmaxlen = orig->charmaxlen;
351  prs->str = orig->str + orig->state->posbyte;
352  prs->lenstr = orig->lenstr - orig->state->posbyte;
353  prs->usewide = orig->usewide;
354 
355  if (orig->pgwstr)
356  prs->pgwstr = orig->pgwstr + orig->state->poschar;
357  if (orig->wstr)
358  prs->wstr = orig->wstr + orig->state->poschar;
359 
360  prs->state = newTParserPosition(NULL);
361  prs->state->state = TPS_Base;
362 
363 #ifdef WPARSER_TRACE
364  fprintf(stderr, "parsing copy of \"%.*s\"\n", prs->lenstr, prs->str);
365 #endif
366 
367  return prs;
368 }
void * palloc0(Size size)
Definition: mcxt.c:1346
int charmaxlen
Definition: wparser_def.c:251

References TParser::charmaxlen, fprintf, TParser::lenstr, newTParserPosition(), palloc0(), TParser::pgwstr, TParserPosition::posbyte, TParserPosition::poschar, TParserPosition::state, TParser::state, TParser::str, TPS_Base, TParser::usewide, and TParser::wstr.

Referenced by p_ishost(), and p_isURLPath().

◆ TParserGet()

static bool TParserGet ( TParser prs)
static

Definition at line 1710 of file wparser_def.c.

1711 {
1712  const TParserStateActionItem *item = NULL;
1713 
1715 
1716  Assert(prs->state);
1717 
1718  if (prs->state->posbyte >= prs->lenstr)
1719  return false;
1720 
1721  prs->token = prs->str + prs->state->posbyte;
1722  prs->state->pushedAtAction = NULL;
1723 
1724  /* look at string */
1725  while (prs->state->posbyte <= prs->lenstr)
1726  {
1727  if (prs->state->posbyte == prs->lenstr)
1728  prs->state->charlen = 0;
1729  else
1730  prs->state->charlen = (prs->charmaxlen == 1) ? prs->charmaxlen :
1731  pg_mblen(prs->str + prs->state->posbyte);
1732 
1733  Assert(prs->state->posbyte + prs->state->charlen <= prs->lenstr);
1734  Assert(prs->state->state >= TPS_Base && prs->state->state < TPS_Null);
1735  Assert(Actions[prs->state->state].state == prs->state->state);
1736 
1737  if (prs->state->pushedAtAction)
1738  {
1739  /* After a POP, pick up at the next test */
1740  item = prs->state->pushedAtAction + 1;
1741  prs->state->pushedAtAction = NULL;
1742  }
1743  else
1744  {
1745  item = Actions[prs->state->state].action;
1746  Assert(item != NULL);
1747  }
1748 
1749  /* find action by character class */
1750  while (item->isclass)
1751  {
1752  prs->c = item->c;
1753  if (item->isclass(prs) != 0)
1754  break;
1755  item++;
1756  }
1757 
1758 #ifdef WPARSER_TRACE
1759  {
1760  TParserPosition *ptr;
1761 
1762  fprintf(stderr, "state ");
1763  /* indent according to stack depth */
1764  for (ptr = prs->state->prev; ptr; ptr = ptr->prev)
1765  fprintf(stderr, " ");
1766  fprintf(stderr, "%s ", Actions[prs->state->state].state_name);
1767  if (prs->state->posbyte < prs->lenstr)
1768  fprintf(stderr, "at %c", *(prs->str + prs->state->posbyte));
1769  else
1770  fprintf(stderr, "at EOF");
1771  fprintf(stderr, " matched rule %d flags%s%s%s%s%s%s%s%s%s%s%s\n",
1772  (int) (item - Actions[prs->state->state].action),
1773  (item->flags & A_BINGO) ? " BINGO" : "",
1774  (item->flags & A_POP) ? " POP" : "",
1775  (item->flags & A_PUSH) ? " PUSH" : "",
1776  (item->flags & A_RERUN) ? " RERUN" : "",
1777  (item->flags & A_CLEAR) ? " CLEAR" : "",
1778  (item->flags & A_MERGE) ? " MERGE" : "",
1779  (item->flags & A_CLRALL) ? " CLRALL" : "",
1780  (item->tostate != TPS_Null) ? " tostate " : "",
1781  (item->tostate != TPS_Null) ? Actions[item->tostate].state_name : "",
1782  (item->type > 0) ? " type " : "",
1783  tok_alias[item->type]);
1784  }
1785 #endif
1786 
1787  /* call special handler if exists */
1788  if (item->special)
1789  item->special(prs);
1790 
1791  /* BINGO, token is found */
1792  if (item->flags & A_BINGO)
1793  {
1794  Assert(item->type > 0);
1795  prs->lenbytetoken = prs->state->lenbytetoken;
1796  prs->lenchartoken = prs->state->lenchartoken;
1797  prs->state->lenbytetoken = prs->state->lenchartoken = 0;
1798  prs->type = item->type;
1799  }
1800 
1801  /* do various actions by flags */
1802  if (item->flags & A_POP)
1803  { /* pop stored state in stack */
1804  TParserPosition *ptr = prs->state->prev;
1805 
1806  pfree(prs->state);
1807  prs->state = ptr;
1808  Assert(prs->state);
1809  }
1810  else if (item->flags & A_PUSH)
1811  { /* push (store) state in stack */
1812  prs->state->pushedAtAction = item; /* remember where we push */
1813  prs->state = newTParserPosition(prs->state);
1814  }
1815  else if (item->flags & A_CLEAR)
1816  { /* clear previous pushed state */
1817  TParserPosition *ptr;
1818 
1819  Assert(prs->state->prev);
1820  ptr = prs->state->prev->prev;
1821  pfree(prs->state->prev);
1822  prs->state->prev = ptr;
1823  }
1824  else if (item->flags & A_CLRALL)
1825  { /* clear all previous pushed state */
1826  TParserPosition *ptr;
1827 
1828  while (prs->state->prev)
1829  {
1830  ptr = prs->state->prev->prev;
1831  pfree(prs->state->prev);
1832  prs->state->prev = ptr;
1833  }
1834  }
1835  else if (item->flags & A_MERGE)
1836  { /* merge posinfo with current and pushed state */
1837  TParserPosition *ptr = prs->state;
1838 
1839  Assert(prs->state->prev);
1840  prs->state = prs->state->prev;
1841 
1842  prs->state->posbyte = ptr->posbyte;
1843  prs->state->poschar = ptr->poschar;
1844  prs->state->charlen = ptr->charlen;
1845  prs->state->lenbytetoken = ptr->lenbytetoken;
1846  prs->state->lenchartoken = ptr->lenchartoken;
1847  pfree(ptr);
1848  }
1849 
1850  /* set new state if pointed */
1851  if (item->tostate != TPS_Null)
1852  prs->state->state = item->tostate;
1853 
1854  /* check for go away */
1855  if ((item->flags & A_BINGO) ||
1856  (prs->state->posbyte >= prs->lenstr &&
1857  (item->flags & A_RERUN) == 0))
1858  break;
1859 
1860  /* go to beginning of loop if we should rerun or we just restore state */
1861  if (item->flags & (A_RERUN | A_POP))
1862  continue;
1863 
1864  /* move forward */
1865  if (prs->state->charlen)
1866  {
1867  prs->state->posbyte += prs->state->charlen;
1868  prs->state->lenbytetoken += prs->state->charlen;
1869  prs->state->poschar++;
1870  prs->state->lenchartoken++;
1871  }
1872  }
1873 
1874  return (item && (item->flags & A_BINGO));
1875 }
int pg_mblen(const char *mbstr)
Definition: mbutils.c:1023
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:122
const TParserStateActionItem * pushedAtAction
Definition: wparser_def.c:238
TParserCharTest isclass
Definition: wparser_def.c:211
TParserState tostate
Definition: wparser_def.c:214
TParserSpecial special
Definition: wparser_def.c:216
const TParserStateActionItem * action
Definition: wparser_def.c:1609
TParserState state
Definition: wparser_def.c:1610
#define A_POP
Definition: wparser_def.c:222
#define A_RERUN
Definition: wparser_def.c:224
static const TParserStateAction Actions[]
Definition: wparser_def.c:1628
#define A_MERGE
Definition: wparser_def.c:226
#define A_BINGO
Definition: wparser_def.c:221
#define A_CLRALL
Definition: wparser_def.c:227
#define A_CLEAR
Definition: wparser_def.c:225
#define A_PUSH
Definition: wparser_def.c:223

References A_BINGO, A_CLEAR, A_CLRALL, A_MERGE, A_POP, A_PUSH, A_RERUN, TParserStateAction::action, Actions, Assert, TParserStateActionItem::c, TParser::c, TParserPosition::charlen, TParser::charmaxlen, CHECK_FOR_INTERRUPTS, TParserStateActionItem::flags, fprintf, TParserStateActionItem::isclass, TParserPosition::lenbytetoken, TParser::lenbytetoken, TParserPosition::lenchartoken, TParser::lenchartoken, TParser::lenstr, newTParserPosition(), pfree(), pg_mblen(), TParserPosition::posbyte, TParserPosition::poschar, TParserPosition::prev, TParserPosition::pushedAtAction, TParserStateActionItem::special, TParserPosition::state, TParser::state, TParserStateAction::state, TParser::str, tok_alias, TParser::token, TParserStateActionItem::tostate, TPS_Base, TPS_Null, TParserStateActionItem::type, and TParser::type.

Referenced by p_ishost(), p_isURLPath(), and prsd_nexttoken().

◆ TParserInit()

static TParser* TParserInit ( char *  str,
int  len 
)
static

Definition at line 289 of file wparser_def.c.

290 {
291  TParser *prs = (TParser *) palloc0(sizeof(TParser));
292 
294  prs->str = str;
295  prs->lenstr = len;
296 
297  /*
298  * Use wide char code only when max encoding length > 1.
299  */
300  if (prs->charmaxlen > 1)
301  {
302  pg_locale_t mylocale = 0; /* TODO */
303 
304  prs->usewide = true;
306  {
307  /*
308  * char2wchar doesn't work for C-locale and sizeof(pg_wchar) could
309  * be different from sizeof(wchar_t)
310  */
311  prs->pgwstr = (pg_wchar *) palloc(sizeof(pg_wchar) * (prs->lenstr + 1));
312  pg_mb2wchar_with_len(prs->str, prs->pgwstr, prs->lenstr);
313  }
314  else
315  {
316  prs->wstr = (wchar_t *) palloc(sizeof(wchar_t) * (prs->lenstr + 1));
317  char2wchar(prs->wstr, prs->lenstr + 1, prs->str, prs->lenstr,
318  mylocale);
319  }
320  }
321  else
322  prs->usewide = false;
323 
324  prs->state = newTParserPosition(NULL);
325  prs->state->state = TPS_Base;
326 
327 #ifdef WPARSER_TRACE
328  fprintf(stderr, "parsing \"%.*s\"\n", len, str);
329 #endif
330 
331  return prs;
332 }
const char * str
int pg_database_encoding_max_length(void)
Definition: mbutils.c:1546
int pg_mb2wchar_with_len(const char *from, pg_wchar *to, int len)
Definition: mbutils.c:986
const void size_t len
bool database_ctype_is_c
Definition: pg_locale.c:117
size_t char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen, pg_locale_t locale)
Definition: pg_locale.c:3121

References char2wchar(), TParser::charmaxlen, database_ctype_is_c, fprintf, len, TParser::lenstr, newTParserPosition(), palloc(), palloc0(), pg_database_encoding_max_length(), pg_mb2wchar_with_len(), TParser::pgwstr, TParserPosition::state, TParser::state, TParser::str, str, TPS_Base, TParser::usewide, and TParser::wstr.

Referenced by prsd_start().

Variable Documentation

◆ Actions

const TParserStateAction Actions[]
static

Definition at line 1628 of file wparser_def.c.

Referenced by TParserGet().

◆ actionTPS_Base

const TParserStateActionItem actionTPS_Base[]
static
Initial value:
= {
{p_isEOF, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '<', A_PUSH, TPS_InTagFirst, 0, NULL},
{p_isignore, 0, A_NEXT, TPS_InSpace, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InWord, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InUnsignedInt, 0, NULL},
{p_iseqC, '-', A_PUSH, TPS_InSignedIntFirst, 0, NULL},
{p_iseqC, '+', A_PUSH, TPS_InSignedIntFirst, 0, NULL},
{p_iseqC, '&', A_PUSH, TPS_InXMLEntityFirst, 0, NULL},
{p_iseqC, '~', A_PUSH, TPS_InFileTwiddle, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InPathFirstFirst, 0, NULL},
{NULL, 0, A_NEXT, TPS_InSpace, 0, NULL}
}
static int p_isasclet(TParser *prs)
Definition: wparser_def.c:499
static int p_isignore(TParser *prs)
Definition: wparser_def.c:623
#define A_NEXT
Definition: wparser_def.c:220

Definition at line 971 of file wparser_def.c.

◆ actionTPS_InAsciiWord

const TParserStateActionItem actionTPS_InAsciiWord[]
static
Initial value:
= {
{p_isasclet, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InFileNext, 0, NULL},
{p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '_', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
{p_iseqC, ':', A_PUSH, TPS_InProtocolFirst, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
{p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InNumWord, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InWord, 0, NULL},
{p_isspecial, 0, A_NEXT, TPS_InWord, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, ASCIIWORD, NULL}
}
#define ASCIIWORD
Definition: wparser_def.c:36
static int p_isspecial(TParser *prs)
Definition: wparser_def.c:692

Definition at line 999 of file wparser_def.c.

◆ actionTPS_InCloseCommentFirst

const TParserStateActionItem actionTPS_InCloseCommentFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{NULL, 0, A_NEXT, TPS_InComment, 0, NULL}
}

Definition at line 1309 of file wparser_def.c.

◆ actionTPS_InCloseCommentLast

const TParserStateActionItem actionTPS_InCloseCommentLast[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '>', A_NEXT, TPS_InCommentEnd, 0, NULL},
{NULL, 0, A_NEXT, TPS_InComment, 0, NULL}
}

Definition at line 1315 of file wparser_def.c.

◆ actionTPS_InComment

const TParserStateActionItem actionTPS_InComment[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{NULL, 0, A_NEXT, TPS_Null, 0, NULL}
}

Definition at line 1303 of file wparser_def.c.

◆ actionTPS_InCommentEnd

const TParserStateActionItem actionTPS_InCommentEnd[]
static
Initial value:
= {
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, TAG_T, NULL}
}
#define TAG_T
Definition: wparser_def.c:48

Definition at line 1322 of file wparser_def.c.

◆ actionTPS_InCommentFirst

const TParserStateActionItem actionTPS_InCommentFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_InCommentLast, 0, NULL},
{p_iseqC, 'D', A_NEXT, TPS_InTag, 0, NULL},
{p_iseqC, 'd', A_NEXT, TPS_InTag, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1288 of file wparser_def.c.

◆ actionTPS_InCommentLast

const TParserStateActionItem actionTPS_InCommentLast[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_InComment, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1297 of file wparser_def.c.

◆ actionTPS_InDecimal

const TParserStateActionItem actionTPS_InDecimal[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_InDecimal, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InVerVersion, 0, NULL},
{p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, DECIMAL_T, NULL}
}
#define DECIMAL_T
Definition: wparser_def.c:55

Definition at line 1091 of file wparser_def.c.

◆ actionTPS_InDecimalFirst

const TParserStateActionItem actionTPS_InDecimalFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_CLEAR, TPS_InDecimal, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1085 of file wparser_def.c.

◆ actionTPS_InEmail

const TParserStateActionItem actionTPS_InEmail[]
static
Initial value:
= {
{p_isstophost, 0, A_POP, TPS_Null, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}
#define EMAIL
Definition: wparser_def.c:39
static int p_isstophost(TParser *prs)
Definition: wparser_def.c:612
static int p_ishost(TParser *prs)
Definition: wparser_def.c:629

Definition at line 1391 of file wparser_def.c.

◆ actionTPS_InFile

const TParserStateActionItem actionTPS_InFile[]
static
Initial value:
= {
{p_isasclet, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InFileNext, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, FILEPATH, NULL}
}
#define FILEPATH
Definition: wparser_def.c:54

Definition at line 1441 of file wparser_def.c.

◆ actionTPS_InFileFirst

const TParserStateActionItem actionTPS_InFileFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '.', A_NEXT, TPS_InPathFirst, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '~', A_PUSH, TPS_InFileTwiddle, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1397 of file wparser_def.c.

◆ actionTPS_InFileNext

const TParserStateActionItem actionTPS_InFileNext[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isasclet, 0, A_CLEAR, TPS_InFile, 0, NULL},
{p_isdigit, 0, A_CLEAR, TPS_InFile, 0, NULL},
{p_iseqC, '_', A_CLEAR, TPS_InFile, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1452 of file wparser_def.c.

◆ actionTPS_InFileTwiddle

const TParserStateActionItem actionTPS_InFileTwiddle[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_InFileFirst, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1407 of file wparser_def.c.

◆ actionTPS_InFURL

const TParserStateActionItem actionTPS_InFURL[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}
static void SpecialFURL(TParser *prs)
Definition: wparser_def.c:588
static int p_isURLPath(TParser *prs)
Definition: wparser_def.c:657
#define URL_T
Definition: wparser_def.c:40

Definition at line 1476 of file wparser_def.c.

◆ actionTPS_InHost

const TParserStateActionItem actionTPS_InHost[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_InHost, 0, NULL},
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
{p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '_', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1380 of file wparser_def.c.

◆ actionTPS_InHostDomain

const TParserStateActionItem actionTPS_InHostDomain[]
static
Initial value:
= {
{p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
{p_iseqC, ':', A_PUSH, TPS_InPortFirst, 0, NULL},
{p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '_', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
{p_isdigit, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL}
}

Definition at line 1344 of file wparser_def.c.

◆ actionTPS_InHostDomainSecond

const TParserStateActionItem actionTPS_InHostDomainSecond[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_PUSH, TPS_InHost, 0, NULL},
{p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '_', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1333 of file wparser_def.c.

◆ actionTPS_InHostFirstAN

const TParserStateActionItem actionTPS_InHostFirstAN[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_InHost, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1373 of file wparser_def.c.

◆ actionTPS_InHostFirstDomain

const TParserStateActionItem actionTPS_InHostFirstDomain[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHost, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1326 of file wparser_def.c.

◆ actionTPS_InHyphenAsciiWord

const TParserStateActionItem actionTPS_InHyphenAsciiWord[]
static
Initial value:
= {
{p_isalpha, 0, A_NEXT, TPS_InHyphenWord, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenNumWord, 0, NULL},
}
static void SpecialHyphen(TParser *prs)
Definition: wparser_def.c:596
#define ASCIIHWORD
Definition: wparser_def.c:51

Definition at line 1506 of file wparser_def.c.

◆ actionTPS_InHyphenAsciiWordFirst

const TParserStateActionItem actionTPS_InHyphenAsciiWordFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InHyphenWord, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenDigitLookahead, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1498 of file wparser_def.c.

◆ actionTPS_InHyphenAsciiWordPart

const TParserStateActionItem actionTPS_InHyphenAsciiWordPart[]
static
Initial value:
= {
{p_isalpha, 0, A_NEXT, TPS_InHyphenWordPart, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenNumWordPart, 0, NULL},
}
#define ASCIIPARTHWORD
Definition: wparser_def.c:46

Definition at line 1579 of file wparser_def.c.

◆ actionTPS_InHyphenDigitLookahead

const TParserStateActionItem actionTPS_InHyphenDigitLookahead[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenDigitLookahead, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InHyphenNumWord, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1547 of file wparser_def.c.

◆ actionTPS_InHyphenNumWord

const TParserStateActionItem actionTPS_InHyphenNumWord[]
static
Initial value:

Definition at line 1539 of file wparser_def.c.

◆ actionTPS_InHyphenNumWordFirst

const TParserStateActionItem actionTPS_InHyphenNumWordFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InHyphenNumWord, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenDigitLookahead, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1532 of file wparser_def.c.

◆ actionTPS_InHyphenNumWordPart

const TParserStateActionItem actionTPS_InHyphenNumWordPart[]
static
Initial value:
= {
{p_isalnum, 0, A_NEXT, TPS_InHyphenNumWordPart, 0, NULL},
}
#define NUMPARTHWORD
Definition: wparser_def.c:44

Definition at line 1588 of file wparser_def.c.

◆ actionTPS_InHyphenUnsignedInt

const TParserStateActionItem actionTPS_InHyphenUnsignedInt[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
{p_isalpha, 0, A_CLEAR, TPS_InHyphenNumWordPart, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1595 of file wparser_def.c.

◆ actionTPS_InHyphenWord

const TParserStateActionItem actionTPS_InHyphenWord[]
static
Initial value:
= {
{p_isalpha, 0, A_NEXT, TPS_InHyphenWord, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenNumWord, 0, NULL},
}
#define HWORD
Definition: wparser_def.c:52

Definition at line 1523 of file wparser_def.c.

◆ actionTPS_InHyphenWordFirst

const TParserStateActionItem actionTPS_InHyphenWordFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InHyphenWord, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenDigitLookahead, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1516 of file wparser_def.c.

◆ actionTPS_InHyphenWordPart

const TParserStateActionItem actionTPS_InHyphenWordPart[]
static
Initial value:
= {
{p_isalpha, 0, A_NEXT, TPS_InHyphenWordPart, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InHyphenNumWordPart, 0, NULL},
{NULL, 0, A_BINGO, TPS_InParseHyphen, PARTHWORD, NULL}
}
#define PARTHWORD
Definition: wparser_def.c:45

Definition at line 1571 of file wparser_def.c.

◆ actionTPS_InMantissa

const TParserStateActionItem actionTPS_InMantissa[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_InMantissa, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, SCIENTIFIC, NULL}
}
#define SCIENTIFIC
Definition: wparser_def.c:42

Definition at line 1140 of file wparser_def.c.

◆ actionTPS_InMantissaFirst

const TParserStateActionItem actionTPS_InMantissaFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_CLEAR, TPS_InMantissa, 0, NULL},
{p_iseqC, '+', A_NEXT, TPS_InMantissaSign, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_InMantissaSign, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1126 of file wparser_def.c.

◆ actionTPS_InMantissaSign

const TParserStateActionItem actionTPS_InMantissaSign[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_CLEAR, TPS_InMantissa, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1134 of file wparser_def.c.

◆ actionTPS_InNumWord

const TParserStateActionItem actionTPS_InNumWord[]
static
Initial value:
= {
{p_isalnum, 0, A_NEXT, TPS_InNumWord, 0, NULL},
{p_isspecial, 0, A_NEXT, TPS_InNumWord, 0, NULL},
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InFileNext, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, NUMWORD, NULL}
}
#define NUMWORD
Definition: wparser_def.c:38

Definition at line 988 of file wparser_def.c.

◆ actionTPS_InParseHyphen

const TParserStateActionItem actionTPS_InParseHyphen[]
static
Initial value:
= {
{p_isEOF, 0, A_RERUN, TPS_Base, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InHyphenWordPart, 0, NULL},
{p_isdigit, 0, A_PUSH, TPS_InHyphenUnsignedInt, 0, NULL},
{NULL, 0, A_RERUN, TPS_Base, 0, NULL}
}

Definition at line 1555 of file wparser_def.c.

◆ actionTPS_InParseHyphenHyphen

const TParserStateActionItem actionTPS_InParseHyphenHyphen[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isalnum, 0, A_BINGO | A_CLEAR, TPS_InParseHyphen, SPACE, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}
#define SPACE
Definition: wparser_def.c:47

Definition at line 1564 of file wparser_def.c.

◆ actionTPS_InPathFirst

const TParserStateActionItem actionTPS_InPathFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_InFile, 0, NULL},
{p_iseqC, '.', A_NEXT, TPS_InPathSecond, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_InFileFirst, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1416 of file wparser_def.c.

◆ actionTPS_InPathFirstFirst

const TParserStateActionItem actionTPS_InPathFirstFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '.', A_NEXT, TPS_InPathSecond, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_InFileFirst, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1426 of file wparser_def.c.

◆ actionTPS_InPathSecond

const TParserStateActionItem actionTPS_InPathSecond[]
static
Initial value:
= {
{p_iseqC, '/', A_NEXT | A_PUSH, TPS_InFileFirst, 0, NULL},
{p_isspace, 0, A_BINGO | A_CLEAR, TPS_Base, FILEPATH, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1433 of file wparser_def.c.

◆ actionTPS_InPort

const TParserStateActionItem actionTPS_InPort[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFURL, 0, NULL},
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, HOST, NULL}
}

Definition at line 1365 of file wparser_def.c.

◆ actionTPS_InPortFirst

const TParserStateActionItem actionTPS_InPortFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InPort, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1359 of file wparser_def.c.

◆ actionTPS_InProtocolEnd

const TParserStateActionItem actionTPS_InProtocolEnd[]
static
Initial value:
= {
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, PROTOCOL, NULL}
}
#define PROTOCOL
Definition: wparser_def.c:49

Definition at line 1494 of file wparser_def.c.

◆ actionTPS_InProtocolFirst

const TParserStateActionItem actionTPS_InProtocolFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_InProtocolSecond, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1482 of file wparser_def.c.

◆ actionTPS_InProtocolSecond

const TParserStateActionItem actionTPS_InProtocolSecond[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_InProtocolEnd, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1488 of file wparser_def.c.

◆ actionTPS_InSignedInt

const TParserStateActionItem actionTPS_InSignedInt[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InDecimalFirst, 0, NULL},
{p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, SIGNEDINT, NULL}
}
#define SIGNEDINT
Definition: wparser_def.c:56

Definition at line 1049 of file wparser_def.c.

◆ actionTPS_InSignedIntFirst

const TParserStateActionItem actionTPS_InSignedIntFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT | A_CLEAR, TPS_InSignedInt, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1043 of file wparser_def.c.

◆ actionTPS_InSpace

const TParserStateActionItem actionTPS_InSpace[]
static
Initial value:
= {
{p_isEOF, 0, A_BINGO, TPS_Base, SPACE, NULL},
{p_iseqC, '<', A_BINGO, TPS_Base, SPACE, NULL},
{p_isignore, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '-', A_BINGO, TPS_Base, SPACE, NULL},
{p_iseqC, '+', A_BINGO, TPS_Base, SPACE, NULL},
{p_iseqC, '&', A_BINGO, TPS_Base, SPACE, NULL},
{p_iseqC, '/', A_BINGO, TPS_Base, SPACE, NULL},
{p_isnotalnum, 0, A_NEXT, TPS_InSpace, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, SPACE, NULL}
}

Definition at line 1058 of file wparser_def.c.

◆ actionTPS_InSVerVersion

const TParserStateActionItem actionTPS_InSVerVersion[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_BINGO | A_CLRALL, TPS_InUnsignedInt, SPACE, NULL},
{NULL, 0, A_NEXT, TPS_Null, 0, NULL}
}

Definition at line 1106 of file wparser_def.c.

◆ actionTPS_InTag

const TParserStateActionItem actionTPS_InTag[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '\'', A_NEXT, TPS_InTagEscapeK, 0, NULL},
{p_iseqC, '"', A_NEXT, TPS_InTagEscapeKK, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '=', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '#', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, ':', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '.', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '&', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '?', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '%', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '~', A_NEXT, TPS_Null, 0, NULL},
{p_isspace, 0, A_NEXT, TPS_Null, 0, SpecialTags},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}
static void SpecialTags(TParser *prs)
Definition: wparser_def.c:564

Definition at line 1243 of file wparser_def.c.

◆ actionTPS_InTagBackSleshed

const TParserStateActionItem actionTPS_InTagBackSleshed[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{NULL, 0, A_MERGE, TPS_Null, 0, NULL}
}

Definition at line 1279 of file wparser_def.c.

◆ actionTPS_InTagBeginEnd

const TParserStateActionItem actionTPS_InTagBeginEnd[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '>', A_NEXT, TPS_InTagEnd, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1237 of file wparser_def.c.

◆ actionTPS_InTagCloseFirst

const TParserStateActionItem actionTPS_InTagCloseFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isasclet, 0, A_NEXT, TPS_InTagName, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1217 of file wparser_def.c.

◆ actionTPS_InTagEnd

const TParserStateActionItem actionTPS_InTagEnd[]
static
Initial value:
= {
{NULL, 0, A_BINGO | A_CLRALL, TPS_Base, TAG_T, NULL}
}

Definition at line 1284 of file wparser_def.c.

◆ actionTPS_InTagEscapeK

const TParserStateActionItem actionTPS_InTagEscapeK[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '\\', A_PUSH, TPS_InTagBackSleshed, 0, NULL},
{p_iseqC, '\'', A_NEXT, TPS_InTag, 0, NULL},
{NULL, 0, A_NEXT, TPS_InTagEscapeK, 0, NULL}
}

Definition at line 1265 of file wparser_def.c.

◆ actionTPS_InTagEscapeKK

const TParserStateActionItem actionTPS_InTagEscapeKK[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '\\', A_PUSH, TPS_InTagBackSleshed, 0, NULL},
{p_iseqC, '"', A_NEXT, TPS_InTag, 0, NULL},
{NULL, 0, A_NEXT, TPS_InTagEscapeKK, 0, NULL}
}

Definition at line 1272 of file wparser_def.c.

◆ actionTPS_InTagFirst

const TParserStateActionItem actionTPS_InTagFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InTagCloseFirst, 0, NULL},
{p_iseqC, '!', A_PUSH, TPS_InCommentFirst, 0, NULL},
{p_iseqC, '?', A_PUSH, TPS_InXMLBegin, 0, NULL},
{p_isasclet, 0, A_PUSH, TPS_InTagName, 0, NULL},
{p_iseqC, ':', A_PUSH, TPS_InTagName, 0, NULL},
{p_iseqC, '_', A_PUSH, TPS_InTagName, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1198 of file wparser_def.c.

◆ actionTPS_InTagName

const TParserStateActionItem actionTPS_InTagName[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, '/', A_NEXT, TPS_InTagBeginEnd, 0, NULL},
{p_isspace, 0, A_NEXT, TPS_InTag, 0, SpecialTags},
{p_isalnum, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, ':', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '.', A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_Null, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1223 of file wparser_def.c.

◆ actionTPS_InUDecimal

const TParserStateActionItem actionTPS_InUDecimal[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_InUDecimal, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InVersionFirst, 0, NULL},
{p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, DECIMAL_T, NULL}
}

Definition at line 1076 of file wparser_def.c.

◆ actionTPS_InUDecimalFirst

const TParserStateActionItem actionTPS_InUDecimalFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_CLEAR, TPS_InUDecimal, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1070 of file wparser_def.c.

◆ actionTPS_InUnsignedInt

const TParserStateActionItem actionTPS_InUnsignedInt[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_Null, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InUDecimalFirst, 0, NULL},
{p_iseqC, 'e', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{p_iseqC, 'E', A_PUSH, TPS_InMantissaFirst, 0, NULL},
{p_iseqC, '-', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '_', A_PUSH, TPS_InHostFirstAN, 0, NULL},
{p_iseqC, '@', A_PUSH, TPS_InEmail, 0, NULL},
{p_isasclet, 0, A_PUSH, TPS_InHost, 0, NULL},
{p_isalpha, 0, A_NEXT, TPS_InNumWord, 0, NULL},
{p_isspecial, 0, A_NEXT, TPS_InNumWord, 0, NULL},
{p_iseqC, '/', A_PUSH, TPS_InFileFirst, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, UNSIGNEDINT, NULL}
}
#define UNSIGNEDINT
Definition: wparser_def.c:57

Definition at line 1026 of file wparser_def.c.

◆ actionTPS_InURLPath

const TParserStateActionItem actionTPS_InURLPath[]
static
Initial value:
= {
{p_isurlchar, 0, A_NEXT, TPS_InURLPath, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, URLPATH, NULL}
}
static int p_isurlchar(TParser *prs)
Definition: wparser_def.c:505

Definition at line 1470 of file wparser_def.c.

◆ actionTPS_InURLPathFirst

const TParserStateActionItem actionTPS_InURLPathFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isurlchar, 0, A_NEXT, TPS_InURLPath, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL},
}

Definition at line 1460 of file wparser_def.c.

◆ actionTPS_InURLPathStart

const TParserStateActionItem actionTPS_InURLPathStart[]
static
Initial value:
= {
{NULL, 0, A_NEXT, TPS_InURLPath, 0, NULL}
}

Definition at line 1466 of file wparser_def.c.

◆ actionTPS_InVersion

const TParserStateActionItem actionTPS_InVersion[]
static
Initial value:
= {
{p_isdigit, 0, A_NEXT, TPS_InVersion, 0, NULL},
{p_iseqC, '.', A_PUSH, TPS_InVersionFirst, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, VERSIONNUMBER, NULL}
}
#define VERSIONNUMBER
Definition: wparser_def.c:43

Definition at line 1119 of file wparser_def.c.

◆ actionTPS_InVersionFirst

const TParserStateActionItem actionTPS_InVersionFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_CLEAR, TPS_InVersion, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1113 of file wparser_def.c.

◆ actionTPS_InVerVersion

const TParserStateActionItem actionTPS_InVerVersion[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}
static void SpecialVerVersion(TParser *prs)
Definition: wparser_def.c:603

Definition at line 1100 of file wparser_def.c.

◆ actionTPS_InWord

const TParserStateActionItem actionTPS_InWord[]
static
Initial value:
= {
{p_isEOF, 0, A_BINGO, TPS_Base, WORD_T, NULL},
{p_isalpha, 0, A_NEXT, TPS_Null, 0, NULL},
{p_isspecial, 0, A_NEXT, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InNumWord, 0, NULL},
{NULL, 0, A_BINGO, TPS_Base, WORD_T, NULL}
}
#define WORD_T
Definition: wparser_def.c:37

Definition at line 1017 of file wparser_def.c.

◆ actionTPS_InXMLBegin

const TParserStateActionItem actionTPS_InXMLBegin[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, 'x', A_NEXT, TPS_InTag, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1209 of file wparser_def.c.

◆ actionTPS_InXMLEntity

const TParserStateActionItem actionTPS_InXMLEntity[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isalnum, 0, A_NEXT, TPS_InXMLEntity, 0, NULL},
{p_iseqC, ':', A_NEXT, TPS_InXMLEntity, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_InXMLEntity, 0, NULL},
{p_iseqC, '.', A_NEXT, TPS_InXMLEntity, 0, NULL},
{p_iseqC, '-', A_NEXT, TPS_InXMLEntity, 0, NULL},
{p_iseqC, ';', A_NEXT, TPS_InXMLEntityEnd, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1155 of file wparser_def.c.

◆ actionTPS_InXMLEntityEnd

const TParserStateActionItem actionTPS_InXMLEntityEnd[]
static
Initial value:
= {
{NULL, 0, A_BINGO | A_CLEAR, TPS_Base, XMLENTITY, NULL}
}
#define XMLENTITY
Definition: wparser_def.c:58

Definition at line 1194 of file wparser_def.c.

◆ actionTPS_InXMLEntityFirst

const TParserStateActionItem actionTPS_InXMLEntityFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_iseqC, ':', A_NEXT, TPS_InXMLEntity, 0, NULL},
{p_iseqC, '_', A_NEXT, TPS_InXMLEntity, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1146 of file wparser_def.c.

◆ actionTPS_InXMLEntityHexNum

const TParserStateActionItem actionTPS_InXMLEntityHexNum[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isxdigit, 0, A_NEXT, TPS_InXMLEntityHexNum, 0, NULL},
{p_iseqC, ';', A_NEXT, TPS_InXMLEntityEnd, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1187 of file wparser_def.c.

◆ actionTPS_InXMLEntityHexNumFirst

const TParserStateActionItem actionTPS_InXMLEntityHexNumFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isxdigit, 0, A_NEXT, TPS_InXMLEntityHexNum, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1174 of file wparser_def.c.

◆ actionTPS_InXMLEntityNum

const TParserStateActionItem actionTPS_InXMLEntityNum[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InXMLEntityNum, 0, NULL},
{p_iseqC, ';', A_NEXT, TPS_InXMLEntityEnd, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1180 of file wparser_def.c.

◆ actionTPS_InXMLEntityNumFirst

const TParserStateActionItem actionTPS_InXMLEntityNumFirst[]
static
Initial value:
= {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
{p_isdigit, 0, A_NEXT, TPS_InXMLEntityNum, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
}

Definition at line 1166 of file wparser_def.c.

◆ lex_descr

const char* const lex_descr[]
static
Initial value:
= {
"",
"Word, all ASCII",
"Word, all letters",
"Word, letters and digits",
"Email address",
"URL",
"Host",
"Scientific notation",
"Version number",
"Hyphenated word part, letters and digits",
"Hyphenated word part, all letters",
"Hyphenated word part, all ASCII",
"Space symbols",
"XML tag",
"Protocol head",
"Hyphenated word, letters and digits",
"Hyphenated word, all ASCII",
"Hyphenated word, all letters",
"URL path",
"File or path name",
"Decimal notation",
"Signed integer",
"Unsigned integer",
"XML entity"
}

Definition at line 89 of file wparser_def.c.

Referenced by prsd_lextype().

◆ tok_alias

const char* const tok_alias[]
static
Initial value:
= {
"",
"asciiword",
"word",
"numword",
"email",
"url",
"host",
"sfloat",
"version",
"hword_numpart",
"hword_part",
"hword_asciipart",
"blank",
"tag",
"protocol",
"numhword",
"asciihword",
"hword",
"url_path",
"file",
"float",
"int",
"uint",
"entity"
}

Definition at line 62 of file wparser_def.c.

Referenced by prsd_lextype(), and TParserGet().