-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path_WordList.Word.ahk
47 lines (47 loc) · 1.36 KB
/
_WordList.Word.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Class Word {
Class _Match {
isPending := {value: "", pos: 0, len: 0}
isComplete := {value: "", pos: 0, len: 0}
}
_minLength := (this.minLength:=2)
minLength {
set {
return (not ((value:=Floor(value)) > 0)) ? this._minLength : this._minLength:=value
}
get {
return this._minLength
}
}
_edgeKeys := (this.edgeKeys:="\/|?!,;.:(){}[]'""<>@=")
edgeKeys {
set {
local
_lastEdgeKeys := "", _edgeKeys := ""
_listLines := A_ListLines
ListLines, 0
Loop, parse, % RegExReplace(value, "\s")
{
if (InStr(_lastEdgeKeys, A_LoopField))
continue
_lastEdgeKeys .= A_LoopField
if A_LoopField in \,.,*,?,+,[,],{,},|,(,),^,$
_edgeKeys .= "\" . A_LoopField
else _edgeKeys .= A_LoopField
}
ListLines % _listLines
return this._edgeKeys:=_edgeKeys
}
get {
return this._edgeKeys
}
}
test(_string, ByRef _wrapper:="") {
local
_isPending := "?P<isPending>[^\s" . this.edgeKeys . "]{" . this.minLength . ",}", _isComplete := "?P<isComplete>[\s" . this.edgeKeys . "]?"
_pos := RegExMatch(_string, "`aOi)(" . _isPending . ")(" . _isComplete . ")$", _match)
for _subPatternName, _subPatternObject in _wrapper := new this._Match()
for _property in _subPatternObject, _o := _wrapper[_subPatternName]
_o[_property] := _match[_property](_subPatternName)
return _pos
}
}