|
@ -27,8 +27,7 @@ doMatchMs(<>, State, Index, MatchList) -> |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
matchWordMs(Word, State, Index, MatchList) -> |
|
|
matchWordMs(Word, State, Index, MatchList) -> |
|
|
Node = acsTree:goto(State), |
|
|
|
|
|
case Node of |
|
|
|
|
|
|
|
|
case acsTree:goto(State) of |
|
|
undefined -> |
|
|
undefined -> |
|
|
case State of |
|
|
case State of |
|
|
0 -> |
|
|
0 -> |
|
@ -37,8 +36,11 @@ matchWordMs(Word, State, Index, MatchList) -> |
|
|
{NextState, _} = acsTree:failOut(State), |
|
|
{NextState, _} = acsTree:failOut(State), |
|
|
matchWordMs(Word, NextState, Index, MatchList) |
|
|
matchWordMs(Word, NextState, Index, MatchList) |
|
|
end; |
|
|
end; |
|
|
_ -> |
|
|
|
|
|
|
|
|
Node -> |
|
|
case Node of |
|
|
case Node of |
|
|
|
|
|
{Word, NextState} -> |
|
|
|
|
|
NewMatchList = getOutputMs(NextState, Index, MatchList), |
|
|
|
|
|
{NextState, NewMatchList}; |
|
|
#{Word := NextState} -> |
|
|
#{Word := NextState} -> |
|
|
NewMatchList = getOutputMs(NextState, Index, MatchList), |
|
|
NewMatchList = getOutputMs(NextState, Index, MatchList), |
|
|
{NextState, NewMatchList}; |
|
|
{NextState, NewMatchList}; |
|
@ -87,8 +89,7 @@ doMatchIs(<>, State) -> |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
matchWordIs(Word, State) -> |
|
|
matchWordIs(Word, State) -> |
|
|
Node = acsTree:goto(State), |
|
|
|
|
|
case Node of |
|
|
|
|
|
|
|
|
case acsTree:goto(State) of |
|
|
undefined -> |
|
|
undefined -> |
|
|
case State of |
|
|
case State of |
|
|
0 -> |
|
|
0 -> |
|
@ -97,8 +98,15 @@ matchWordIs(Word, State) -> |
|
|
{NextState, _} = acsTree:failOut(State), |
|
|
{NextState, _} = acsTree:failOut(State), |
|
|
matchWordIs(Word, NextState) |
|
|
matchWordIs(Word, NextState) |
|
|
end; |
|
|
end; |
|
|
_ -> |
|
|
|
|
|
|
|
|
Node -> |
|
|
case Node of |
|
|
case Node of |
|
|
|
|
|
{Word, NextState} -> |
|
|
|
|
|
case getOutputIs(NextState) of |
|
|
|
|
|
false -> |
|
|
|
|
|
NextState; |
|
|
|
|
|
_ -> |
|
|
|
|
|
true |
|
|
|
|
|
end; |
|
|
#{Word := NextState} -> |
|
|
#{Word := NextState} -> |
|
|
case getOutputIs(NextState) of |
|
|
case getOutputIs(NextState) of |
|
|
false -> |
|
|
false -> |
|
@ -264,8 +272,7 @@ doMatchRs(<>, TotalSize, CurIndex, State, MatchList) -> |
|
|
end. |
|
|
end. |
|
|
|
|
|
|
|
|
matchWordRs(Word, State, MatchCnt) -> |
|
|
matchWordRs(Word, State, MatchCnt) -> |
|
|
Node = acsTree:goto(State), |
|
|
|
|
|
case Node of |
|
|
|
|
|
|
|
|
case acsTree:goto(State) of |
|
|
undefined -> |
|
|
undefined -> |
|
|
case State of |
|
|
case State of |
|
|
0 -> |
|
|
0 -> |
|
@ -274,8 +281,11 @@ matchWordRs(Word, State, MatchCnt) -> |
|
|
{NextState, _} = acsTree:failOut(State), |
|
|
{NextState, _} = acsTree:failOut(State), |
|
|
matchWordRs(Word, NextState, MatchCnt) |
|
|
matchWordRs(Word, NextState, MatchCnt) |
|
|
end; |
|
|
end; |
|
|
_ -> |
|
|
|
|
|
|
|
|
Node -> |
|
|
case Node of |
|
|
case Node of |
|
|
|
|
|
{Word, NextState} -> |
|
|
|
|
|
NewMatchCnt = getOutputRs(NextState, MatchCnt), |
|
|
|
|
|
{NextState, NewMatchCnt}; |
|
|
#{Word := NextState} -> |
|
|
#{Word := NextState} -> |
|
|
NewMatchCnt = getOutputRs(NextState, MatchCnt), |
|
|
NewMatchCnt = getOutputRs(NextState, MatchCnt), |
|
|
{NextState, NewMatchCnt}; |
|
|
{NextState, NewMatchCnt}; |
|
|