~ehmry/nim_cbor

86999bfc5dc0a419f82a8c39afa09180e917e3fc — Emery Hemingway 5 months ago fc1f4cf
Cleanup dead code, update shell.nix, import from pkg/
4 files changed, 8 insertions(+), 23 deletions(-)

M shell.nix
M src/cbor/bignum.nim
D src/cbor/private/literals.nim
M tests/test_bignum.nim
M shell.nix => shell.nix +6 -1
@@ 1,1 1,6 @@
let pkgs = import <nixpkgs> { }; in pkgs.nim2Packages.cbor
{ pkgs ? import <nixpkgs> { } }:

pkgs.buildNimPackage {
  name = "dummy";
  lockFile = ./lock.json;
}

M src/cbor/bignum.nim => src/cbor/bignum.nim +1 -1
@@ 1,7 1,7 @@
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense

import bigints, ../cbor
import pkg/bigints, ../cbor

import std/[options, streams]


D src/cbor/private/literals.nim => src/cbor/private/literals.nim +0 -20
@@ 1,20 0,0 @@
# SPDX-License-Identifier: MIT
# Forked from https://github.com/nim-lang/bigints/blob/master/src/bigints/private/literals.nim

# This is an include file, do not import it directly.
# It is needed as a workaround for Nim's parser for versions <= 1.4.

proc `'bi`*(s: string): BigInt =
  ## Create a `BigInt` from a literal, using the suffix `'bi`.
  runnableExamples:
    let
      a = 123'bi
      b = 0xFF'bi
      c = 0b1011'bi
    assert $a == "123"
    assert $b == "255"
    assert $c == "11"
  case s[0..min(s.high, 1)]
  of "0x", "0X": initBigInt(s[2..s.high], base = 16)
  of "0b", "0B": initBigInt(s[2..s.high], base = 2)
  else: initBigInt(s)

M tests/test_bignum.nim => tests/test_bignum.nim +1 -1
@@ 1,7 1,7 @@
# SPDX-FileCopyrightText: ☭ Emery Hemingway
# SPDX-License-Identifier: Unlicense

import bigints, cbor, cbor/bignum
import pkg/bigints, cbor, cbor/bignum

import std/[streams, strutils, unittest]