aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2005-12-08 09:11:19 +0000
committerTeodor Sigaev <teodor@sigaev.ru>2005-12-08 09:11:19 +0000
commitfaacdab101c782fba2018b9413f2f57bb6bbbf35 (patch)
treec6665ef1a882409d1772aa94ce90f917058dc93c
parentcefcbbf1fd43c80201e8e6fd36ac6fb00bd10825 (diff)
downloadpostgresql-faacdab101c782fba2018b9413f2f57bb6bbbf35.tar.gz
postgresql-faacdab101c782fba2018b9413f2f57bb6bbbf35.zip
Improve tag recognizing
-rw-r--r--contrib/tsearch2/wordparser/parser.c22
-rw-r--r--contrib/tsearch2/wordparser/parser.h2
2 files changed, 22 insertions, 2 deletions
diff --git a/contrib/tsearch2/wordparser/parser.c b/contrib/tsearch2/wordparser/parser.c
index f7bfcf0ed90..23b031be796 100644
--- a/contrib/tsearch2/wordparser/parser.c
+++ b/contrib/tsearch2/wordparser/parser.c
@@ -527,7 +527,7 @@ static TParserStateActionItem actionTPS_InTagFirst[] = {
{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_islatin, 0, A_PUSH, TPS_InTag, 0, NULL},
+ {p_islatin, 0, A_PUSH, TPS_InTagName, 0, NULL},
{NULL, 0, A_POP, TPS_Null, 0, NULL}
};
@@ -541,7 +541,23 @@ static TParserStateActionItem actionTPS_InXMLBegin[] = {
static TParserStateActionItem actionTPS_InTagCloseFirst[] = {
{p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
- {p_islatin, 0, A_NEXT, TPS_InTag, 0, NULL},
+ {p_islatin, 0, A_NEXT, TPS_InTagName, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
+};
+
+static TParserStateActionItem actionTPS_InTagName[] = {
+ {p_isEOF, 0, A_POP, TPS_Null, 0, NULL},
+ /* <br/> case */
+ {p_iseqC, '/', A_NEXT, TPS_InTagBeginEnd, 0, NULL},
+ {p_iseqC, '>', A_NEXT, TPS_InTagEnd, 0, SpecialTags},
+ {p_isspace, 0, A_NEXT, TPS_InTag, 0, SpecialTags},
+ {p_islatin, 0, A_NEXT, TPS_Null, 0, NULL},
+ {NULL, 0, A_POP, TPS_Null, 0, NULL}
+};
+
+static TParserStateActionItem actionTPS_InTagBeginEnd[] = {
+ {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}
};
@@ -977,6 +993,8 @@ static const TParserStateAction Actions[] = {
{TPS_InTagFirst, actionTPS_InTagFirst},
{TPS_InXMLBegin, actionTPS_InXMLBegin},
{TPS_InTagCloseFirst, actionTPS_InTagCloseFirst},
+ {TPS_InTagName, actionTPS_InTagName},
+ {TPS_InTagBeginEnd, actionTPS_InTagBeginEnd},
{TPS_InTag, actionTPS_InTag},
{TPS_InTagEscapeK, actionTPS_InTagEscapeK},
{TPS_InTagEscapeKK, actionTPS_InTagEscapeKK},
diff --git a/contrib/tsearch2/wordparser/parser.h b/contrib/tsearch2/wordparser/parser.h
index 3f7962feea1..923edea5896 100644
--- a/contrib/tsearch2/wordparser/parser.h
+++ b/contrib/tsearch2/wordparser/parser.h
@@ -34,6 +34,8 @@ typedef enum
TPS_InTagFirst,
TPS_InXMLBegin,
TPS_InTagCloseFirst,
+ TPS_InTagName,
+ TPS_InTagBeginEnd,
TPS_InTag,
TPS_InTagEscapeK,
TPS_InTagEscapeKK,