Revert #7964
Somehow the test case doesn't crash anymore and the regression in the doc generation is fixed. Fixes #9019
This commit is contained in:
parent
0951b5b736
commit
4d9aec1858
6 changed files with 59 additions and 13 deletions
27
tests/let/t7936.nim
Normal file
27
tests/let/t7936.nim
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
discard """
|
||||
action: "run"
|
||||
"""
|
||||
|
||||
import
|
||||
tables, deques, sequtils
|
||||
|
||||
const
|
||||
lookupTable = {'(': ')', '{': '}', '[': ']'}.toTable
|
||||
|
||||
proc isPaired*(value: string): bool =
|
||||
var stack = initDeque[char]()
|
||||
|
||||
for item in value:
|
||||
# echo "Looking at " & item
|
||||
if item in lookupTable:
|
||||
stack.addLast(item)
|
||||
if item in toSeq(lookupTable.values):
|
||||
if stack.len == 0:
|
||||
return false
|
||||
if lookupTable[stack.popLast()] != item:
|
||||
return false
|
||||
|
||||
return stack.len == 0
|
||||
|
||||
doAssert isPaired("{[()]}") == true
|
||||
doAssert isPaired("a)b(c") == false
|
||||
Loading…
Add table
Add a link
Reference in a new issue