From 087f830528b41b00d0bf7a501f7b0472f75ffb18 Mon Sep 17 00:00:00 2001 From: bptato Date: Thu, 5 Aug 2021 17:16:42 +0200 Subject: 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. --- src/html/htmlparser.nim | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'src/html/htmlparser.nim') 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 "" -- cgit 1.4.1-2-gfad0