critbits added to stdlib
This commit is contained in:
parent
e9d6f5a647
commit
9fdfda136c
3 changed files with 28 additions and 3 deletions
|
|
@ -549,14 +549,12 @@ proc handleError(msg: TMsgKind, eh: TErrorHandling) =
|
||||||
assert(false) # we want a stack trace here
|
assert(false) # we want a stack trace here
|
||||||
if (msg >= fatalMin) and (msg <= fatalMax):
|
if (msg >= fatalMin) and (msg <= fatalMax):
|
||||||
if gVerbosity >= 3: assert(false)
|
if gVerbosity >= 3: assert(false)
|
||||||
assert false
|
|
||||||
quit(1)
|
quit(1)
|
||||||
if (msg >= errMin) and (msg <= errMax):
|
if (msg >= errMin) and (msg <= errMax):
|
||||||
inc(gErrorCounter)
|
inc(gErrorCounter)
|
||||||
options.gExitcode = 1'i8
|
options.gExitcode = 1'i8
|
||||||
if gErrorCounter >= gErrorMax or eh == doAbort:
|
if gErrorCounter >= gErrorMax or eh == doAbort:
|
||||||
if gVerbosity >= 3: assert(false)
|
if gVerbosity >= 3: assert(false)
|
||||||
assert false
|
|
||||||
quit(1) # one error stops the compiler
|
quit(1) # one error stops the compiler
|
||||||
elif eh == doRaise:
|
elif eh == doRaise:
|
||||||
raiseRecoverableError()
|
raiseRecoverableError()
|
||||||
|
|
|
||||||
28
tests/run/tcritbits.nim
Normal file
28
tests/run/tcritbits.nim
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
discard """
|
||||||
|
output: '''abc
|
||||||
|
def
|
||||||
|
definition
|
||||||
|
prefix
|
||||||
|
xyz
|
||||||
|
def
|
||||||
|
definition'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
import critbits
|
||||||
|
|
||||||
|
when isMainModule:
|
||||||
|
var r: TCritBitTree[void]
|
||||||
|
r.incl "abc"
|
||||||
|
r.incl "xyz"
|
||||||
|
r.incl "def"
|
||||||
|
r.incl "definition"
|
||||||
|
r.incl "prefix"
|
||||||
|
doAssert r.contains"def"
|
||||||
|
#r.del "def"
|
||||||
|
|
||||||
|
for w in r.items:
|
||||||
|
echo w
|
||||||
|
|
||||||
|
for w in r.itemsWithPrefix("de"):
|
||||||
|
echo w
|
||||||
|
|
||||||
1
todo.txt
1
todo.txt
|
|
@ -1,7 +1,6 @@
|
||||||
version 0.8.14
|
version 0.8.14
|
||||||
==============
|
==============
|
||||||
|
|
||||||
- add critbits module to stdlib
|
|
||||||
- BUG: type TX = TTable[string, int]
|
- BUG: type TX = TTable[string, int]
|
||||||
- warning for implicit openArray -> varargs conversion
|
- warning for implicit openArray -> varargs conversion
|
||||||
- implement explicit varargs; **but** ``len(varargs)`` problem remains!
|
- implement explicit varargs; **but** ``len(varargs)`` problem remains!
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue