Files
Nim/parsesql.html
github-actions[bot] c7440eccf2 Deploy to GitHub pages
2025-09-27 04:02:34 +00:00

413 lines
39 KiB
HTML

<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en" data-theme="auto">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>std/parsesql</title>
<!-- Google fonts -->
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
<!-- Favicon -->
<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=="/>
<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=">
<!-- CSS -->
<link rel="stylesheet" type="text/css" href="nimdoc.out.css?v=2.3.1">
<!-- JS -->
<script type="text/javascript" src="dochack.js?v=2.3.1"></script>
</head>
<body>
<div class="document" id="documentId">
<div class="container">
<h1 class="title">std/parsesql</h1>
<div class="row">
<div class="three columns">
<div class="theme-select-wrapper">
<label for="theme-select">Theme:&nbsp;</label>
<select id="theme-select" onchange="setTheme(this.value)">
<option value="auto">🌗 Match OS</option>
<option value="dark">🌑 Dark</option>
<option value="light">🌕 Light</option>
</select>
</div>
<div id="global-links">
<ul class="simple-boot">
<li><a href="manual.html">Manual</a></li>
<li><a href="lib.html">Standard library</a></li>
<li> <a id="indexLink" href="theindex.html">Index</a></li>
<li><a href="compiler/theindex.html">Compiler docs</a></li>
<li><a href="https://nim-lang.github.io/fusion/theindex.html">Fusion docs</a></li>
<li><a href="https://nim-lang.github.io/Nim/">devel</a>, <a href="https://nim-lang.org/documentation.html">stable</a></li>
</ul>
</div>
<div id="searchInputDiv">
Search: <input type="search" id="searchInput"
oninput="search()" />
</div>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#7" id="57">Types</a></summary>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SqlLexer" title="SqlLexer = object of BaseLexer">SqlLexer</a></li>
<li><a class="reference" href="#SqlNode" title="SqlNode = ref SqlNodeObj">SqlNode</a></li>
<li><a class="reference" href="#SqlNodeKind" title="SqlNodeKind = enum
nkNone, nkIdent, nkQuotedIdent, nkStringLit, nkBitStringLit, nkHexStringLit,
nkIntegerLit, nkNumericLit, nkPrimaryKey, nkForeignKey, nkNotNull, nkNull,
nkStmtList, nkDot, nkDotDot, nkPrefix, nkInfix, nkCall, nkPrGroup,
nkColumnReference, nkReferences, nkDefault, nkCheck, nkConstraint, nkUnique,
nkIdentity, nkColumnDef, ## name, datatype, constraints
nkInsert, nkUpdate, nkDelete, nkSelect, nkSelectDistinct, nkSelectColumns,
nkSelectPair, nkAsgn, nkFrom, nkFromItemPair, nkJoin, nkNaturalJoin, nkUsing,
nkGroup, nkLimit, nkOffset, nkHaving, nkOrder, nkDesc, nkUnion, nkIntersect,
nkExcept, nkColumnList, nkValueList, nkWhere, nkCreateTable,
nkCreateTableIfNotExists, nkCreateType, nkCreateTypeIfNotExists,
nkCreateIndex, nkCreateIndexIfNotExists, nkEnumDef">SqlNodeKind</a></li>
<li><a class="reference" href="#SqlNodeObj" title="SqlNodeObj = object
case kind*: SqlNodeKind ## kind of syntax tree
of LiteralNodes:
strVal*: string ## AST leaf: the identifier, numeric literal
## string literal, etc.
else:
sons*: seq[SqlNode] ## the node's children">SqlNodeObj</a></li>
<li><a class="reference" href="#SqlParseError" title="SqlParseError = object of ValueError">SqlParseError</a></li>
<li><a class="reference" href="#SqlParser" title="SqlParser = object of SqlLexer
## Determines whether type parameters (e.g., sizes in types like VARCHAR(255)) are included in the SQL AST.">SqlParser</a></li>
</ul>
</details>
</li>
<li>
<details open>
<summary><a class="reference reference-toplevel" href="#12" id="62">Procs</a></summary>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">$
<li><a class="reference" href="#%24%2CSqlNode" title="`$`(n: SqlNode): string">`$`(n: SqlNode): string</a></li>
</ul>
<ul class="simple nested-toc-section">[]
<li><a class="reference" href="#%5B%5D%2CSqlNode%2CBackwardsIndex" title="`[]`(n: SqlNode; i: BackwardsIndex): SqlNode">`[]`(n: SqlNode; i: BackwardsIndex): SqlNode</a></li>
<li><a class="reference" href="#%5B%5D%2CSqlNode%2Cint" title="`[]`(n: SqlNode; i: int): SqlNode">`[]`(n: SqlNode; i: int): SqlNode</a></li>
</ul>
<ul class="simple nested-toc-section">add
<li><a class="reference" href="#add%2CSqlNode%2CSqlNode" title="add(father, n: SqlNode)">add(father, n: SqlNode)</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CSqlNode" title="len(n: SqlNode): int">len(n: SqlNode): int</a></li>
</ul>
<ul class="simple nested-toc-section">newNode
<li><a class="reference" href="#newNode%2CSqlNodeKind" title="newNode(k: SqlNodeKind): SqlNode">newNode(k: SqlNodeKind): SqlNode</a></li>
<li><a class="reference" href="#newNode%2CSqlNodeKind%2Cstring" title="newNode(k: SqlNodeKind; s: string): SqlNode">newNode(k: SqlNodeKind; s: string): SqlNode</a></li>
<li><a class="reference" href="#newNode%2CSqlNodeKind%2Cseq%5BSqlNode%5D" title="newNode(k: SqlNodeKind; sons: seq[SqlNode]): SqlNode">newNode(k: SqlNodeKind; sons: seq[SqlNode]): SqlNode</a></li>
</ul>
<ul class="simple nested-toc-section">parseSql
<li><a class="reference" href="#parseSql%2CStream%2Cstring" title="parseSql(input: Stream; filename: string; considerTypeParams = false): SqlNode">parseSql(input: Stream; filename: string; considerTypeParams = false): SqlNode</a></li>
<li><a class="reference" href="#parseSql%2Cstring%2Cstring" title="parseSql(input: string; filename = &quot;&quot;; considerTypeParams = false): SqlNode">parseSql(input: string; filename = &quot;&quot;; considerTypeParams = false): SqlNode</a></li>
</ul>
<ul class="simple nested-toc-section">renderSql
<li><a class="reference" href="#renderSql%2CSqlNode" title="renderSql(n: SqlNode; upperCase = false): string">renderSql(n: SqlNode; upperCase = false): string</a></li>
</ul>
<ul class="simple nested-toc-section">treeRepr
<li><a class="reference" href="#treeRepr%2CSqlNode" title="treeRepr(s: SqlNode): string">treeRepr(s: SqlNode): string</a></li>
</ul>
</ul>
</details>
</li>
</ul>
</div>
<div class="nine columns" id="content">
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L1" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L1" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
<div id="tocRoot"></div>
<div class="deprecation-message">
<b>Deprecated:</b> use `nimble install parsesql` and import `pkg/parsesql` instead
</div>
<p class="module-desc"><p>The <tt class="docutils literal"><span class="pre"><span class="Identifier">parsesql</span></span></tt> module implements a high performance SQL file parser. It parses PostgreSQL syntax and the SQL ANSI standard.</p>
<p>Unstable API.</p>
</p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="strutils.html">strutils</a>, <a class="reference external" href="lexbase.html">lexbase</a>, <a class="reference external" href="decode_helpers.html">decode_helpers</a>, <a class="reference external" href="assertions.html">assertions</a>, <a class="reference external" href="streams.html">streams</a>
</dl>
</div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="SqlLexer">
<dt><pre><a href="parsesql.html#SqlLexer"><span class="Identifier">SqlLexer</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="lexbase.html#BaseLexer"><span class="Identifier">BaseLexer</span></a></pre></dt>
<dd>
the parser object.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L52" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L52" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SqlNode">
<dt><pre><a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <a href="parsesql.html#SqlNodeObj"><span class="Identifier">SqlNodeObj</span></a></pre></dt>
<dd>
an SQL abstract syntax tree node
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L543" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L543" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SqlNodeKind">
<dt><pre><a href="parsesql.html#SqlNodeKind"><span class="Identifier">SqlNodeKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">nkNone</span><span class="Other">,</span> <span class="Identifier">nkIdent</span><span class="Other">,</span> <span class="Identifier">nkQuotedIdent</span><span class="Other">,</span> <span class="Identifier">nkStringLit</span><span class="Other">,</span> <span class="Identifier">nkBitStringLit</span><span class="Other">,</span> <span class="Identifier">nkHexStringLit</span><span class="Other">,</span>
<span class="Identifier">nkIntegerLit</span><span class="Other">,</span> <span class="Identifier">nkNumericLit</span><span class="Other">,</span> <span class="Identifier">nkPrimaryKey</span><span class="Other">,</span> <span class="Identifier">nkForeignKey</span><span class="Other">,</span> <span class="Identifier">nkNotNull</span><span class="Other">,</span> <span class="Identifier">nkNull</span><span class="Other">,</span>
<span class="Identifier">nkStmtList</span><span class="Other">,</span> <span class="Identifier">nkDot</span><span class="Other">,</span> <span class="Identifier">nkDotDot</span><span class="Other">,</span> <span class="Identifier">nkPrefix</span><span class="Other">,</span> <span class="Identifier">nkInfix</span><span class="Other">,</span> <span class="Identifier">nkCall</span><span class="Other">,</span> <span class="Identifier">nkPrGroup</span><span class="Other">,</span>
<span class="Identifier">nkColumnReference</span><span class="Other">,</span> <span class="Identifier">nkReferences</span><span class="Other">,</span> <span class="Identifier">nkDefault</span><span class="Other">,</span> <span class="Identifier">nkCheck</span><span class="Other">,</span> <span class="Identifier">nkConstraint</span><span class="Other">,</span> <span class="Identifier">nkUnique</span><span class="Other">,</span>
<span class="Identifier">nkIdentity</span><span class="Other">,</span> <span class="Identifier">nkColumnDef</span><span class="Other">,</span> <span class="Comment">## name, datatype, constraints</span>
<span class="Identifier">nkInsert</span><span class="Other">,</span> <span class="Identifier">nkUpdate</span><span class="Other">,</span> <span class="Identifier">nkDelete</span><span class="Other">,</span> <span class="Identifier">nkSelect</span><span class="Other">,</span> <span class="Identifier">nkSelectDistinct</span><span class="Other">,</span> <span class="Identifier">nkSelectColumns</span><span class="Other">,</span>
<span class="Identifier">nkSelectPair</span><span class="Other">,</span> <span class="Identifier">nkAsgn</span><span class="Other">,</span> <span class="Identifier">nkFrom</span><span class="Other">,</span> <span class="Identifier">nkFromItemPair</span><span class="Other">,</span> <span class="Identifier">nkJoin</span><span class="Other">,</span> <span class="Identifier">nkNaturalJoin</span><span class="Other">,</span> <span class="Identifier">nkUsing</span><span class="Other">,</span>
<span class="Identifier">nkGroup</span><span class="Other">,</span> <span class="Identifier">nkLimit</span><span class="Other">,</span> <span class="Identifier">nkOffset</span><span class="Other">,</span> <span class="Identifier">nkHaving</span><span class="Other">,</span> <span class="Identifier">nkOrder</span><span class="Other">,</span> <span class="Identifier">nkDesc</span><span class="Other">,</span> <span class="Identifier">nkUnion</span><span class="Other">,</span> <span class="Identifier">nkIntersect</span><span class="Other">,</span>
<span class="Identifier">nkExcept</span><span class="Other">,</span> <span class="Identifier">nkColumnList</span><span class="Other">,</span> <span class="Identifier">nkValueList</span><span class="Other">,</span> <span class="Identifier">nkWhere</span><span class="Other">,</span> <span class="Identifier">nkCreateTable</span><span class="Other">,</span>
<span class="Identifier">nkCreateTableIfNotExists</span><span class="Other">,</span> <span class="Identifier">nkCreateType</span><span class="Other">,</span> <span class="Identifier">nkCreateTypeIfNotExists</span><span class="Other">,</span>
<span class="Identifier">nkCreateIndex</span><span class="Other">,</span> <span class="Identifier">nkCreateIndexIfNotExists</span><span class="Other">,</span> <span class="Identifier">nkEnumDef</span></pre></dt>
<dd>
kind of SQL abstract syntax tree
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L473" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L473" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SqlNodeObj">
<dt><pre><a href="parsesql.html#SqlNodeObj"><span class="Identifier">SqlNodeObj</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="parsesql.html#SqlNodeKind"><span class="Identifier">SqlNodeKind</span></a> <span class="Comment">## kind of syntax tree</span>
<span class="Keyword">of</span> <span class="Identifier">LiteralNodes</span><span class="Other">:</span>
<span class="Identifier">strVal</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a> <span class="Comment">## AST leaf: the identifier, numeric literal</span>
<span class="Comment">## string literal, etc.</span>
<span class="Keyword">else</span><span class="Other">:</span>
<span class="Identifier">sons</span><span class="Operator">*</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">]</span> <span class="Comment">## the node's children</span></pre></dt>
<dd>
an SQL abstract syntax tree node
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L544" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L544" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SqlParseError">
<dt><pre><a href="parsesql.html#SqlParseError"><span class="Identifier">SqlParseError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="exceptions.html#ValueError"><span class="Identifier">ValueError</span></a></pre></dt>
<dd>
Invalid SQL encountered
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L542" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L542" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="SqlParser">
<dt><pre><a href="parsesql.html#SqlParser"><span class="Identifier">SqlParser</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="parsesql.html#SqlLexer"><span class="Identifier">SqlLexer</span></a>
<span class="Comment">## Determines whether type parameters (e.g., sizes in types like VARCHAR(255)) are included in the SQL AST.</span></pre></dt>
<dd>
SQL parser object
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L552" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L552" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</dl>
</div>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="$-procs-all">
<div id="$,SqlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2CSqlNode"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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">Exception</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</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>
<dd>
an alias for <tt class="docutils literal"><span class="pre"><span class="Identifier">renderSql</span></span></tt>.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L1541" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L1541" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="[]-procs-all">
<div id="[],SqlNode,BackwardsIndex">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CSqlNode%2CBackwardsIndex"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#BackwardsIndex"><span class="Identifier">BackwardsIndex</span></a><span class="Other">)</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L581" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L581" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="[],SqlNode,int">
<dt><pre><span class="Keyword">proc</span> <a href="#%5B%5D%2CSqlNode%2Cint"><span class="Identifier">`[]`</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">;</span> <span class="Identifier">i</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</span></a><span class="Other">)</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L580" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L580" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="add-procs-all">
<div id="add,SqlNode,SqlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#add%2CSqlNode%2CSqlNode"><span class="Identifier">add</span></a><span class="Other">(</span><span class="Identifier">father</span><span class="Other">,</span> <span class="Identifier">n</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">)</span> {.<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> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L583" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L583" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="len-procs-all">
<div id="len,SqlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#len%2CSqlNode"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">)</span><span class="Other">:</span> <a href="system.html#int"><span class="Identifier">int</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> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L574" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L574" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="newNode-procs-all">
<div id="newNode,SqlNodeKind">
<dt><pre><span class="Keyword">proc</span> <a href="#newNode%2CSqlNodeKind"><span class="Identifier">newNode</span></a><span class="Other">(</span><span class="Identifier">k</span><span class="Other">:</span> <a href="parsesql.html#SqlNodeKind"><span class="Identifier">SqlNodeKind</span></a><span class="Other">)</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L556" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L556" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="newNode,SqlNodeKind,string">
<dt><pre><span class="Keyword">proc</span> <a href="#newNode%2CSqlNodeKind%2Cstring"><span class="Identifier">newNode</span></a><span class="Other">(</span><span class="Identifier">k</span><span class="Other">:</span> <a href="parsesql.html#SqlNodeKind"><span class="Identifier">SqlNodeKind</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="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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>
<span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L566" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L566" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="newNode,SqlNodeKind,seq[SqlNode]">
<dt><pre><span class="Keyword">proc</span> <a href="#newNode%2CSqlNodeKind%2Cseq%5BSqlNode%5D"><span class="Identifier">newNode</span></a><span class="Other">(</span><span class="Identifier">k</span><span class="Other">:</span> <a href="parsesql.html#SqlNodeKind"><span class="Identifier">SqlNodeKind</span></a><span class="Other">;</span> <span class="Identifier">sons</span><span class="Other">:</span> <a href="system.html#seq"><span class="Identifier">seq</span></a><span class="Other">[</span><a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L570" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L570" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="parseSql-procs-all">
<div id="parseSql,Stream,string">
<dt><pre><span class="Keyword">proc</span> <a href="#parseSql%2CStream%2Cstring"><span class="Identifier">parseSql</span></a><span class="Other">(</span><span class="Identifier">input</span><span class="Other">:</span> <a href="streams.html#Stream"><span class="Identifier">Stream</span></a><span class="Other">;</span> <span class="Identifier">filename</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">considerTypeParams</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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">IOError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">IOError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SqlParseError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</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>
<dd>
parses the SQL from <tt class="docutils literal"><span class="pre"><span class="Identifier">input</span></span></tt> into an AST and returns the AST. <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> is only used for error messages. Syntax errors raise an <tt class="docutils literal"><span class="pre"><span class="Identifier">SqlParseError</span></span></tt> exception.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L1575" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L1575" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
<div id="parseSql,string,string">
<dt><pre><span class="Keyword">proc</span> <a href="#parseSql%2Cstring%2Cstring"><span class="Identifier">parseSql</span></a><span class="Other">(</span><span class="Identifier">input</span><span class="Other">:</span> <a href="system.html#string"><span class="Identifier">string</span></a><span class="Other">;</span> <span class="Identifier">filename</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span> <span class="Identifier">considerTypeParams</span> <span class="Other">=</span> <span class="Identifier">false</span><span class="Other">)</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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">IOError</span><span class="Other">,</span> <span class="Identifier">OSError</span><span class="Other">,</span> <span class="Identifier">ValueError</span><span class="Other">,</span> <span class="Identifier">SqlParseError</span><span class="Other">,</span> <span class="Identifier">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">ReadIOEffect</span><span class="Other">,</span> <span class="Identifier">RootEffect</span><span class="Other">,</span> <span class="Identifier">WriteIOEffect</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>
<dd>
parses the SQL from <tt class="docutils literal"><span class="pre"><span class="Identifier">input</span></span></tt> into an AST and returns the AST. <tt class="docutils literal"><span class="pre"><span class="Identifier">filename</span></span></tt> is only used for error messages. Syntax errors raise an <tt class="docutils literal"><span class="pre"><span class="Identifier">SqlParseError</span></span></tt> exception.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L1586" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L1586" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="renderSql-procs-all">
<div id="renderSql,SqlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#renderSql%2CSqlNode"><span class="Identifier">renderSql</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</span></a><span class="Other">;</span> <span class="Identifier">upperCase</span> <span class="Other">=</span> <span class="Identifier">false</span><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">Exception</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Identifier">RootEffect</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>
<dd>
Converts an SQL abstract syntax tree to its string representation.
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L1535" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L1535" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
<div id="treeRepr-procs-all">
<div id="treeRepr,SqlNode">
<dt><pre><span class="Keyword">proc</span> <a href="#treeRepr%2CSqlNode"><span class="Identifier">treeRepr</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <a href="parsesql.html#SqlNode"><span class="Identifier">SqlNode</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> <span class="Identifier">forbids</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<a href="https://github.com/nim-lang/Nim/tree/devel/lib/pure/parsesql.nim#L1557" class="link-seesrc" target="_blank">Source</a>&nbsp;&nbsp;
<a href="https://github.com/nim-lang/Nim/edit/devel/lib/pure/parsesql.nim#L1557" class="link-seesrc" target="_blank" >Edit</a>&nbsp;&nbsp;
</dd>
</div>
</div>
</dl>
</div>
</div>
</div>
<div class="twelve-columns footer">
<span class="nim-sprite"></span>
<br>
<small style="color: var(--hint);">Made with Nim. Generated: 2025-09-27 04:02:02 UTC</small>
</div>
</div>
</div>
<script defer data-domain="nim-lang.org" src="https://plausible.io/js/plausible.js"></script>
</body>
</html>