Skip to content

Commit faacdab

Browse files
committed
Improve tag recognizing
1 parent cefcbbf commit faacdab

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

contrib/tsearch2/wordparser/parser.c

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ static TParserStateActionItem actionTPS_InTagFirst[] = {
527527
{p_iseqC, '/', A_PUSH, TPS_InTagCloseFirst, 0, NULL},
528528
{p_iseqC, '!', A_PUSH, TPS_InCommentFirst, 0, NULL},
529529
{p_iseqC, '?', A_PUSH, TPS_InXMLBegin, 0, NULL},
530-
{p_islatin, 0, A_PUSH, TPS_InTag, 0, NULL},
530+
{p_islatin, 0, A_PUSH, TPS_InTagName, 0, NULL},
531531
{NULL, 0, A_POP, TPS_Null, 0, NULL}
532532
};
533533

@@ -541,7 +541,23 @@ static TParserStateActionItem actionTPS_InXMLBegin[] = {
541541

542542
static TParserStateActionItem actionTPS_InTagCloseFirst[] = {
543543
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
544-
{p_islatin, 0, A_NEXT, TPS_InTag, 0, NULL},
544+
{p_islatin, 0, A_NEXT, TPS_InTagName, 0, NULL},
545+
{NULL, 0, A_POP, TPS_Null, 0, NULL}
546+
};
547+
548+
static TParserStateActionItem actionTPS_InTagName[] = {
549+
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
550+
/* <br/> case */
551+
{p_iseqC, '/', A_NEXT, TPS_InTagBeginEnd, 0, NULL},
552+
{p_iseqC, '>', A_NEXT, TPS_InTagEnd, 0, SpecialTags},
553+
{p_isspace, 0, A_NEXT, TPS_InTag, 0, SpecialTags},
554+
{p_islatin, 0, A_NEXT, TPS_Null, 0, NULL},
555+
{NULL, 0, A_POP, TPS_Null, 0, NULL}
556+
};
557+
558+
static TParserStateActionItem actionTPS_InTagBeginEnd[] = {
559+
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
560+
{p_iseqC, '>', A_NEXT, TPS_InTagEnd, 0, NULL},
545561
{NULL, 0, A_POP, TPS_Null, 0, NULL}
546562
};
547563

@@ -977,6 +993,8 @@ static const TParserStateAction Actions[] = {
977993
{TPS_InTagFirst, actionTPS_InTagFirst},
978994
{TPS_InXMLBegin, actionTPS_InXMLBegin},
979995
{TPS_InTagCloseFirst, actionTPS_InTagCloseFirst},
996+
{TPS_InTagName, actionTPS_InTagName},
997+
{TPS_InTagBeginEnd, actionTPS_InTagBeginEnd},
980998
{TPS_InTag, actionTPS_InTag},
981999
{TPS_InTagEscapeK, actionTPS_InTagEscapeK},
9821000
{TPS_InTagEscapeKK, actionTPS_InTagEscapeKK},

contrib/tsearch2/wordparser/parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ typedef enum
3434
TPS_InTagFirst,
3535
TPS_InXMLBegin,
3636
TPS_InTagCloseFirst,
37+
TPS_InTagName,
38+
TPS_InTagBeginEnd,
3739
TPS_InTag,
3840
TPS_InTagEscapeK,
3941
TPS_InTagEscapeKK,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy