dochelpers.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <!-- This file is generated by Nim. -->
  4. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  8. <title>packages/docutils/dochelpers</title>
  9. <!-- Google fonts -->
  10. <link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
  11. <link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
  12. <!-- Favicon -->
  13. <link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
  14. <link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
  15. <!-- CSS -->
  16. <link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
  17. <!-- JS -->
  18. <script type="text/javascript" src="dochack.js?v=2.3.1"></script>
  19. </head>
  20. <body>
  21. <div class="document" id="documentId">
  22. <div class="container">
  23. <h1 class="title">packages/docutils/dochelpers</h1>
  24. <div class="row">
  25. <div class="three columns">
  26. <div class="theme-select-wrapper">
  27. <label for="theme-select">Theme:&nbsp;</label>
  28. <select id="theme-select" onchange="setTheme(this.value)">
  29. <option value="auto">🌗 Match OS</option>
  30. <option value="dark">🌑 Dark</option>
  31. <option value="light">🌕 Light</option>
  32. </select>
  33. </div>
  34. <div id="global-links">
  35. <ul class="simple-boot">
  36. <li><a href="manual.html">Manual</a></li>
  37. <li><a href="lib.html">Standard library</a></li>
  38. <li> <a id="indexLink" href="theindex.html">Index</a></li>
  39. <li><a href="compiler/theindex.html">Compiler docs</a></li>
  40. <li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
  41. <li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
  42. </ul>
  43. </div>
  44. <div id="searchInputDiv">
  45. Search: <input type="search" id="searchInput"
  46. oninput="search()" />
  47. </div>
  48. <ul class="simple simple-toc" id="toc-list">
  49. <li>
  50. <a class="reference reference-toplevel" href="#6" id="56">Imports</a>
  51. </li>
  52. <li>
  53. <details open>
  54. <summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
  55. <ul class="simple simple-toc-section">
  56. <li><a class="reference" href="#LangSymbol" title="LangSymbol = object
  57. symKind*: string ## &quot;proc&quot;, &quot;const&quot;, &quot;type&quot;, etc
  58. symTypeKind*: string ## &quot;&quot;|enum|object|tuple -
  59. ## valid only when `symKind == &quot;type&quot;`
  60. name*: string ## plain symbol name without any parameters
  61. generics*: string ## generic parameters (without brackets)
  62. isGroup*: bool ## is LangSymbol a group with overloads?
  63. parametersProvided*: bool ## to disambiguate `proc f`_ and `proc f()`_
  64. parameters*: seq[tuple[name: string, `type`: string]] ## name-type seq, e.g. for proc
  65. outType*: string ## result type, e.g. for proc">LangSymbol</a></li>
  66. </ul>
  67. </details>
  68. </li>
  69. <li>
  70. <details open>
  71. <summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
  72. <ul class="simple simple-toc-section">
  73. <ul class="simple nested-toc-section">$
  74. <li><a class="reference" href="#%24%2CLangSymbol" title="`$`(s: LangSymbol): string">`$`(s: LangSymbol): string</a></li>
  75. </ul>
  76. <ul class="simple nested-toc-section">langSymbolGroup
  77. <li><a class="reference" href="#langSymbolGroup%2Cstring%2Cstring" title="langSymbolGroup(kind: string; name: string): LangSymbol">langSymbolGroup(kind: string; name: string): LangSymbol</a></li>
  78. </ul>
  79. <ul class="simple nested-toc-section">match
  80. <li><a class="reference" href="#match%2CLangSymbol%2CLangSymbol" title="match(generated: LangSymbol; docLink: LangSymbol): bool">match(generated: LangSymbol; docLink: LangSymbol): bool</a></li>
  81. </ul>
  82. <ul class="simple nested-toc-section">nimIdentBackticksNormalize
  83. <li><a class="reference" href="#nimIdentBackticksNormalize%2Cstring" title="nimIdentBackticksNormalize(s: string): string">nimIdentBackticksNormalize(s: string): string</a></li>
  84. </ul>
  85. <ul class="simple nested-toc-section">toLangSymbol
  86. <li><a class="reference" href="#toLangSymbol%2CPRstNode" title="toLangSymbol(linkText: PRstNode): LangSymbol">toLangSymbol(linkText: PRstNode): LangSymbol</a></li>
  87. </ul>
  88. </ul>
  89. </details>
  90. </li>
  91. </ul>
  92. </div>
  93. <div class="nine columns" id="content">
  94. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  95. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  96. <div id="tocRoot"></div>
  97. <p class="module-desc"><p>Integration helpers between <tt class="docutils literal"><span class="pre">docgen.nim</span></tt> and <tt class="docutils literal"><span class="pre">rst.nim</span></tt>.</p>
  98. <p>Function <a class="reference internal nimdoc" title="proc toLangSymbol(linkText: PRstNode): LangSymbol" href="#toLangSymbol,PRstNode">toLangSymbol(linkText)</a> produces a signature <tt class="docutils literal"><span class="pre"><span class="Identifier">docLink</span></span></tt> of <a class="reference internal nimdoc" title="object LangSymbol" href="#LangSymbol">type LangSymbol</a> in <tt class="docutils literal"><span class="pre">rst.nim</span></tt>, while <a class="reference internal nimdoc" title="proc match(generated: LangSymbol; docLink: LangSymbol): bool" href="#match,LangSymbol,LangSymbol">match(generated, docLink)</a> matches it with <tt class="docutils literal"><span class="pre"><span class="Identifier">generated</span></span></tt>, produced from <tt class="docutils literal"><span class="pre"><span class="Identifier">PNode</span></span></tt> by <tt class="docutils literal"><span class="pre">docgen.rst</span></tt>.</p>
  99. </p>
  100. <div class="section" id="6">
  101. <h1><a class="toc-backref" href="#6">Imports</a></h1>
  102. <dl class="item">
  103. <a class="reference external" href="rstast.html">rstast</a>, <a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="syncio.html">syncio</a>
  104. </dl>
  105. </div>
  106. <div class="section" id="7">
  107. <h1><a class="toc-backref" href="#7">Types</a></h1>
  108. <dl class="item">
  109. <div id="LangSymbol">
  110. <dt><pre><a href="dochelpers.html#LangSymbol"><span class="Identifier">LangSymbol</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
  111. <span class="Identifier">symKind</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## &quot;proc&quot;, &quot;const&quot;, &quot;type&quot;, etc</span>
  112. <span class="Identifier">symTypeKind</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## &quot;&quot;|enum|object|tuple -</span>
  113. <span class="Comment">## valid only when `symKind == &quot;type&quot;`</span>
  114. <span class="Identifier">name</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## plain symbol name without any parameters</span>
  115. <span class="Identifier">generics</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## generic parameters (without brackets)</span>
  116. <span class="Identifier">isGroup</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> <span class="Comment">## is LangSymbol a group with overloads?</span>
  117. <span class="Identifier">parametersProvided</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> <span class="Comment">## to disambiguate `proc f`_ and `proc f()`_</span>
  118. <span class="Identifier">parameters</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">,</span> <span class="Other">`</span><span class="Keyword">type</span><span class="Other">`</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">]</span><span class="Other">]</span> <span class="Comment">## name-type seq, e.g. for proc</span>
  119. <span class="Identifier">outType</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## result type, e.g. for proc</span></pre></dt>
  120. <dd>
  121. symbol signature in Nim
  122. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L24" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  123. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L24" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  124. </dd>
  125. </div>
  126. </dl>
  127. </div>
  128. <div class="section" id="12">
  129. <h1><a class="toc-backref" href="#12">Procs</a></h1>
  130. <dl class="item">
  131. <div id="$-procs-all">
  132. <div id="$,LangSymbol">
  133. <dt><pre><span class="Keyword">proc</span> <a href="#%24%2CLangSymbol"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="dochelpers.html#LangSymbol"><span class="Identifier">LangSymbol</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  134. <dd>
  135. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L39" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  136. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L39" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  137. </dd>
  138. </div>
  139. </div>
  140. <div id="langSymbolGroup-procs-all">
  141. <div id="langSymbolGroup,string,string">
  142. <dt><pre><span class="Keyword">proc</span> <a href="#langSymbolGroup%2Cstring%2Cstring"><span class="Identifier">langSymbolGroup</span></a><span class="Other">(</span><span class="Identifier">kind</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">name</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="dochelpers.html#LangSymbol"><span class="Identifier">LangSymbol</span></a> {.
  143. <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  144. <dd>
  145. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L81" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  146. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L81" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  147. </dd>
  148. </div>
  149. </div>
  150. <div id="match-procs-all">
  151. <div id="match,LangSymbol,LangSymbol">
  152. <dt><pre><span class="Keyword">proc</span> <a href="#match%2CLangSymbol%2CLangSymbol"><span class="Identifier">match</span></a><span class="Other">(</span><span class="Identifier">generated</span><span class="Other">:</span> <a href="dochelpers.html#LangSymbol"><span class="Identifier">LangSymbol</span></a><span class="Other">;</span> <span class="Identifier">docLink</span><span class="Other">:</span> <a href="dochelpers.html#LangSymbol"><span class="Identifier">LangSymbol</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#bool"><span class="Identifier">bool</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  153. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  154. <dd>
  155. Returns true if <tt class="docutils literal"><span class="pre"><span class="Identifier">generated</span></span></tt> can be a target for <tt class="docutils literal"><span class="pre"><span class="Identifier">docLink</span></span></tt>. If <tt class="docutils literal"><span class="pre"><span class="Identifier">generated</span></span></tt> is an overload group then only <tt class="docutils literal"><span class="pre"><span class="Identifier">symKind</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">name</span></span></tt> are compared for success.
  156. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L257" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  157. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L257" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  158. </dd>
  159. </div>
  160. </div>
  161. <div id="nimIdentBackticksNormalize-procs-all">
  162. <div id="nimIdentBackticksNormalize,string">
  163. <dt><pre><span class="Keyword">func</span> <a href="#nimIdentBackticksNormalize%2Cstring"><span class="Identifier">nimIdentBackticksNormalize</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
  164. <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  165. <dd>
  166. <p>Normalizes the string <tt class="docutils literal"><span class="pre"><span class="Identifier">s</span></span></tt> as a Nim identifier.</p>
  167. <p>Unlike <tt class="docutils literal"><span class="pre"><span class="Identifier">nimIdentNormalize</span></span></tt> removes spaces and backticks.</p>
  168. <div class="admonition admonition-warning"><span class="admonition-warning-text"><b>Warning:</b></span>
  169. No checking (e.g. that identifiers cannot start from digits or '_', or that number of backticks is even) is performed.</div>
  170. <p><strong class="examples_text">Example:</strong></p>
  171. <pre class="listing"><span class="Identifier">doAssert</span> <span class="Identifier">nimIdentBackticksNormalize</span><span class="Punctuation">(</span><span class="StringLit">&quot;Foo_bar&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Foobar&quot;</span>
  172. <span class="Identifier">doAssert</span> <span class="Identifier">nimIdentBackticksNormalize</span><span class="Punctuation">(</span><span class="StringLit">&quot;FoO BAr&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Foobar&quot;</span>
  173. <span class="Identifier">doAssert</span> <span class="Identifier">nimIdentBackticksNormalize</span><span class="Punctuation">(</span><span class="StringLit">&quot;`Foo BAR`&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Foobar&quot;</span>
  174. <span class="Identifier">doAssert</span> <span class="Identifier">nimIdentBackticksNormalize</span><span class="Punctuation">(</span><span class="StringLit">&quot;` Foo BAR `&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;Foobar&quot;</span>
  175. <span class="Comment"># not a valid identifier:</span>
  176. <span class="Identifier">doAssert</span> <span class="Identifier">nimIdentBackticksNormalize</span><span class="Punctuation">(</span><span class="StringLit">&quot;`_x_y`&quot;</span><span class="Punctuation">)</span> <span class="Operator">==</span> <span class="StringLit">&quot;_xy&quot;</span></pre>
  177. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L45" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  178. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L45" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  179. </dd>
  180. </div>
  181. </div>
  182. <div id="toLangSymbol-procs-all">
  183. <div id="toLangSymbol,PRstNode">
  184. <dt><pre><span class="Keyword">proc</span> <a href="#toLangSymbol%2CPRstNode"><span class="Identifier">toLangSymbol</span></a><span class="Other">(</span><span class="Identifier">linkText</span><span class="Other">:</span> <a href="rstast.html#PRstNode"><span class="Identifier">PRstNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="dochelpers.html#LangSymbol"><span class="Identifier">LangSymbol</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span>
  185. <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
  186. <dd>
  187. <p>Parses <tt class="docutils literal"><span class="pre"><span class="Identifier">linkText</span></span></tt> into a more structured form using a state machine.</p>
  188. <p>This proc is designed to allow link syntax with operators even without escaped backticks inside:</p>
  189. <pre>`proc *`_
  190. `proc []`_</pre>
  191. <p>This proc should be kept in sync with the <tt class="docutils literal"><span class="pre"><span class="Identifier">renderTypes</span></span></tt> proc from <tt class="docutils literal"><span class="pre">compiler/typesrenderer.nim</span></tt>.</p>
  192. <a href="https://github.com/nim-lang/Nim/tree/devel/lib/packages/docutils/dochelpers.nim#L87" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
  193. <a href="https://github.com/nim-lang/Nim/edit/devel/lib/packages/docutils/dochelpers.nim#L87" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
  194. </dd>
  195. </div>
  196. </div>
  197. </dl>
  198. </div>
  199. </div>
  200. </div>
  201. <div class="twelve-columns footer">
  202. <span class="nim-sprite"></span>
  203. <br>
  204. <small style="color: var(--hint);">Made with Nim. Generated: 2025-03-15 14:13:38 UTC</small>
  205. </div>
  206. </div>
  207. </div>
  208. <script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
  209. </body>
  210. </html>