From b6316d46d51e6f21bdf594a82be40d80aec28fac Mon Sep 17 00:00:00 2001 From: SisMaker <1713699517@qq.com> Date: Fri, 30 Apr 2021 01:02:43 +0800 Subject: [PATCH] =?UTF-8?q?ft:=20replaceSw=E5=87=BD=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=20todo:=20replaceSw=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E7=9A=84=E4=BC=98=E5=8C=96=20=E6=95=8F=E6=84=9F=E8=AF=8D?= =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rebar.config | 4 +++- src/eAcs.erl | 5 ++--- src/test/acTest.erl | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/rebar.config b/rebar.config index f8d6a36..f8e6bf3 100644 --- a/rebar.config +++ b/rebar.config @@ -1,5 +1,7 @@ {erl_opts, [no_debug_info]}. -{deps, []}. +{deps,[ + {eSync, {git, "http://192.168.0.88:53000/SisMaker/eSync.git", {branch, "master"}}} +]}. %% escript diff --git a/src/eAcs.erl b/src/eAcs.erl index 006482c..5089122 100644 --- a/src/eAcs.erl +++ b/src/eAcs.erl @@ -136,14 +136,13 @@ getOutputIs(State) -> replaceSw(BinStr) -> TotalSize = byte_size(BinStr), MatchBIMWs = doMatchRs(BinStr, TotalSize - 1, _Index = 1, _State = 0, _MatchList = []), - io:format("IMY******************* ~p~n", [lists:reverse(MatchBIMWs)]), doReplaceSw(lists:reverse(MatchBIMWs), BinStr, TotalSize, _StartPos = 0, <<>>). %% 从前往后替换 doReplaceSw([], BinStr, TotalSize, StartPos, BinAcc) -> case TotalSize > StartPos of true -> - <>; + <>; _ -> BinAcc end; @@ -173,7 +172,7 @@ getMatchWords(MatchWordCnt, BinStr, ByteIndex, BslCnt, Utf8Code, FilterWs) -> %% 不是特殊词 getMatchWords(MatchWordCnt - 1, BinStr, ByteIndex - 1, 0, 0, [?RW | FilterWs]) end; - Byte band 128 == 128 -> + Byte bsr 6 == 2 -> Code = Byte band 63, getMatchWords(MatchWordCnt, BinStr, ByteIndex - 1, BslCnt + 6, Code bsl BslCnt + Utf8Code, FilterWs); true -> diff --git a/src/test/acTest.erl b/src/test/acTest.erl index f5a6782..00d83b5 100644 --- a/src/test/acTest.erl +++ b/src/test/acTest.erl @@ -7,7 +7,7 @@ test1() -> acTc:ts(1000000, acsTree, goto, [63870]). -test2() -> +test20() -> acTc:ts(1000000, eAcs, matchSw, [<<"fdsfads拉法叶舰fds淫秽ffdsfdsffdddd"/utf8>>]). test21() -> @@ -20,7 +20,7 @@ test3(Cnt, BinStr) -> acTc:ts(Cnt, eAcs, matchSw, [BinStr]). test31(Cnt, BinStr) -> - acTc:ts(Cnt, keyword, filter, [BinStr]). + acTc:ts(Cnt, eAcs, replaceSw, [BinStr]). test4(Cnt, FileName) -> {ok, Data} = file:read_file(FileName),