Note: Import nimsuggest/sexp to use this module
Types
SexpError = enum errNone, ## no error errInvalidToken, ## invalid token errParensRiExpected, ## ``)`` expected errQuoteExpected, ## ``"`` expected errEofExpected ## EOF expected
- enumeration that lists all errors that can occur Source Edit
SexpEventKind = enum sexpError, ## an error occurred during parsing sexpEof, ## end of file reached sexpString, ## a string literal sexpSymbol, ## a symbol sexpInt, ## an integer literal sexpFloat, ## a float literal sexpNil, ## the value ``nil`` sexpDot, ## the dot to separate car/cdr sexpListStart, ## start of a list: the ``(`` token sexpListEnd ## end of a list: the ``)`` token
- enumeration of all events that may occur when parsing Source Edit
SexpNode = ref SexpNodeObj
- SEXP node Source Edit
SexpNodeKind = enum SNil, SInt, SFloat, SString, SSymbol, SList, SCons
- possible SEXP node types Source Edit
SexpNodeObj {.acyclic.} = object case kind*: SexpNodeKind of SString: str*: string of SSymbol: symbol*: string of SInt: num*: BiggestInt of SFloat: fnum*: float of SList: elems*: seq[SexpNode] of SCons: of SNil: nil
- Source Edit
SexpParser = object of BaseLexer
- the parser object. Source Edit
SexpParsingError = object of ValueError
- is raised for a SEXP error Source Edit
Procs
proc close(my: var SexpParser) {.inline, ...raises: [IOError, OSError], tags: [WriteIOEffect], forbids: [].}
- closes the parser my and its associated input stream. Source Edit
proc errorMsg(my: SexpParser): string {....raises: [ValueError], tags: [], forbids: [].}
- returns a helpful error message for the event sexpError Source Edit
proc errorMsgExpected(my: SexpParser; e: string): string {....raises: [ValueError], tags: [], forbids: [].}
- returns an error message "e expected" in the same format as the other error messages Source Edit
proc escapeJson(s: string): string {....raises: [], tags: [], forbids: [].}
- Converts a string s to its JSON representation. Source Edit
proc getColumn(my: SexpParser): int {.inline, ...raises: [], tags: [], forbids: [].}
- get the current column the parser has arrived at. Source Edit
proc getFloat(my: SexpParser): float {.inline, ...raises: [ValueError], tags: [], forbids: [].}
- returns the number for the event: sexpFloat Source Edit
proc getInt(my: SexpParser): BiggestInt {.inline, ...raises: [ValueError], tags: [], forbids: [].}
- returns the number for the event: sexpInt Source Edit
proc getLine(my: SexpParser): int {.inline, ...raises: [], tags: [], forbids: [].}
- get the current line the parser has arrived at. Source Edit
proc kind(my: SexpParser): SexpEventKind {.inline, ...raises: [], tags: [], forbids: [].}
- returns the current event type for the SEXP parser Source Edit
proc newSString(s: string): SexpNode {....raises: [], tags: [], forbids: [].}
- Creates a new SString SexpNode. Source Edit
proc newSSymbol(s: string): SexpNode {....raises: [], tags: [], forbids: [].}
- Source Edit
proc open(my: var SexpParser; input: Stream) {....raises: [IOError, OSError], tags: [ReadIOEffect], forbids: [].}
- initializes the parser with an input stream. Source Edit
proc raiseParseErr(p: SexpParser; msg: string) {.noinline, noreturn, ...raises: [SexpParsingError, ValueError], tags: [], forbids: [].}
- raises an ESexpParsingError exception. Source Edit
proc sexp(b: bool): SexpNode {....raises: [], tags: [], forbids: [].}
- Generic constructor for SEXP data. Creates a new SSymbol SexpNode with value t or SNil SexpNode. Source Edit
proc sexp(elements: openArray[SexpNode]): SexpNode {....raises: [], tags: [], forbids: [].}
- Generic constructor for SEXP data. Creates a new SList SexpNode Source Edit
proc sexp(n: BiggestInt): SexpNode {....raises: [], tags: [], forbids: [].}
- Generic constructor for SEXP data. Creates a new SInt SexpNode. Source Edit
proc str(my: SexpParser): string {.inline, ...raises: [], tags: [], forbids: [].}
- returns the character data for the events: sexpInt, sexpFloat, sexpString Source Edit
Macros
macro convertSexp(x: untyped): untyped
- Convert an expression to a SexpNode directly, without having to specify % for every element. Source Edit