Commit Graph

436 Commits

Author SHA1 Message Date
ringabout
2df633180a enable experimental:strictDefs (#24225) 2024-11-23 22:01:39 +01:00
ringabout
3aaaed1acf std/nre now uses destructors instead of finializer (#24353)
Similar to changes in
bafb4f119c
2024-10-23 20:52:30 +02:00
ringabout
95a7695810 documentation and comments use HTTPS when possible (#24264) 2024-10-08 21:50:35 +02:00
ringabout
4d11d0619d complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
2023-10-30 17:03:04 +01:00
ringabout
d66f3febd1 fixes #22868; fixes std/nre leaks under ARC/ORC (#22872)
fixes #22868
2023-10-27 07:32:10 +02:00
ringabout
3f7e1d7daa replace doAssert false with raiseAssert in lib, which works better with strictdefs (#22458) 2023-08-11 18:24:46 +02:00
ringabout
a345cde26e allow destructors to accept non var parameters; deprecate proc =destroy(x: var T) (#22130)
* make destructors accept non var parameters
* define nimAllowNonVarDestructor
* add a test case and a changelog
* update documentation and error messages
* deprecate destructors taking 'var T'
2023-06-21 08:51:03 +02:00
ringabout
ac5a36c0a4 re and nre now link to regex and tinyre (#21161) 2022-12-23 10:50:07 -05:00
ringabout
b8d200683a remove unused imports (#21126) 2022-12-17 20:44:30 +08:00
ringabout
9ba07edb2e build the documentation of official packages (#20986)
* remove db stuffs

* remove punycode

* remove

* fixes script

* add cloner

* patches

* disable

* patch

* fixes external packages

* disable two packages

* preview documentation build

* try again

* fixes URL

* fixes a bug

* simplify

* fixes documentaion

* fixes

* Apply suggestions from code review
2022-12-06 22:37:16 +08:00
jfilby
5a848a0707 Fix several memory leaks in the Postgres wrapper. (#20940) 2022-11-27 19:28:38 +01:00
ringabout
06cd15663d fixes ptr to cstring warnings[backport] (#20848)
* fix =#13790 ptr char (+friends) should not implicitly convert to cstring

* Apply suggestions from code review

* first round; compiles on windows

* nimPreviewSlimSystem

* conversion is unsafe, cast needed

* fixes more tests

* fixes asyncnet

* another try another error

* last one

* true

* one more

* why bugs didn't show at once

* add `nimPreviewCstringConversion` switch

* typo

* fixes ptr to cstring warnings[backport]

* add fixes

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
2022-11-16 10:22:51 +01:00
Andrey Makarov
3eef0491a8 fix a few "broken link" warnings (#20837) 2022-11-14 15:43:29 +08:00
ringabout
75ece74bdd fixes #20526; use nimPreviewSlimSystem for documentation build (#20714)
* fixes #20526; use `nimPreviewSlimSystem` for `koch docs`

* fixes documentation errors

* fixes remaning issues
2022-11-01 12:53:14 +01:00
ringabout
0a1f204f0f removes channels_builtin when enabling nimPreviewSlimSystem (#20713) 2022-10-31 16:56:05 +08:00
Andrey Makarov
19ff746916 Markdown code blocks migration part 7 (#20547) 2022-10-12 16:13:43 +02:00
ringabout
f56085f21e refactor dbFormat (#19746)
* refactor dbFormat

* add simple tests
2022-09-29 12:16:42 +02:00
ringabout
3d2f0e2c7c make more standard libraries work with nimPreviewSlimSystem (#20343)
* make more standard libraries work with `nimPreviewSlimSystem`

* typo

* part two

* Delete specutils.nim

* fixes more tests

* more fixes

* fixes tests

* fixes three more tests

* add formatfloat import

* fix

* last
2022-09-27 20:06:23 +02:00
Andrey Makarov
088487f652 Implement Markdown definition lists (+ migration) (#20333)
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.
2022-09-11 13:52:43 -04:00
Andrey Makarov
cde6b2aab8 Implement Pandoc Markdown concise link extension (#20304)
* 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
2022-09-04 14:52:21 -04:00
Andrey Makarov
0f555110e6 Markdown code blocks part 6 (#20292) 2022-08-31 19:39:02 -04:00
ee7
e8657c7107 make implicit cstring conversions explicit (#19488)
The Nim manual says that an implicit conversion to cstring will
eventually not be allowed [1]:

    A Nim `string` is implicitly convertible to `cstring` for convenience.

    [...]

    Even though the conversion is implicit, it is not *safe*: The garbage collector
    does not consider a `cstring` to be a root and may collect the underlying
    memory. For this reason, the implicit conversion will be removed in future
    releases of the Nim compiler. Certain idioms like conversion of a `const` string
    to `cstring` are safe and will remain to be allowed.

And from Nim 1.6.0, such a conversion triggers a warning [2]:

    A dangerous implicit conversion to `cstring` now triggers a `[CStringConv]` warning.
    This warning will become an error in future versions! Use an explicit conversion
    like `cstring(x)` in order to silence the warning.

However, some files in this repo produced such a warning. For example,
before this commit, compiling `parsejson.nim` would produce:

    /foo/Nim/lib/pure/parsejson.nim(221, 37) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]
    /foo/Nim/lib/pure/parsejson.nim(231, 39) Warning: implicit conversion to 'cstring' from a non-const location: my.buf; this will become a compile time error in the future [CStringConv]

This commit resolves the most visible `CStringConv` warnings, making the
cstring conversions explicit.

[1] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/doc/manual.md#cstring-type
[2] https://github.com/nim-lang/Nim/blob/d2318d9ccfe6/changelogs/changelog_1_6_0.md#type-system
2022-08-19 15:40:53 -04:00
ringabout
3bd935f331 fixes #20153; do not escape _ for mysql [backport] (#20164)
* fixes #20153; do not escape `_` for mysql

* add a test

* Update db_mysql.nim

* Update tdb_mysql.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2022-08-05 17:15:58 -04:00
flintforge
0ae44e562f fix typo in nre.nim (#19915)
Update nre.nim

typo in proc replace description
2022-06-21 09:53:46 +08:00
Andreas Rumpf
ee0a470294 Revert "fix db_sqlite.tryInsertID does raise exceptions in 1.6.0 #19743 (#19744)" (#19745)
This reverts commit b10f0e7bca.
2022-04-25 11:59:37 +02:00
flywind
b10f0e7bca fix db_sqlite.tryInsertID does raise exceptions in 1.6.0 #19743 (#19744) 2022-04-24 14:20:18 -04:00
flywind
98cebad7de enable style:usages for stdlib tests [backport: 1.6] (#19715)
* enable style:usages for stdlib tests

* freeAddrInfo

* more tests

* importc

* bufSize

* fix more

* => parseSql and renderSql
2022-04-13 11:53:02 +02:00
Araq
7b811deeff db_sqlite: added a space 2022-03-18 14:18:05 +01:00
Hamid Bluri
6454472938 fix not flushing stdout in MSYS (#19590)
I did this pull request according to what xflywind said: https://github.com/nim-lang/Nim/pull/19584#issuecomment-1060085141
2022-03-07 17:21:42 +08:00
flywind
ae92eac060 stylecheck usages part two: stdlib cleanup (#19338)
* stylecheck usages part two: stdlib cleanup

typeinfo.nim: importCompilerProc => importcompilerproc

nre.nim: newLineFlags => newlineFlags

system.nim: JSRoot => JsRoot

ref #19319

* prefer importCompilerProc
2022-01-08 21:34:22 +01:00
Carlo Capocasa
0ff4b2ba7e fix bug #14468 zero-width split (#19248) 2021-12-13 07:29:22 +01:00
Kaushal Modi
12d2901e89 libs/impore/re: Add note about the requirement of matches to be pre-allocated (#19081)
Add few runnableExamples for `findBounds` for clarity.

Fixes https://github.com/nim-lang/Nim/issues/18775
2021-11-02 09:12:54 +01:00
flywind
f559319a68 fix a sqlite bug (#18669) 2021-08-12 09:21:01 -07:00
flywind
9269a72f6f [nre]fix #17129 (#18632)
* fix #17129

* correct

* give reference implementaion links

* add comment

* typo

* I'm conservative

* change
2021-08-08 19:27:43 +02:00
Timothee Cour
c0abdaa2b4 improve runnableExamples and docs for std/nre (#18634)
* improve runnableExamples and docs for std/nre

* avoid too long lines in example
2021-08-02 22:22:47 -07:00
sivchari
980a9ed523 fix comment (#18473) 2021-07-11 02:19:20 -04:00
Timothee Cour
6387e28963 simplify rdstdin (#18382) 2021-06-28 13:09:14 -07:00
Andrey Makarov
969cb97c0a PCRE, nimgrep: add limit for buffer size (#18280) 2021-06-17 08:19:52 +02:00
flywind
6b97889f44 fix #9437(fix re.replace wrong behaviour) (#17546)
* fix nim js cmp fails at CT

* fix
2021-06-10 18:26:58 +02:00
Artem Klevtsov
3e57c2f780 Improve db_postgres iterators (#18144)
* Fix pqSetSingleRowMode case. Add links to the docs

* Add missing PGContextVisibility enum

* Remove unused PGContextVisibility enum

* Improve db_postgres iterators

* Fix instantRows with DbColumns. Cosmetics.

* Reduce copy&paste in db_postgres

* Move pqclear inside loop
2021-06-03 14:41:57 +02:00
flywind
c0e8199acc [std/re] fix findBounds and find procs (#18028)
* [std/re] make interface consistent

* tiny

* revert
2021-05-31 23:28:22 +02:00
Andrey Makarov
9f7e2e3057 docs: make inline markup more compatible with Markdown (#18053)
fixes https://github.com/timotheecour/Nim/issues/739
2021-05-21 06:54:20 +02:00
flywind
65f6b66820 Revert "[std/re]fix terrible and strange interface" (#18027)
This reverts commit c218f2ba0b.
2021-05-16 11:10:41 +08:00
flywind
c218f2ba0b [std/re]fix terrible and strange interface 2021-05-16 10:39:52 +08:00
Thomas T. Jarløv
99788ee504 Escape %00 / \0 in dbQuote (#18015) [backport:1.4]
Fix https://github.com/nim-lang/Nim/issues/17925
2021-05-15 21:26:15 +02:00
Fröhlich A
5439cfc317 Fix insert calling wrong function (#17856)
The `insert` method is calling `tryInsertID`, which ignores the `pkName` parameter.
Calling `tryInsert` instead should be correct.
2021-04-29 14:11:05 +02:00
Andrey Makarov
d97bf4f1c8 fix RST parsing when no indent after enum.item (fix #17249) (#17257) 2021-03-12 08:33:21 +01:00
Timothee Cour
dd6b0f81ef use -r:off for runnableExamples that should compile but not run (#17203)
* use -r:off for runnableExamples that should compile but not run

* use -r:off in other RT disabled tests
2021-03-01 14:26:39 +01:00
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
flywind
70ec17eede use single backtick (#17133) 2021-02-21 00:27:39 -08:00