MCPcopy Create free account
hub / github.com/GoEdgeLab/EdgeNode / lookup

Method lookup

internal/re/rune_tree.go:11–43  ·  view source on GitHub ↗
(runes []rune, caseInsensitive bool, depth int)

Source from the content-addressed store, hash-verified

9}
10
11func (this RuneMap) lookup(runes []rune, caseInsensitive bool, depth int) bool {
12 if len(runes) == 0 {
13 return false
14 }
15 for i, r := range runes {
16 tree, ok := this[r]
17 if !ok {
18 if caseInsensitive {
19 if r >= 'a' && r <= 'z' {
20 r -= 32
21 tree, ok = this[r]
22 } else if r >= 'A' && r <= 'Z' {
23 r += 32
24 tree, ok = this[r]
25 }
26 }
27 if !ok {
28 if depth > 0 {
29 return false
30 }
31 continue
32 }
33 }
34 if tree.IsEnd {
35 return true
36 }
37 b := tree.Children.lookup(runes[i+1:], caseInsensitive, depth+1)
38 if b {
39 return true
40 }
41 }
42 return false
43}
44
45type RuneTree struct {
46 Children RuneMap

Callers 6

LookupMethod · 0.95
parse_operator2Function · 0.80
parse_wordFunction · 0.80
parse_tickFunction · 0.80
syntax_merge_wordsFunction · 0.80
libinjection_is_sqliFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected