diff options
author | bptato <nincsnevem662@gmail.com> | 2021-08-05 17:16:42 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2021-08-05 17:16:42 +0200 |
commit | 087f830528b41b00d0bf7a501f7b0472f75ffb18 (patch) | |
tree | ae0096738b46ff1710f1116268ebdebb6924a68b /src/html/htmlparser.nim | |
parent | 69a0f081e6eefdd6a52b0da6586100349b1a6ea8 (diff) | |
download | chawan-087f830528b41b00d0bf7a501f7b0472f75ffb18.tar.gz |
Remove static radix tree and small/full builds
Static radix tree was a hack to begin with and I don't want to deal with it anymore. I might consider small/full builds later on but let's be honest here, it's premature optimization.
Diffstat (limited to 'src/html/htmlparser.nim')
-rw-r--r-- | src/html/htmlparser.nim | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/src/html/htmlparser.nim b/src/html/htmlparser.nim index 67aec2e4..94c474f0 100644 --- a/src/html/htmlparser.nim +++ b/src/html/htmlparser.nim @@ -89,38 +89,21 @@ proc getescapecmd(buf: string, at: var int): string = elif not isAlphaAscii(buf[i]): return "" - when defined(full): - var n = 0 - var s = "" - while true: - s &= buf[i] - if not entityMap.hasPrefix(s, n): - break - let pn = n - n = entityMap{s, n} - if n != pn: - s = "" - inc i - - if entityMap.nodes[n].leaf: - at = i - return entityMap.nodes[n].value - else: - var n = entityMap - var s = "" - while true: - s &= buf[i] - if not entityMap.hasPrefix(s, n): - break - let pn = n - n = n{s} - if n != pn: - s = "" - inc i + var n = entityMap + var s = "" + while true: + s &= buf[i] + if not entityMap.hasPrefix(s, n): + break + let pn = n + n = n{s} + if n != pn: + s = "" + inc i - if n.leaf: - at = i - return n.value + if n.leaf: + at = i + return n.value return "" |