re2正則表示式引擎學習(五)
阿新 • • 發佈:2019-02-07
改寫為DFA匹配時的執行過程。
首先打印出來的是NFA的結構,然後將NFA的結構轉化為DFA的結構,構建對應的DFA轉移矩陣。然後根據轉移矩陣進行匹配
執行時,正則表示式為ab*c|d,匹配的字串為d
ab*c|d
9. alt -> 6 | 8
6. alt -> 1 | 5
8. byte [00-ff] -> 9
1. byte [61-61] -> 3
5. byte [64-64] -> 7
3. alt -> 2 | 4
7. match! 0
2. byte [62-62] -> 3
4. byte [63-63] -> 7
kind 0
9. alt -> 6 | 8
6. alt -> 1 | 5
8. byte [00-ff] -> 9
1. byte [61-61] -> 3
5. byte [64-64] -> 7
3. alt -> 2 | 4
7. match! 0
2. byte [62-62] -> 3
4. byte [63-63] -> 7
開始BuildAllStates2函式:
開始AnalyzeSearch函式:
開始AnalyzeSearchHelper函式:
WorkqToCachedState 9,6,1,5,8 [0x5] -> (00188900)9,6,1,5,8 flag=0 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
9,6,1,5,8 on 0[0] -> 9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 9,6,1,5,8 [0] -cached-> (00188900)9,6,1,5,8 flag=0 ID=0xcdcdc
dcd
RunWorkqOnByte 開始:
9,6,1,5,8 on 97[0] -> 3,2,4,9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 3,2,4,9,6,1,5,8 [0x2000] -> (0016F708)3,2,4,9,6,1,5,8 flag=0
ID=0xcdcdcdcd
RunWorkqOnByte 開始:
9,6,1,5,8 on 98[0] -> 9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 9,6,1,5,8 [0x2000] -cached-> (00188900)9,6,1,5,8 flag=0 ID=0x
cdcdcdcd
RunWorkqOnByte 開始:
9,6,1,5,8 on 99[0] -> 9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 9,6,1,5,8 [0x2000] -cached-> (00188900)9,6,1,5,8 flag=0 ID=0x
cdcdcdcd
RunWorkqOnByte 開始:
9,6,1,5,8 on 100[0] -> 7,9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 7,9,6,1,5,8 [0x2000] -> (0016E8A0)7 flag=0 ID=0xcdcdcdcd
結束AnalyzeSearchHelper函式!
anchored=0 fwd=0 flags=0x5 state=(00188900)9,6,1,5,8 flag=0 ID=0xcdcdcdcd firstb
yte=-2
結束AnalyzeSearch函式!
RunWorkqOnByte 開始:
9,6,1,5,8 on 101[0] -> 9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 9,6,1,5,8 [0x2000] -cached-> (00188900)9,6,1,5,8 flag=0 ID=0x
cdcdcdcd
RunWorkqOnByte 開始:
9,6,1,5,8 on 256[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0] -> DeadState
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 0[0] -> 9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 9,6,1,5,8 [0] -cached-> (00188900)9,6,1,5,8 flag=0 ID=0xcdcdc
dcd
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 97[0] -> 3,2,4,9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 3,2,4,9,6,1,5,8 [0x2000] -cached-> (0016F708)3,2,4,9,6,1,5,8
flag=0 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 98[0] -> 3,2,4,9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 3,2,4,9,6,1,5,8 [0x2000] -cached-> (0016F708)3,2,4,9,6,1,5,8
flag=0 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 99[0] -> 7,9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 7,9,6,1,5,8 [0x2000] -cached-> (0016E8A0)7 flag=0 ID=0xcdcdcd
cd
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 100[0] -> 7,9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 7,9,6,1,5,8 [0x2000] -cached-> (0016E8A0)7 flag=0 ID=0xcdcdcd
cd
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 101[0] -> 9,6,1,5,8 [0]
RunWorkqOnByte 結束!
WorkqToCachedState 9,6,1,5,8 [0x2000] -cached-> (00188900)9,6,1,5,8 flag=0 ID=0x
cdcdcdcd
RunWorkqOnByte 開始:
3,2,4,9,6,1,5,8 on 256[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0] -> DeadState
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x1000] -> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x3000] -cached-> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x3000] -cached-> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x3000] -cached-> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x3000] -cached-> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x3000] -cached-> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
RunWorkqOnByte 結束!
WorkqToCachedState [0x1000] -cached-> (0016E840) flag=0x1000 ID=0xcdcdcdcd
RunWorkqOnByte 開始:
on 0[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0] -> DeadState
RunWorkqOnByte 開始:
on 97[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0x2000] -> DeadState
RunWorkqOnByte 開始:
on 98[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0x2000] -> DeadState
RunWorkqOnByte 開始:
on 99[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0x2000] -> DeadState
RunWorkqOnByte 開始:
on 100[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0x2000] -> DeadState
RunWorkqOnByte 開始:
on 101[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0x2000] -> DeadState
RunWorkqOnByte 開始:
on 256[0] -> [0]
RunWorkqOnByte 結束!
WorkqToCachedState [0] -> DeadState
(00188900)9,6,1,5,8 flag=0 ID=0x1
(0016F708)3,2,4,9,6,1,5,8 flag=0 ID=0x2
(0016E8A0)7 flag=0 ID=0x3
(0016E840) flag=0x1000 ID=0x4
q.size(): 4 prog_->bytemap_range()+1: 7
1 2 1 1 3 1 0
1 2 2 3 3 1 0
-4 -4 -4 -4 -4 -4 -4
0 0 0 0 0 0 0
BuildAllStates2函式結束!
1 on 100[4] -> 3
3 on 256 -> 3
匹配位置2:2
請按任意鍵繼續. . .