summary refs log tree commit diff stats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* fix #18128 rfind on empty needle returns rightmost index (#20430)n5m2022-09-261-1/+2
| | | rfind on empty needle returns haystack len
* Optimize `base64.encodeMime` (#20409)Amjad Ben Hedhili2022-09-251-6/+20
| | | | | | | | | * Optimize `base64.encodeMime` * 5x faster for common scenarios, 13x faster if `lineLen` <= encoded string's length or `newLine` is empty. * Changed `lineLen`'s type to `Positive` to disallow `0`. * Fix
* defaults to ORC (#19972)ringabout2022-09-231-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * defaults to Orc * bootstrap using refc * use gc * init orc defines * unregister orc * fix gc * fix commands * add prepareMutation for orc * enable deepcopy for orc * prepareMutation * more fixes * some cases * bug #20081 * partial fixes * partial fixes * fixes command line * more fixes * build Nim with refc * use gc * more fixes * rstore * orc doesn't support threadpool * more shallowCopy * more fixes * fixes unsafeNew * workarounds * small * more fixes * fixes some megatest * tcodegenbugs1 refc * fxies megatest * build nimble with refc * workaround tensordsl tests * replace shallowCopy with move * fixes action * workaround * add todo * fixes important packages * unpublic unregisterArcOrc * fixes cpp * enable windows Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
* fixes #20285; prevent oid time overflow at year 2038 (#20338)ringabout2022-09-221-25/+14
| | | | | | | | | | | | | | | * Revert "fixes #20285; prevent oid time overflow at year 2038" This reverts commit dfcdb6ec2ab6a5fa53b6a99294a84fd122be8f8d. * increase time to 64 bits and clean up * add testcase * inline consts * add a changelog * fixes #20285; prevent oid time overflow at year 2038
* Extract markdown/rst doc into separate file (#20404)Andrey Makarov2022-09-221-221/+8
| | | | | | | | | | | * Extract Markdown & Rst doc into separate file This documentation should be extracted into separate file as it's user's documentation, which can be used as a separate utility for compiling `.md/.rst` files. * Restructure: move markup info into markdown_rst.md +Markdown link migration
* contentLength default to -1 if not present (#19835)Bung2022-09-211-2/+2
| | | | | * contentLength default to -1 if not present * `httpclient.contentLength` changelog
* RFC-460 implemented (#19771)Juan Carlos2022-09-212-0/+32
| | | | | | | | | * RFC-460 implemented * RFC-460 implemented * RFC-460 implemented * Fix dumb GitHub autoupdate on changelog
* turn nimIncrSeqV3 into deadcode (#20388)ringabout2022-09-202-91/+47
|
* Add missing proc to dom (#20378)Juan Carlos2022-09-191-0/+57
| | | | | | | | | * Add missing proc from dom * Add missing proc from dom * Add missing proc from dom Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Add missing symbols to regex (#20383)Juan Carlos2022-09-191-0/+1
| | | | | * Add missing attribute to jsre * Add missing attribute to jsre
* Recommend `mapIt` in some cases (#20347)Amjad Ben Hedhili2022-09-191-6/+4
| | | | | * Recommend `mapIt` in some cases * Remove runnableExample
* fixes Thread initializer for ARC/ORC on Macos (#20368)ringabout2022-09-161-1/+1
| | | | | | | | | * fixes Thread initializer for ARC/ORC * another try * fix * use int
* add docs to copyNimNode and copyNimTree (#20357)ringabout2022-09-161-2/+25
| | | | | | | | | * add docs to copyNimNode and copyNimTree * Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #19104; peg Incorrect captures [backport:1.6] (#20352)ringabout2022-09-151-1/+4
| | | | | | | * fixes #19104; peg Incorrect captures [backport:1.6] * add tests Co-authored-by: khchen <khchen@gmail.com>
* partial revert and redesign of #19814, changelog (#20341)metagn2022-09-142-5/+32
| | | | | | | | | | | | | | | * conservative partial revert of #19814 * fix * revert tssl * revert azure CI change * keep azure, revert version range * fully revert CI, add changelog * useOpenssl3 as separate define, .3 is a version
* Revert "add `fromChar`" (#20336)ringabout2022-09-121-9/+0
| | | | | Revert "add `fromChar` (#20332)" This reverts commit 846cc746a2350ad3f845a4eb0ce97b864891cd35.
* Revert "fixes #20155; repr range with distinct types is broken with ORC" ↵Clay Sweetser2022-09-111-6/+1
| | | | | | | (#20334) Revert "fixes #20155; repr range with distinct types is broken with ORC (#20158)" This reverts commit 37b3f62eef16b0e7cb89e18f9ddc1fb96e17fb1b.
* fixes #20155; repr range with distinct types is broken with ORC (#20158)ringabout2022-09-111-1/+6
| | | | | * fixes #20155; repr range with distinct types is broken with ORC * skipRanges
* Fix cannot create Windows directory in root (#20311)havardjohn2022-09-111-19/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Fix cannot create Windows directory in root Fixes #20306, a regression bug with `createDir` caused by `23e0160af283bb0bb573a86145e6c1c792780d49`. The issue is that, if the path consists only of a drive and a single directory (e.g. "Y:\nimcache2" in the original issue), then no directories will be created. This works fine if there are multiple directories (e.g. "Y:\nimcache2\test"). In the case of "Y:\nimcache2", `omitNext` in `createDir` is `false` on the last condition in `createDir`. This means that the "nimcache2" directory will not be created, and no exception will be raised. Fixed by refactoring to use `parentDirs` iterator instead of iterating over the string characters. Motivation is reduced code complexity. Will not test the specific "C:\test" `createDir` case, since there is no standard Windows drive with write permissions in the root. Creating a custom drive-mapping to Windows Temp is a non-option. That could mess up some users running the test. Added `parentDirs` tests since they are lacking on for POSIX paths. * Fix `createDir("")` causing error The change to `createDir` caused `createDir("")` to raise an error, where it previously didn't. Fixed so `createDir("")` does not fail, and added test case.
* Implement Markdown definition lists (+ migration) (#20333)Andrey Makarov2022-09-117-29/+113
| | | | | | | | | | | | | | | Implements definition lists Markdown extension adopted in a few implementations including: * [Pandoc]( https://pandoc.org/MANUAL.html#definition-lists) * [kramdown]( https://kramdown.gettalong.org/quickref.html#definition-lists) * [PHP extra Markdown]( https://michelf.ca/projects/php-markdown/extra/#def-list) Also affected files have been migrated. RST definition lists are turned off for Markdown: this solves the problem of broken formatting mentioned in https://github.com/nim-lang/Nim/pull/20292.
* add `fromChar` (#20332)Hamid Bluri2022-09-111-0/+9
| | | `fromChar` converts `char` to `SomeInteger`, related to `isDigit`
* SSL: Allow the same range of versions for OSX (#20324)Andreas Rumpf2022-09-101-5/+1
|
* Markdown links migration part 1 (#20319)Andrey Makarov2022-09-091-3/+3
| | | | | | | | | | | | | Markdown link migration part 1 Also the warning is improved a bit. Local links (targeting inside its document) which had had a full anchor were turned into concise form. The very fact that they existed may be due to the bug in reference to subsections fixed https://github.com/nim-lang/Nim/pull/20279, now they are working well (both in RST syntax and new Pandoc Markdown syntax implemented in https://github.com/nim-lang/Nim/pull/20304)
* Revert "clarify that `char` may not be unsigned" (#20320)ringabout2022-09-081-1/+1
| | | | | Revert "clarify that `char` may not be unsigned (#20308)" This reverts commit f433d9cccf1a05da1a24e9fed9b914b7a2a35945.
* clarify that `char` may not be unsigned (#20308)ringabout2022-09-061-1/+1
|
* give a deprecate warning when using `newPar` to construct tuple expressions ↵ringabout2022-09-062-3/+8
| | | | | | | | | (#20312) * error/deprecate when using `newPar` to construct tuple expressions * Update lib/core/macros.nim * fixes
* fixes #9462; jsondoc --index can generate a theindex.json (#20205)ringabout2022-09-061-9/+8
|
* Implement Pandoc Markdown concise link extension (#20304)Andrey Makarov2022-09-0411-51/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Implement Pandoc Markdown concise link extension This implements https://github.com/nim-lang/Nim/issues/20127. Besides reference to headings we also support doing references to Nim symbols inside Nim modules. Markdown: ``` Some heading ------------ Ref. [Some heading]. ``` Nim: ``` proc someFunction*() ... ... ## Ref. [someFunction] ``` This is substitution for RST syntax like `` `target`_ ``. All 3 syntax variants of extension from Pandoc Markdown are supported: `[target]`, `[target][]`, `[description][target]`. This PR also fixes clashes in existing files, particularly conflicts with RST footnote feature, which does not work with this PR (but there is a plan to adopt a popular [Markdown footnote extension](https://pandoc.org/MANUAL.html#footnotes) to make footnotes work). Also the PR fixes a bug that Markdown links did not work when `[...]` section had a line break. The implementation is straightforward since link resolution did not change w.r.t. RST implementation, it's almost only about new syntax addition. The only essential difference is a possibility to add a custom link description: form `[description][target]` which does not have an RST equivalent. * fix nim 1.0 gotcha
* Add improved Windows UNC path support in std/os (#20281)havardjohn2022-09-033-47/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add improved Windows UNC path support in std/os Original issue: `std/os.createDir` tries to create every component of the given path as a directory. The problem is that `createDir` interprets every backslash/slash as a path separator. For a UNC path this is incorrect. E.g. one UNC form is `\\Server\Volume\Path`. It's an error to create the `\\Server` directory, as well as creating `\\Server\Volume`. Add `ntpath.nim` module with `splitDrive` proc. This implements UNC path parsing as implemented in the Python `ntpath.py` module. The following UNC forms are supported: * `\\Server\Volume\Path` * `\\?\Volume\Path` * `\\?\UNC\Server\Volume\Path` Improves support for UNC paths in various procs in `std/os`: --- * pathnorm.addNormalizePath * Issue: This had incomplete support for UNC paths * The UNC prefix (first 2 characters of a UNC path) was assumed to be exactly `\\`, but it can be `//` and `\/`, etc. as well * Also, the UNC prefix must be normalized to the `dirSep` argument of `addNormalizePath` * Resolution: Changed to account for different UNC prefixes, and normalizing the prefixes according to `dirSep` * Affected procs that get tests: `relativePath`, `joinPath` * Issue: The server/volume part of UNC paths can be stripped when normalizing `..` path components * This error should be negligable, so ignoring this * splitPath * Now make sure the UNC drive is not split; return the UNC drive as `head` if the UNC drive is the only component of the path * Consequently fixes `extractFilename`, `lastPathPart` * parentDir / `/../` * Strip away drive before working on the path, prepending the drive after all work is done - prevents stripping UNC components * Return empty string if drive component is the only component; this is the behavior for POSIX paths as well * Alternative implementation: Just call something like `pathnorm.normalizePath(path & "/..")` for the whole proc - maybe too big of a change * tailDir * If drive is present in path, just split that from path and return path * parentDirs iterator * Uses `parentDir` for going backwards * When going forwards, first `splitDrive`, yield the drive field, and then iterate over path field as normal * splitFile * Make sure path parsing stops at end of drive component * createDir * Fixed by skipping drive part before creating directories * Alternative implementation: use `parentDirs` iterator instead of iterating over characters * Consequence is that it will try to create the root directory * isRootDir * Changed to treat UNC drive alone as root (e.g. "//?/c:" is root) * This change prevents the empty string being yielded by the `parentDirs` iterator with `fromRoot = false` * Internal `sameRoot` * The "root" refers to the drive, so `splitDrive` can be used here This adds UNC path support to all procs that could use it in std/os. I don't think any more work has to be done to support UNC paths. For the future, I believe the path handling code can be refactored due to duplicate code. There are multiple ways of manipulating paths, such as manually searching string for path separator and also having a path normalizer (pathnorm.nim). If all path manipulation used `pathnorm.nim`, and path component splitting used `parentDirs` iterator, then a lot of code could be removed. Tests --- Added test file for `pathnorm.nim` and `ntpath.nim`. `pathnorm.normalizePath` has no tests, so I'm adding a few unit tests. `ntpath.nim` contains tests copied from Python's test suite. Added integration tests to `tos.nim` that tests UNC paths. Removed incorrect `relativePath` runnableExamples from being tested on Windows: --- `relativePath("/Users///me/bar//z.nim", "//Users/", '/') == "me/bar/z.nim"` This is incorrect on Windows because the `/` and `//` are not the same root. `/` (or `\`) is expanded to the drive in the current working directory (e.g. `C:\`). `//` (or `\\`), however, are the first two characters of a UNC path. The following holds true for normal Windows installations: * `dirExists("/Users") != dirExists("//Users")` * `dirExists("\\Users") != dirExists("\\\\Users")` Fixes #19103 Questions: --- * Should the `splitDrive` proc be in `os.nim` instead with copyright notice above the proc? * Is it fine to put most of the new tests into the `runnableExamples` section of the procs in std/os? * [skipci] Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * [skip ci] Update lib/pure/os.nim Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Move runnableExamples tests in os.nim to tos.nim * tests/topt_no_cursor: Change from using splitFile to splitDrive `splitFile` can no longer be used in the test, because it generates different ARC code on Windows and Linux. This replaces `splitFile` with `splitDrive`, because it generates same ARC code on Windows and Linux, and returns a tuple. I assume the test wants a proc that returns a tuple. * Drop copyright attribute to Python Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-032-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | * remove deprecated pragma syntax from 0.20.0 closes #4651, closes #16653 with a cheap fix for now due to how early `tfFinal` is set * remove type pragma between name and generics * undo removal, try removing bind expression (0.8.14) * fix test, unremove bind expr * remove again * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * dependencies @ HEAD & weave test dependencies * try fix package ci Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Revert "fix #19600 No error checking on fclose (#19836)" (#20297)ringabout2022-09-021-4/+2
| | | This reverts commit 04e4a5ec0e35fc7e1c346c2d002e8487b4b48cb5.
* support cstring in `case` (#20130)metagn2022-09-011-0/+23
| | | | | | | | | | | | | | | * implement case for cstring for now just converts to string on C backend * custom implementation for cstring * remove leftover * revert even more * add nil + fix packages weird variant literal bug * update docs
* Simpler complex division implementation (#20088)Dan Rose2022-09-011-12/+1
|
* Markdown code blocks part 6 (#20292)Andrey Makarov2022-08-313-345/+356
|
* fix #19600 No error checking on fclose (#19836)Bung2022-08-291-2/+4
| | | | | * fix #19600 No error checking on fclose * add IOError to open
* Implement complex sgn (#20087)Dan Rose2022-08-281-0/+7
| | | Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* fixes #17658; add cert dir for ssl ctx (#19920)ringabout2022-08-282-1/+11
| | | | | | | add cert dir for ssl ctx Co-authored-by: Paul Roberts <pmr@stelo.org.uk> Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com> Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Fix auto links to subheader when TOC is present (#20279)Andrey Makarov2022-08-272-91/+97
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix links to subheader when TOC is present It was observed (in https://github.com/nim-lang/Nim/pull/20112) that links to 2nd- (and subsequent) -level headings fail if TOC is present, e.g.: ```nim .. contents:: Type relations ============== Convertible relation -------------------- Ref. `Convertible relation`_ ``` The problem here is that links are resolved in `rst.nim` but later `rstgen.nim` fixes ("fixes") anchors to make them unique so that TOC always works (if e.g. there was another sub-section like "Convertible relation"). The solution implemented in this PR is to move that fix-up of anchors into `rst.nim`, so that link resolution could know final anchors. The bug seems to be added in https://github.com/nim-lang/Nim/pull/2332 in 2015, that is it is present in Nim 1.0.
* Add missing rand(var Rand, Ordinal) overload (#20124)Antonis Geralis2022-08-261-14/+32
| | | | | | | | | | | * Add missing rand(var Rand, Ordinal) overload * Corrected mistake, thanks @metagn Co-authored-by: metagn <metagngn@gmail.com> * Update random.nim Co-authored-by: metagn <metagngn@gmail.com>
* remove `var` for ref parameters in `std/tables` (#20175)ringabout2022-08-251-2/+2
| | | remove `var` from ref parameters; make it consistent
* std/options enables stricteffects (#19441)ringabout2022-08-251-4/+8
|
* move formatfloat out of system (#20195)ringabout2022-08-2411-164/+184
| | | | | | | | | | | | | | | * move formatfloat out of system * fixes doc * Update changelog.md * careless * fixes * deprecate system/formatfloat * better handling
* fixes nimPreviewSlimSystem; register echoBinSafe for nimPreviewSlimSystem ↵ringabout2022-08-241-0/+2
| | | | | | | (#20194) * register echoBinSafe * add output
* test removing dollar for objects out of system (#20242)metagn2022-08-244-40/+59
| | | | | | | | | | | * test removing dollar for objects out of system * test & fixes * fix bootstrap * use nimPreviewSlimSystem, test stdlib category * fix test
* top-down type inference, implements rfc 149 (#20091)metagn2022-08-242-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * micro implementation of rfc 149 refs https://github.com/nim-lang/RFCs/issues/149 * number/array/seq literals, more statements * try fix number literal alias issue * renew expectedType with if/case/try branch types * fix (nerf) index type handling and float typed int * use typeAllowed * tweaks + const test (tested locally) [skip ci] * fill out more of the checklist * more literals, change @ order, type conversions Not copying the full call tree before the typedesc call check in `semIndirectOp` is also a small performance improvement. * disable self-conversion warning * revert type conversions (maybe separate op later) * deal with CI for now (seems unrelated), try enums * workaround CI different way * proper fix * again * see sizes * lol * overload selection, simplify int literal -> float * range, new @ solution, try use fitNode for nil * use new magic * try fix ranges, new magic, deal with #20193 * add documentation, support templates Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Add OpenSSL 3 support (#19814)Federico Ceratto2022-08-232-115/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Minor refactor * Add OpenSSL 3 support Remove symbols noOpenSSLHacksq and openssl10 * Drop loading of older openssl versions * Add library path * Use only versioned libssl soname os OSX * Update .github/workflows/ci_packages.yml Co-authored-by: Hein Thant <official.heinthanth@gmail.com> * On Mac OS X CI, link OpenSSL in /usr/local/lib/ * Install OpenSSL on Mac OS X on azure pipeline * Remove DYLD_LIBRARY_PATH Co-authored-by: Hein Thant <official.heinthanth@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Hein Thant <official.heinthanth@gmail.com>
* new .redefine pragma for templates, warn on redefinition without it (#20211)metagn2022-08-233-15/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test CI for template redefinitions * adapt asyncmacro * fix quote * fix again * try something else * revert * fix ioselectors_select, disable packages CI * adapt more tests & simplify * more * more * more * rename to redefine, warn on implicit redefinition * basic documentation [skip ci] * Update compiler/lineinfos.nim Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* Add `doctype: RST|Markdown|RstMarkdown` pragma (#20252)Andrey Makarov2022-08-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | * Add `doctype: RST|Markdown|RstMarkdown` pragma Implements https://github.com/nim-lang/RFCs/issues/68 , see also discussion in https://github.com/nim-lang/Nim/issues/17987 The permitted values: * `markdown`, which is default. It still contains nearly all of the RST supported but it is assumed that in time we will give up most or all RST features in this mode * `rst`, without any extensions * `RstMarkdown` — compatibility with Nim 1.x. It's basically RST with those Markdown features enabled that don't conflict with RST. * Apply suggestions from code review Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com> * Additional fix in spirit of review * Fix test after #20188 Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* remove some deprecated pre-1.0 stdlib modules (#20202)metagn2022-08-239-879/+12
| | | | | | | | | | | | | | | * remove pre-1.0 stdlib deprecations notable exceptions: * ze, toU8 etc in system/arithmetics * potentially callsite * undo macros, ospaths, securehash, oswalkdir * add sets back * add back future, document deprecated versions * add to changelog [skip ci]
* fixes #19973; switch to poll on posix (#20212)ringabout2022-08-231-11/+28
| | | | | | | | | | | | | | | | | * fixes #19973; switch to poll on posix * it is fd * exclude lwip * fixes lwip * rename select to timeoutRead * refactor into timeoutRead/timeoutWrite * refactor common parts Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>