update nimsuggest
This commit is contained in:
parent
795044ed2b
commit
dfcd82669b
1 changed files with 15 additions and 39 deletions
|
|
@ -292,52 +292,37 @@ proc raiseParseErr*(p: SexpParser, msg: string) {.noinline, noreturn.} =
|
||||||
|
|
||||||
proc newSString*(s: string): SexpNode {.procvar.}=
|
proc newSString*(s: string): SexpNode {.procvar.}=
|
||||||
## Creates a new `SString SexpNode`.
|
## Creates a new `SString SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SString, str: s)
|
||||||
result.kind = SString
|
|
||||||
result.str = s
|
|
||||||
|
|
||||||
proc newSStringMove(s: string): SexpNode =
|
proc newSStringMove(s: string): SexpNode =
|
||||||
new(result)
|
result = SexpNode(kind: SString)
|
||||||
result.kind = SString
|
|
||||||
shallowCopy(result.str, s)
|
shallowCopy(result.str, s)
|
||||||
|
|
||||||
proc newSInt*(n: BiggestInt): SexpNode {.procvar.} =
|
proc newSInt*(n: BiggestInt): SexpNode {.procvar.} =
|
||||||
## Creates a new `SInt SexpNode`.
|
## Creates a new `SInt SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SInt, num: n)
|
||||||
result.kind = SInt
|
|
||||||
result.num = n
|
|
||||||
|
|
||||||
proc newSFloat*(n: float): SexpNode {.procvar.} =
|
proc newSFloat*(n: float): SexpNode {.procvar.} =
|
||||||
## Creates a new `SFloat SexpNode`.
|
## Creates a new `SFloat SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SFloat, fnum: n)
|
||||||
result.kind = SFloat
|
|
||||||
result.fnum = n
|
|
||||||
|
|
||||||
proc newSNil*(): SexpNode {.procvar.} =
|
proc newSNil*(): SexpNode {.procvar.} =
|
||||||
## Creates a new `SNil SexpNode`.
|
## Creates a new `SNil SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SNil)
|
||||||
|
|
||||||
proc newSCons*(car, cdr: SexpNode): SexpNode {.procvar.} =
|
proc newSCons*(car, cdr: SexpNode): SexpNode {.procvar.} =
|
||||||
## Creates a new `SCons SexpNode`
|
## Creates a new `SCons SexpNode`
|
||||||
new(result)
|
result = SexpNode(kind: SCons, car: car, cdr: cdr)
|
||||||
result.kind = SCons
|
|
||||||
result.car = car
|
|
||||||
result.cdr = cdr
|
|
||||||
|
|
||||||
proc newSList*(): SexpNode {.procvar.} =
|
proc newSList*(): SexpNode {.procvar.} =
|
||||||
## Creates a new `SList SexpNode`
|
## Creates a new `SList SexpNode`
|
||||||
new(result)
|
result = SexpNode(kind: SList, elems: @[])
|
||||||
result.kind = SList
|
|
||||||
result.elems = @[]
|
|
||||||
|
|
||||||
proc newSSymbol*(s: string): SexpNode {.procvar.} =
|
proc newSSymbol*(s: string): SexpNode {.procvar.} =
|
||||||
new(result)
|
result = SexpNode(kind: SSymbol, symbol: s)
|
||||||
result.kind = SSymbol
|
|
||||||
result.symbol = s
|
|
||||||
|
|
||||||
proc newSSymbolMove(s: string): SexpNode =
|
proc newSSymbolMove(s: string): SexpNode =
|
||||||
new(result)
|
result = SexpNode(kind: SSymbol)
|
||||||
result.kind = SSymbol
|
|
||||||
shallowCopy(result.symbol, s)
|
shallowCopy(result.symbol, s)
|
||||||
|
|
||||||
proc getStr*(n: SexpNode, default: string = ""): string =
|
proc getStr*(n: SexpNode, default: string = ""): string =
|
||||||
|
|
@ -386,36 +371,27 @@ proc getCons*(n: SexpNode, defaults: Cons = (newSNil(), newSNil())): Cons =
|
||||||
|
|
||||||
proc sexp*(s: string): SexpNode =
|
proc sexp*(s: string): SexpNode =
|
||||||
## Generic constructor for SEXP data. Creates a new `SString SexpNode`.
|
## Generic constructor for SEXP data. Creates a new `SString SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SString, str: s)
|
||||||
result.kind = SString
|
|
||||||
result.str = s
|
|
||||||
|
|
||||||
proc sexp*(n: BiggestInt): SexpNode =
|
proc sexp*(n: BiggestInt): SexpNode =
|
||||||
## Generic constructor for SEXP data. Creates a new `SInt SexpNode`.
|
## Generic constructor for SEXP data. Creates a new `SInt SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SInt, num: n)
|
||||||
result.kind = SInt
|
|
||||||
result.num = n
|
|
||||||
|
|
||||||
proc sexp*(n: float): SexpNode =
|
proc sexp*(n: float): SexpNode =
|
||||||
## Generic constructor for SEXP data. Creates a new `SFloat SexpNode`.
|
## Generic constructor for SEXP data. Creates a new `SFloat SexpNode`.
|
||||||
new(result)
|
result = SexpNode(kind: SFloat, fnum: n)
|
||||||
result.kind = SFloat
|
|
||||||
result.fnum = n
|
|
||||||
|
|
||||||
proc sexp*(b: bool): SexpNode =
|
proc sexp*(b: bool): SexpNode =
|
||||||
## Generic constructor for SEXP data. Creates a new `SSymbol
|
## Generic constructor for SEXP data. Creates a new `SSymbol
|
||||||
## SexpNode` with value t or `SNil SexpNode`.
|
## SexpNode` with value t or `SNil SexpNode`.
|
||||||
new(result)
|
|
||||||
if b:
|
if b:
|
||||||
result.kind = SSymbol
|
result = SexpNode(kind: SSymbol, symbol: "t")
|
||||||
result.symbol = "t"
|
|
||||||
else:
|
else:
|
||||||
result.kind = SNil
|
result = SexpNode(kind: SNil)
|
||||||
|
|
||||||
proc sexp*(elements: openArray[SexpNode]): SexpNode =
|
proc sexp*(elements: openArray[SexpNode]): SexpNode =
|
||||||
## Generic constructor for SEXP data. Creates a new `SList SexpNode`
|
## Generic constructor for SEXP data. Creates a new `SList SexpNode`
|
||||||
new(result)
|
result = SexpNode(kind: SList)
|
||||||
result.kind = SList
|
|
||||||
newSeq(result.elems, elements.len)
|
newSeq(result.elems, elements.len)
|
||||||
for i, p in pairs(elements): result.elems[i] = p
|
for i, p in pairs(elements): result.elems[i] = p
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue