Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View RedBeard0531's full-sized avatar

Mathias Stearn RedBeard0531

View GitHub Profile
@RedBeard0531
RedBeard0531 / nimsuggest.vim
Created January 10, 2018 22:04
Terrible implementation of nimsuggest integration with zah/nim.vim
" :source this file in your "main" nim file to activate.
" You can run :source again to switch main file or when nimsuggest crashes.
" You can also :call nimsuggest#run('use') to see all uses of the thing your
" cursor is on.
"call system("killall nimsuggest")
let nimsuggest_job = job_start(["nimsuggest", "--stdin", "--v2", "--debug", "--log", expand("%")], {
\ "in_mode" : "nl",
\ "out_mode" : "nl",
\ "err_io": "out",
# nim check -d=nimDumpAsync input.nim
proc foo(): Future[void] =
var retFuture259001 = newFuture[void]("foo")
iterator fooIter259002(): FutureBase {.closure.} =
echo "before await"
var future259003 = newFuture[void]()
yield future259003
if future259003.failed:
setCurrentException(future259003.error)
if future259003.error of Exception:
## HHSet is a Heterogeneous Hash Set - It allows O(1) lookup of values by any compatible type.
{.experimental.}
import hashes, future, typetraits, strformat
type
Node[T] = object
val: T
used: bool # TODO make this the sign bit of the hash
hash: uint32
- NimMainModule ▒
- 44.56% map_wNkS61EZxqfZ3s7xzzENJwnimja ▒
build_S9bfnmOlkodgKqPC69c4676Q ▒
buildImpl_mt26Sf88tl8OLKmb9aB8MQw ▒
cb0_KFc3HTUxwefrUY1Q3djQCQ_2
build/ninja_nimja/mongo/db/db.os: src/mongo/db/db.cpp \
src/mongo/platform/basic.h src/mongo/db/dbmain.h \
src/third_party/boost-1.60.0/boost/filesystem/operations.hpp \
src/third_party/boost-1.60.0/boost/config.hpp \
src/third_party/boost-1.60.0/boost/config/user.hpp \
src/third_party/boost-1.60.0/boost/config/select_compiler_config.hpp \
src/third_party/boost-1.60.0/boost/config/compiler/gcc.hpp \
src/third_party/boost-1.60.0/boost/config/select_stdlib_config.hpp \
src/third_party/boost-1.60.0/boost/config/stdlib/libstdcpp3.hpp \
src/third_party/boost-1.60.0/boost/config/select_platform_config.hpp \
when defined(useSSE42):
import x86_simd/x86_sse42
import x86_simd/x86_sse41
import x86_simd/x86_sse2
import bitops
let prStr = "azAZ09\x80\xFF\0 " # padded to hold at least 16 bytes.
let pcStr = "+,/_:.~()}{@=!-\0 "
let plain_ranges = loadu_si128(cast[ptr m128i](unsafeAddr prStr[0]))
let plain_chars = loadu_si128(cast[ptr m128i](unsafeAddr pcStr[0]))
import asyncdispatch
proc unwrap[T](outer: Future[Future[T]]): Future[T] =
result = newFuture[T]()
let res = result
outer.addCallback do:
# TODO try/catch to handle errors
outer.read().addCallback do (inner: Future[T]):
res.complete(inner.read())
# This is based on ninja's depfile_parser.in.cc
const
plain = {'a'..'z', 'A'..'Z', '0'..'9', '+', ',', '/', '_', ':', '.', '~',
'(', ')', '}', '{', '@', '=', '!', '-', '\x80'..'\xFF'}
escaped = {' ', '\\', '#', '*', '[', '|'} # \c -> c
notEscaped = {'\0', '\c', '\L'} # swallow the \ and handle c normally
type Deps* = object
output*: string
inputs*: seq[string]
import tables
import critbits
import os
import sequtils
import times
import random
import xxhash
#import murmur
import murmur3
import hashes