summary refs log tree commit diff stats
path: root/lib/std
Commit message (Collapse)AuthorAgeFilesLines
* refactor cmpIgnoreStyle and cmpIgnoreCase (#16399)flywind2020-12-311-0/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * init * support strutils * more * better * Call len once per string/cstring * Change var to let * Compare ternary on first char * More appropriate param name * fix * better * one test * impl * more efficient * minor Co-authored-by: Clyybber <darkmine956@gmail.com>
* move asciitables to std/private/ (#16498)flywind2020-12-291-0/+83
| | | | | * move asciitables * minor
* use hexchar in stdlib (#16290)flywind2020-12-171-6/+19
|
* Adds toSet to create sets from iterables (#16276)Jason Beetham2020-12-141-0/+32
|
* Fix broken links in docs (#16336)Elliot Waite2020-12-142-7/+7
| | | | | * Fix broken links in docs * Fix rand HSlice links
* styleCheck: Fix error for `sugar` and `std/with` (#16176)ee72020-12-021-1/+1
| | | | | | | | | | | | | | | | With this commit, we no longer see an error if we pass `--styleCheck:error` when compiling a file that contains `import sugar` or `import std/with`. The problem was that those modules (and only those modules) import `std/private/underscored_calls`, which contained a styleCheck issue: its spelling of `nnkArgList` didn't match the `nnkArglist` spelling in `macros.nim`. This commit fixes the issue by renaming `nnkArgList` to `nnkArglist` repo-wide. The other way around would be a breaking change for code that used `nnkArglist` and `--styleCheck:error`. Fixes: #16174
* move decode_helpers to std/private (#16209)flywind2020-12-021-0/+22
|
* move rest of tests to testament (#16140)flywind2020-11-274-129/+0
| | | | * move rest of tests to testament * Update tests/stdlib/tsums.nim
* move tests to testament (#16101)flywind2020-11-243-48/+0
| | | | | | | | | * move tests to testament * minor * fix random * disable test random
* packedsets fix regression introduced in #15564 (#16060)Timothee Cour2020-11-201-8/+9
| | | | | * packedsets fix regression introduced in #15564 * add tests
* Improve enumerate (#16053)Antonis Geralis2020-11-201-10/+43
| | | | | | | * Improve enumerate * updates * add tests
* Do not read the whole file to compute SHA1 hash (fixes 15997) (#16006)Igor Ribeiro de Assis2020-11-181-1/+16
| | | | | | | | | | | | | | | | | * Do not read the whole file to compute SHA1 hash (fixes 15997) * Update lib/std/sha1.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update lib/std/sha1.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Directly break from loop Co-authored-by: Andreas Rumpf <rumpf_a@web.de> [backport:1.2] [backport:1.4]
* Make IntSet a generic ordinal set OrdSet[A] (#15564)landerlo2020-11-131-0/+607
| | | | | | | | | | | | | | * Make IntSet an ordinal set OrdSet[A: Ordinal] Backward compatibility with IntSet is maintained. IntSet is an alias for OrdSet[int] * move ordsets to new file, intsets exports it * ordset, move to lib/std folder * Fix `$` for ordsets and test cleanup * Fix ordsets compilation in doc example * Rename ordsets to packedsets
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* EnumUtils, speed up findStr in compiler (#15777)cooldome2020-11-031-0/+64
| | | | | | | | * add parseEnumRange * fix runnable example * update changelog * use parseEnumRange in compiler * reorganise code * add changelog, make single normalizer argument
* `ioutils` are moved to `fusion` (#15822)Miran2020-11-021-85/+0
|
* Fix doc comment for sumKbn (#15769)Antonis Geralis2020-10-291-1/+1
| | | Co-authored-by: b3liever <b3liever@yandex.com>
* Add C function dup and dup2 posix to system/io (#15675)Regis Caillaud2020-10-271-0/+85
| | | | | | | | | | | | | | | | | | | | | | | | | * * Add handle to dup and dup2 posix as duplicate and duplicateTo in std/ioutils. * Added small test & changelog entry * Fixed import in tioutils removed when isMainModule * * Nest test inside block. Rename proc var -> let in captureStdout * Renamed tmpfile to iotuils.txt * Added block: # duplicate, duplicateTo * Improved docstring * Clean non-idiomatic code * Added runnable examples * rm 2 trailing space in expected output * Made syntax prettier * Runnable example: file in getTempDir() * Tmp -> Temp * Fixed runnableExamples on windows
* implements https://github.com/nim-lang/RFCs/issues/258 (#15503)Andreas Rumpf2020-10-061-4/+39
| | | | | | | | | * implements https://github.com/nim-lang/RFCs/issues/258 * don't be too strict with custom pragma blocks * cast pragmas: documentation * added most missing inference query procs to effecttraits.nim
* Added std/effecttraits.nim (#15462)Andreas Rumpf2020-10-021-0/+19
|
* add `enumerate` macro (#15297)Miran2020-09-221-0/+56
| | | | | | | * add `enumerate` macro * address the comments * put `enumerate` in its own module
* Add some enhancements to `jsonutils.nim` (#15133)Ivan Bobev2020-09-091-31/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add some enhancements to `jsonutils.nim` * Use `jsonutils.nim` hookable API to add a possibility to deserialize JSON arrays directly to `HashSet` and `OrderedSet` types and respectively to serialize those types to JSON arrays. * Also add a possibility to deserialize JSON `null` objects to Nim option objects and respectively to serialize Nim option object to JSON object if some or to JSON `null` object if none. * Move serialization/deserialization functionality for `Table` and `OrderedTable` types from `jsonutils.nim` to `tables.nim` via the hookable API. * Add object `jsonutils.Joptions` and parameter from its type to `jsonutils.fromJson` procedure to control whether to allow deserializing JSON objects to Nim objects when the JSON has some extra or missing keys. * Add unit tests for the added functionalities to `tjsonutils.nim`. * improve fromJsonFields * Add changelog entry for the jsonutils enhancements * Add TODO in `jsonutils.nim` * Added an entry to "Future directions" section in `jsonutils.nim` as suggestion for future support of serialization and de-serialization of nested variant objects. * Added currently disabled test case in `tjsonutils.nim` for testing serialization and de-serialization of nested variant objects. * Move JSON hooks to `jsonutils.nim` Move `fromJsonHook` and `toJsonHook` procedures for different types to `jsonutils.nim` module to avoid a dependency of collections modules to the `json.nim` module. The hooks are removed from the following modules: * `tables.nim` * `sets.nim` * `options.nim` * `strtabs.nim` * Add some tests about `StringTableRef` Add tests for `StringTableRef`'s `fromJsonHook` and `toJsonHook` to `tjsonutils.nim`. * Disable a warning in `jsonutils.nim` Mark `fun` template in `jsonutils` module with `{.used.}` pragma in order to disable `[XDeclaredButNotUsed]` hint. The template is actually used by the `initCaseObject` macro in the same module. Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* std/with support field assign (#14484)slangmgh2020-08-152-13/+19
| | | | | | | | | | | | | | | | | | | | | * std/with support filed assign * add changelog * add support x.dup.with * add example * revert support x.dup.with; add example * update changelog; fix assignment in parameter * Update changelog.md * add example for assignment in parameter * Remove colon style assign Co-authored-by: Clyybber <darkmine956@gmail.com>
* 'isolate' builtin; refs https://github.com/nim-lang/RFCs/issues/244 (#15011)Andreas Rumpf2020-07-201-0/+31
|
* fix #14475; unittest.require now works with `nim c`; require and check now ↵Timothee Cour2020-07-141-0/+22
| | | | | | | | | | | | | works with -d:nodejs (#14676) * fix #14475; make unittest work with -d:nodejs * fixup * fixup * disable inim, delaunay which failed after unittest.require got fixed * re-enable tests that have been fixed
* fromJson: support object variants (#14694)Timothee Cour2020-06-241-15/+73
|
* CI: Install the pkg we cloned (#14770)Clyybber2020-06-241-32/+0
|
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-3/+3
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* `addQuitProc` now works with closures, and c, js(node/browser) backend; fix ↵Timothee Cour2020-06-161-0/+65
| | | | | | | | | | | | | | | some bugs in testament (#14342) * make addQuitProc great again * fix bugs in testament * fix test * change 2016 => 2020 * addQuitProc => addExitProc + locks * move to std/exitprocs
* make `fromJson/toJson` work with `array[range, typ]`, + 1 bugfix (#14669)Timothee Cour2020-06-151-8/+24
| | | | | * make toJson more robust * properly handle array
* Make the example better describe the desired outcome (#14611)Max Grender-Jones2020-06-081-5/+5
|
* optimized wrapWords; fixes #14579 (#14606) [backport:1.2]Andreas Rumpf2020-06-081-25/+48
|
* `toJson`, `jsonTo`, json (de)serialization for custom types; remove ↵Timothee Cour2020-06-081-0/+126
| | | | | | | | | | | | | | | | | | | | | dependency on strtabs thanks to a hooking mechanism (#14563) * json custom serialization; application for strtabs * serialize using nesting * make toJson more feature complete * add since * Revert "Improve JSON serialisation of strtabs (#14549)" This reverts commit 7cb4ef26addb3bb5ce2405d8396df6fd41664dae. * better approach via mixin * toJson, jsonTo * fix test * address comments * move to jsonutils * doc * cleanups * also test for js * also test for vm
* fix https://github.com/timotheecour/Nim/issues/266 retry on failure to avoid ↵Timothee Cour2020-06-021-0/+32
| | | | common 503 github errors (#14547)
* walkDirRecFilter, update doc CI filter, compiler/index.nim for docs + ↵Timothee Cour2020-06-011-0/+54
| | | | | | | | | | | various other fixes (#14501) * update doc CI filter to include the files mostly likely to require doc rebuild * remove code duplication in ./config/nimdoc.cfg; show link to compiler docs, various fixes * walkDirRecFilter, factor nativeToUnixPath workaround * glob for getRst2html * docslocal: 40s to build all docs * revert code dedup in github actions which did not work alas... * fixups
* fix CI doc windows: style error in lib/std/time_t.nim (#14523)Timothee Cour2020-05-311-2/+2
|
* `nim doc --backend:js`, `nim doc --doccmd:-d:foo`, `nim r --backend:js`, ↵Timothee Cour2020-05-111-0/+2
| | | | | | | | | | `--doccmd:skip` + other improvements (#14278) * `nim doc --backend:js|cpp...` `nim doc --doccmd:'-d:foo --threads:on'` `nim r --backend:cpp...` (implies --run --usenimcache) * --usenimcache works with all targets * --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
* fix js stacktraces, unify all file,line,col formatting into a single ↵Timothee Cour2020-05-051-0/+15
| | | | | function (#14230) * fix https://github.com/timotheecour/Nim/issues/135 ; unify all file,line,col formatting into a single function
* move since from inclrtl to std/private/since (#14188)hlaaftana2020-05-021-0/+19
| | | | * move since from inclrtl to std/private/since * move since import in system below for HCR
* Error -> Defect for defects (#13908)Jacek Sieka2020-04-281-1/+1
| | | | | | | | | | | | | | * Error -> Defect for defects The distinction between Error and Defect is subjective, context-dependent and somewhat arbitrary, so when looking at an exception, it's hard to guess what it is - this happens often when looking at a `raises` list _without_ opening the corresponding definition and digging through layers of inheritance. With the help of a little consistency in naming, it's at least possible to start disentangling the two error types and the standard lib can set a good example here.
* Make unused code into actual test, replace echo with doassert (#13952)Juan Carlos2020-04-111-33/+0
|
* std/byaddr => std/decls (#13847)Timothee Cour2020-04-031-0/+0
|
* renamed new std/pragmas.nim to std/byaddr.nim (#13844)Andreas Rumpf2020-04-021-5/+5
| | | | | * renamed new std/pragmas.nim to std/byaddr.nim * minor code cleanup
* DrNim (Nim compiler with Z3 integration) (#13743)Andreas Rumpf2020-03-311-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | * code cleanups and feature additions * added basic test and koch/CI integration * make it build on Unix * DrNim: now buildable on Unix, only takes 10 minutes, enjoy * added basic documentation for DrNim which can also be seen as the RFC we're following * drnim: change the build setup so that drnim.exe ends up in bin/ * makes simple floating point ranges work * added basic float range check * drnim: teach Z3 about Nim's range types plus code refactoring * drnim: make unsigned numbers work * added and fixed index checking under setLen * first implementation of .ensures, .invariant and .assume (.requires still missing and so is proc type compatibility checking * drnim: .requires checking implemented * drnim: implemented .ensures properly * more impressive test involving min() * drnim: check for proc type compatibility and base method compatibility wrt .requires and .ensures * testament: support for 'pattern <directory> * koch: uses new <directory> feature of testament * drnim: added tiny musings about 'old' * Make testament work with old SSL versions * koch: add support for 'koch drnim -d:release' * drnim: preparations for the param.old notation
* Add Documentation (#13811)Juan Carlos2020-03-312-1/+11
| | | | * Add more Docs and runnableExamples
* stacktraces can now show custom runtime msgs per frame (#13351)Timothee Cour2020-03-301-0/+30
| | | | | | | | * stacktraces can now show custom runtime msgs * improve tests/stdlib/tstackframes.nim * fix test for --gc:arc * test --stacktraceMsgs:on and --stacktraceMsgs:off * --stacktracemsgs:off by default
* new syntax for lvalue references: `var b {.byaddr.} = expr` (#13508)Timothee Cour2020-03-231-0/+19
| | | | | | | | * new syntax for lvalue references: `var b {.byaddr.} = expr` * on type mismatch, `???(0, 0)` not shown anymore * * compiler now lowers `var a: {.foo.}: MyType = expr` to foo(a, MyType, expr) * new pragmas.byaddr defined in pure library code exploiting this lowering * skip `template foo() {.pragma.}`
* fixes a bug for 'dup' and 'with'; they can now handle nested statement lists ↵Araq2020-03-172-17/+21
| | | | that can result from macros
* std/compilesettings implementation (#13584)Andreas Rumpf2020-03-041-0/+54
| | | | | | | | * Implement compileSetting() and compileSettingSeq() * Change from magic to vmop * better design for querySetting Co-authored-by: genotrance <dev@genotrance.com>
* added operateOn to sugar.nim to give Nim the chaining mechanism it de… ↵Andreas Rumpf2020-02-262-0/+96
| | | | | | | | (#13092) * implemented the with stdlib module as specified in https://github.com/nim-lang/RFCs/issues/193 * change sugar.outplace to sugar.dup according to https://github.com/nim-lang/RFCs/issues/193 * changelog update