commit
b2727d03a6
6 changed files with 59 additions and 13 deletions
|
|
@ -495,12 +495,8 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode =
|
||||||
# keep documentation information:
|
# keep documentation information:
|
||||||
b.comment = a.comment
|
b.comment = a.comment
|
||||||
addSon(b, newSymNode(v))
|
addSon(b, newSymNode(v))
|
||||||
# keep type desc for doc generator, but only if the user explicitly
|
# keep type desc for doc generator
|
||||||
# added it
|
addSon(b, a.sons[length-2])
|
||||||
if a.sons[length-2].kind != nkEmpty:
|
|
||||||
addSon(b, newNodeIT(nkType, a.info, typ))
|
|
||||||
else:
|
|
||||||
addSon(b, a.sons[length-2])
|
|
||||||
addSon(b, copyTree(def))
|
addSon(b, copyTree(def))
|
||||||
addToVarSection(c, result, n, b)
|
addToVarSection(c, result, n, b)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -935,12 +935,11 @@ proc transform(c: PTransf, n: PNode): PTransNode =
|
||||||
else:
|
else:
|
||||||
result = transformSons(c, n)
|
result = transformSons(c, n)
|
||||||
of nkIdentDefs, nkConstDef:
|
of nkIdentDefs, nkConstDef:
|
||||||
when true:
|
result = PTransNode(n)
|
||||||
result = transformSons(c, n)
|
result[0] = transform(c, n[0])
|
||||||
else:
|
# Skip the second son since it only contains an unsemanticized copy of the
|
||||||
result = n.PTransNode
|
# variable type used by docgen
|
||||||
let L = n.len-1
|
result[2] = transform(c, n[2])
|
||||||
result[L] = transform(c, n.sons[L])
|
|
||||||
# XXX comment handling really sucks:
|
# XXX comment handling really sucks:
|
||||||
if importantComments(c.graph.config):
|
if importantComments(c.graph.config):
|
||||||
PNode(result).comment = n.comment
|
PNode(result).comment = n.comment
|
||||||
|
|
|
||||||
|
|
@ -1244,6 +1244,14 @@ function main() {
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="reference reference-toplevel" href="#8" id="58">Vars</a>
|
||||||
|
<ul class="simple simple-toc-section">
|
||||||
|
<li><a class="reference" href="#aVariable"
|
||||||
|
title="aVariable: array[1, int]"><wbr />a<wbr />Variable<span class="attachedType" style="visibility:hidden"></span></a></li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
||||||
<ul class="simple simple-toc-section">
|
<ul class="simple simple-toc-section">
|
||||||
|
|
@ -1285,6 +1293,16 @@ function main() {
|
||||||
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
||||||
<dl class="item">
|
<dl class="item">
|
||||||
<a class="reference external" href="subdir/subdir_b/utils.html">subdir/subdir_b/utils</a>
|
<a class="reference external" href="subdir/subdir_b/utils.html">subdir/subdir_b/utils</a>
|
||||||
|
</dl></div>
|
||||||
|
<div class="section" id="8">
|
||||||
|
<h1><a class="toc-backref" href="#8">Vars</a></h1>
|
||||||
|
<dl class="item">
|
||||||
|
<dt id="aVariable"><a name="aVariable"></a><pre><span class="Identifier">aVariable</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">1</span><span class="Other">,</span> <span class="Identifier">int</span><span class="Other">]</span></pre></dt>
|
||||||
|
<dd>
|
||||||
|
|
||||||
|
|
||||||
|
</dd>
|
||||||
|
|
||||||
</dl></div>
|
</dl></div>
|
||||||
<div class="section" id="12">
|
<div class="section" id="12">
|
||||||
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
||||||
|
|
|
||||||
|
|
@ -1221,7 +1221,11 @@ function main() {
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h1 class="title">Index</h1>
|
<h1 class="title">Index</h1>
|
||||||
Modules: <a href="subdir/subdir_b/utils.html">subdir/subdir_b/utils</a>, <a href="testproject.html">testproject</a>.<br/><p /><h2>API symbols</h2>
|
Modules: <a href="subdir/subdir_b/utils.html">subdir/subdir_b/utils</a>, <a href="testproject.html">testproject</a>.<br/><p /><h2>API symbols</h2>
|
||||||
<dl><dt><a name="bar" href="#bar"><span>bar:</span></a></dt><dd><ul class="simple">
|
<dl><dt><a name="aVariable" href="#aVariable"><span>aVariable:</span></a></dt><dd><ul class="simple">
|
||||||
|
<li><a class="reference external"
|
||||||
|
data-doc-search-tag="testproject: aVariable" href="testproject.html#aVariable">testproject: aVariable</a></li>
|
||||||
|
</ul></dd>
|
||||||
|
<dt><a name="bar" href="#bar"><span>bar:</span></a></dt><dd><ul class="simple">
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
data-doc-search-tag="testproject: bar[T](a, b: T): T" href="testproject.html#bar,T,T">testproject: bar[T](a, b: T): T</a></li>
|
data-doc-search-tag="testproject: bar[T](a, b: T): T" href="testproject.html#bar,T,T">testproject: bar[T](a, b: T): T</a></li>
|
||||||
<li><a class="reference external"
|
<li><a class="reference external"
|
||||||
|
|
|
||||||
|
|
@ -20,3 +20,5 @@ import std/macros
|
||||||
|
|
||||||
macro bar*(): untyped =
|
macro bar*(): untyped =
|
||||||
result = newStmtList()
|
result = newStmtList()
|
||||||
|
|
||||||
|
var aVariable*: array[1,int]
|
||||||
|
|
|
||||||
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