Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
e8c81e17
Commit
e8c81e17
authored
Dec 05, 2005
by
Teodor Sigaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve word parser.
- improve file and path recognition - fix misspeling - improve tag recognition
parent
8cb4e4f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
65 additions
and
22 deletions
+65
-22
contrib/tsearch2/wordparser/parser.c
contrib/tsearch2/wordparser/parser.c
+59
-19
contrib/tsearch2/wordparser/parser.h
contrib/tsearch2/wordparser/parser.h
+6
-3
No files found.
contrib/tsearch2/wordparser/parser.c
View file @
e8c81e17
...
...
@@ -327,6 +327,7 @@ static TParserStateActionItem actionTPS_Base[] = {
{
p_iseqC
,
'+'
,
A_PUSH
,
TPS_InSignedIntFirst
,
0
,
NULL
},
{
p_iseqC
,
'&'
,
A_PUSH
,
TPS_InHTMLEntityFirst
,
0
,
NULL
},
{
p_iseqC
,
'/'
,
A_PUSH
,
TPS_InFileFirst
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InPathFirst
,
0
,
NULL
},
{
NULL
,
0
,
A_NEXT
,
TPS_InSpace
,
0
,
NULL
}
};
...
...
@@ -336,6 +337,7 @@ static TParserStateActionItem actionTPS_InUWord[] = {
{
p_isalnum
,
0
,
A_NEXT
,
TPS_InUWord
,
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
},
{
p_iseqC
,
'-'
,
A_PUSH
,
TPS_InHyphenUWordFirst
,
0
,
NULL
},
{
NULL
,
0
,
A_BINGO
,
TPS_Base
,
UWORD
,
NULL
}
};
...
...
@@ -343,8 +345,8 @@ static TParserStateActionItem actionTPS_InUWord[] = {
static
TParserStateActionItem
actionTPS_InLatWord
[]
=
{
{
p_isEOF
,
0
,
A_BINGO
,
TPS_Base
,
LATWORD
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_Null
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
e
n
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InFile
Firs
t
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
ai
n
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InFile
Nex
t
,
0
,
NULL
},
{
p_iseqC
,
'-'
,
A_PUSH
,
TPS_InHostFirstAN
,
0
,
NULL
},
{
p_iseqC
,
'-'
,
A_PUSH
,
TPS_InHyphenLatWordFirst
,
0
,
NULL
},
{
p_iseqC
,
'@'
,
A_PUSH
,
TPS_InEmail
,
0
,
NULL
},
...
...
@@ -366,7 +368,7 @@ static TParserStateActionItem actionTPS_InCyrWord[] = {
static
TParserStateActionItem
actionTPS_InUnsignedInt
[]
=
{
{
p_isEOF
,
0
,
A_BINGO
,
TPS_Base
,
UNSIGNEDINT
,
NULL
},
{
p_isdigit
,
0
,
A_NEXT
,
TPS_Null
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
e
n
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
ai
n
,
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
},
...
...
@@ -500,10 +502,19 @@ static TParserStateActionItem actionTPS_InTagFirst[] = {
{
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_islatin
,
0
,
A_PUSH
,
TPS_InTag
,
0
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InXMLBegin
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
/* <?xml ... */
{
p_iseqC
,
'x'
,
A_NEXT
,
TPS_InTag
,
0
,
NULL
},
{
p_iseqC
,
'X'
,
A_NEXT
,
TPS_InTag
,
0
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InTagCloseFirst
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InTag
,
0
,
NULL
},
...
...
@@ -520,6 +531,11 @@ static TParserStateActionItem actionTPS_InTag[] = {
{
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
}
...
...
@@ -551,6 +567,9 @@ static TParserStateActionItem actionTPS_InTagEnd[] = {
static
TParserStateActionItem
actionTPS_InCommentFirst
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_iseqC
,
'-'
,
A_NEXT
,
TPS_InCommentLast
,
0
,
NULL
},
/* <!DOCTYPE ...>*/
{
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
}
};
...
...
@@ -583,30 +602,30 @@ static TParserStateActionItem actionTPS_InCommentEnd[] = {
{
NULL
,
0
,
A_BINGO
|
A_CLRALL
,
TPS_Base
,
TAG
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InHostFirstDom
e
n
[]
=
{
static
TParserStateActionItem
actionTPS_InHostFirstDom
ai
n
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHostDom
e
nSecond
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHostDom
ai
nSecond
,
0
,
NULL
},
{
p_isdigit
,
0
,
A_NEXT
,
TPS_InHost
,
0
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InHostDom
e
nSecond
[]
=
{
static
TParserStateActionItem
actionTPS_InHostDom
ai
nSecond
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHostDom
e
n
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHostDom
ai
n
,
0
,
NULL
},
{
p_isdigit
,
0
,
A_PUSH
,
TPS_InHost
,
0
,
NULL
},
{
p_iseqC
,
'-'
,
A_PUSH
,
TPS_InHostFirstAN
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
e
n
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
ai
n
,
0
,
NULL
},
{
p_iseqC
,
'@'
,
A_PUSH
,
TPS_InEmail
,
0
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InHostDom
e
n
[]
=
{
static
TParserStateActionItem
actionTPS_InHostDom
ai
n
[]
=
{
{
p_isEOF
,
0
,
A_BINGO
|
A_CLRALL
,
TPS_Base
,
HOST
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHostDom
e
n
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHostDom
ai
n
,
0
,
NULL
},
{
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_InHostFirstDom
e
n
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
ai
n
,
0
,
NULL
},
{
p_iseqC
,
'@'
,
A_PUSH
,
TPS_InEmail
,
0
,
NULL
},
{
p_isdigit
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_isstophost
,
0
,
A_BINGO
|
A_CLRALL
,
TPS_InURIStart
,
HOST
,
NULL
},
...
...
@@ -640,7 +659,7 @@ static TParserStateActionItem actionTPS_InHost[] = {
{
p_isdigit
,
0
,
A_NEXT
,
TPS_InHost
,
0
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InHost
,
0
,
NULL
},
{
p_iseqC
,
'@'
,
A_PUSH
,
TPS_InEmail
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
e
n
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_PUSH
,
TPS_InHostFirstDom
ai
n
,
0
,
NULL
},
{
p_iseqC
,
'-'
,
A_PUSH
,
TPS_InHostFirstAN
,
0
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
...
...
@@ -652,14 +671,32 @@ static TParserStateActionItem actionTPS_InEmail[] = {
static
TParserStateActionItem
actionTPS_InFileFirst
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_islatin
,
0
,
A_
CLEAR
,
TPS_InFile
,
0
,
NULL
},
{
p_isdigit
,
0
,
A_
CLEAR
,
TPS_InFile
,
0
,
NULL
},
{
p_iseqC
,
'.'
,
A_
CLEAR
,
TPS_InFile
,
0
,
NULL
},
{
p_iseqC
,
'_'
,
A_
CLEAR
,
TPS_InFile
,
0
,
NULL
},
{
p_islatin
,
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_InURIFirst
,
0
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InPathFirst
[]
=
{
{
p_isEOF
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
},
{
p_islatin
,
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
}
};
static
TParserStateActionItem
actionTPS_InPathSecond
[]
=
{
{
p_isEOF
,
0
,
A_BINGO
|
A_CLEAR
,
TPS_Base
,
FILEPATH
,
NULL
},
{
p_iseqC
,
'/'
,
A_NEXT
|
A_PUSH
,
TPS_InFileFirst
,
0
,
NULL
},
{
p_iseqC
,
'/'
,
A_BINGO
|
A_CLEAR
,
TPS_Base
,
FILEPATH
,
NULL
},
{
p_isspace
,
0
,
A_BINGO
|
A_CLEAR
,
TPS_Base
,
FILEPATH
,
NULL
},
{
NULL
,
0
,
A_POP
,
TPS_Null
,
0
,
NULL
}
};
static
TParserStateActionItem
actionTPS_InFile
[]
=
{
{
p_isEOF
,
0
,
A_BINGO
,
TPS_Base
,
FILEPATH
,
NULL
},
{
p_islatin
,
0
,
A_NEXT
,
TPS_InFile
,
0
,
NULL
},
...
...
@@ -894,6 +931,7 @@ static const TParserStateAction Actions[] = {
{
TPS_InHTMLEntityNum
,
actionTPS_InHTMLEntityNum
},
{
TPS_InHTMLEntityEnd
,
actionTPS_InHTMLEntityEnd
},
{
TPS_InTagFirst
,
actionTPS_InTagFirst
},
{
TPS_InXMLBegin
,
actionTPS_InXMLBegin
},
{
TPS_InTagCloseFirst
,
actionTPS_InTagCloseFirst
},
{
TPS_InTag
,
actionTPS_InTag
},
{
TPS_InTagEscapeK
,
actionTPS_InTagEscapeK
},
...
...
@@ -906,15 +944,17 @@ static const TParserStateAction Actions[] = {
{
TPS_InCloseCommentFirst
,
actionTPS_InCloseCommentFirst
},
{
TPS_InCloseCommentLast
,
actionTPS_InCloseCommentLast
},
{
TPS_InCommentEnd
,
actionTPS_InCommentEnd
},
{
TPS_InHostFirstDom
en
,
actionTPS_InHostFirstDome
n
},
{
TPS_InHostDom
enSecond
,
actionTPS_InHostDome
nSecond
},
{
TPS_InHostDom
en
,
actionTPS_InHostDome
n
},
{
TPS_InHostFirstDom
ain
,
actionTPS_InHostFirstDomai
n
},
{
TPS_InHostDom
ainSecond
,
actionTPS_InHostDomai
nSecond
},
{
TPS_InHostDom
ain
,
actionTPS_InHostDomai
n
},
{
TPS_InPortFirst
,
actionTPS_InPortFirst
},
{
TPS_InPort
,
actionTPS_InPort
},
{
TPS_InHostFirstAN
,
actionTPS_InHostFirstAN
},
{
TPS_InHost
,
actionTPS_InHost
},
{
TPS_InEmail
,
actionTPS_InEmail
},
{
TPS_InFileFirst
,
actionTPS_InFileFirst
},
{
TPS_InPathFirst
,
actionTPS_InPathFirst
},
{
TPS_InPathSecond
,
actionTPS_InPathSecond
},
{
TPS_InFile
,
actionTPS_InFile
},
{
TPS_InFileNext
,
actionTPS_InFileNext
},
{
TPS_InURIFirst
,
actionTPS_InURIFirst
},
...
...
contrib/tsearch2/wordparser/parser.h
View file @
e8c81e17
...
...
@@ -30,6 +30,7 @@ typedef enum
TPS_InHTMLEntityNum
,
TPS_InHTMLEntityEnd
,
TPS_InTagFirst
,
TPS_InXMLBegin
,
TPS_InTagCloseFirst
,
TPS_InTag
,
TPS_InTagEscapeK
,
...
...
@@ -42,15 +43,17 @@ typedef enum
TPS_InCloseCommentFirst
,
TPS_InCloseCommentLast
,
TPS_InCommentEnd
,
TPS_InHostFirstDom
e
n
,
TPS_InHostDom
e
nSecond
,
TPS_InHostDom
e
n
,
TPS_InHostFirstDom
ai
n
,
TPS_InHostDom
ai
nSecond
,
TPS_InHostDom
ai
n
,
TPS_InPortFirst
,
TPS_InPort
,
TPS_InHostFirstAN
,
TPS_InHost
,
TPS_InEmail
,
TPS_InFileFirst
,
TPS_InPathFirst
,
TPS_InPathSecond
,
TPS_InFile
,
TPS_InFileNext
,
TPS_InURIFirst
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment