This module implements an AST for the reStructuredText parser.
RstNodeKind = enum rnInner, rnHeadline, rnOverline, rnTransition, rnParagraph, rnBulletList, rnBulletItem, rnEnumList, rnEnumItem, rnDefList, rnDefItem, rnDefName, rnDefBody, rnFieldList, rnField, rnFieldName, rnFieldBody, rnOptionList, rnOptionListItem, rnOptionGroup, rnOption, rnOptionString, rnOptionArgument, rnDescription, rnLiteralBlock, rnQuotedLiteralBlock, rnLineBlock, rnLineBlockItem, rnBlockQuote, rnTable, rnGridTable, rnTableRow, rnTableHeaderCell, rnTableDataCell, rnLabel, rnFootnote, rnCitation, rnStandaloneHyperlink, rnHyperlink, rnRef, rnDirective, rnDirArg, rnRaw, rnTitle, rnContents, rnImage, rnFigure, rnCodeBlock, rnRawHtml, rnRawLatex, rnContainer, rnIndex, rnSubstitutionDef, rnGeneralRole, rnSub, rnSup, rnIdx, rnEmphasis, rnStrongEmphasis, rnTripleEmphasis, rnInterpretedText, rnInlineLiteral, rnSubstitutionReferences, rnSmiley, rnLeaf
PRstNode = ref RstNode
RstNodeSeq = seq[PRstNode]
RstNode = object kind*: RstNodeKind ## the node's kind text*: string ## valid for leafs in the AST; and the title of ## the document or the section level*: int ## valid for some node kinds sons*: RstNodeSeq ## the node's sons
proc len(n: PRstNode): int {.raises: [], tags: [].}
proc newRstNode(kind: RstNodeKind): PRstNode {.raises: [], tags: [].}
proc newRstNode(kind: RstNodeKind; s: string): PRstNode {.raises: [], tags: [].}
proc lastSon(n: PRstNode): PRstNode {.raises: [], tags: [].}
proc add(father, son: PRstNode) {.raises: [], tags: [].}
proc addIfNotNil(father, son: PRstNode) {.raises: [], tags: [].}
proc renderRstToRst(n: PRstNode; result: var string) {.raises: [Exception], tags: [RootEffect].}
proc renderRstToJson(node: PRstNode): string {.raises: [], tags: [].}
{ "kind":string node.kind, "text":optional string node.text, "level":optional int node.level, "sons":optional node array }
© 2006–2017 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/rstast.html