Improve tag recognizing
authorTeodor Sigaev
Thu, 8 Dec 2005 09:11:19 +0000 (09:11 +0000)
committerTeodor Sigaev
Thu, 8 Dec 2005 09:11:19 +0000 (09:11 +0000)
contrib/tsearch2/wordparser/parser.c
contrib/tsearch2/wordparser/parser.h

index f7bfcf0ed904a82fd1ed14121fe45981dc362dad..23b031be79671f5245ed659f7d40c943950ec2fe 100644 (file)
@@ -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},
+   /* 
 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},
index 3f7962feea14d1ff0a325cdc9b123baccee83c71..923edea5896bf4931ebfe2ba5c66ff5fbb2be81e 100644 (file)
@@ -34,6 +34,8 @@ typedef enum
    TPS_InTagFirst,
    TPS_InXMLBegin,
    TPS_InTagCloseFirst,
+   TPS_InTagName,
+   TPS_InTagBeginEnd,
    TPS_InTag,
    TPS_InTagEscapeK,
    TPS_InTagEscapeKK,