Commit Graph

882 Commits

Author SHA1 Message Date
ringabout
c08c455016 Revert "enable nimPreviewDotLikeOps" (#19919)
* Revert "enable nimPreviewDotLikeOps (#19598)"

This reverts commit 6773ffa63d.

* add deprecated message

Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
2022-08-03 22:39:14 +08:00
Andrey Makarov
40e0048a50 Highlight Nim default in Markdown code in .nim (#20110)
Highlight Nim by default in Markdown code in .nim
2022-07-31 15:38:00 +02:00
ringabout
1c39af3389 fixes #20089; remove setPointer since strings/seqs are not pointers with ORC (#20090)
fixes #20089; remove setPointer since strings/seqs are not pointers anymore
2022-07-26 16:48:01 +02:00
Andrey Makarov
62b81d7f10 Markdown code blocks part 2; migrate Nim Manual (#20080)
* Change headings underscored by `~~~` to `###`

* Markdown code blocks part 2; migrate Nim Manual
2022-07-25 18:29:52 +02:00
flywind
01ad0cdc52 defines the gcRefc symbol which allows writing specific code for refc (#20009)
* define gcRefc symbols

* add comments

* add a changelog item

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update changelog.md

Co-authored-by: Yardanico <tiberiumk12@gmail.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Co-authored-by: Yardanico <tiberiumk12@gmail.com>
2022-07-17 09:24:40 +02:00
Andrey Makarov
417b90a7e5 Improve Markdown code blocks & start moving docs to Markdown style (#19954)
- add additional parameters parsing (other implementations will just
  ignore them). E.g. if in RST we have:

  .. code:: nim
     :test: "nim c $1"

     ...

  then in Markdown that will be:

  ```nim test="nim c $1"
  ...
  ```

- implement Markdown interpretation of additional indentation which is
  less than 4 spaces (>=4 spaces is a code block but it's not
implemented yet). RST interpretes it as quoted block, for Markdown it's
just normal paragraphs.
- add separate `md2html` and `md2tex` commands. This is to separate
  Markdown behavior in cases when it diverges w.r.t. RST significantly —
most conspicously like in the case of additional indentation above, and
also currently the contradicting inline rule of Markdown is also turned
on only in `md2html` and `md2tex`. **Rationale:** mixing Markdown and
RST arbitrarily is a way to nowhere, we need to provide a way to fix the
particular behavior. Note that still all commands have **both** Markdown
and RST features **enabled**. In this PR `*.nim` files can be processed
only in Markdown mode, while `md2html` is for `*.md` files and
`rst2html` for `*.rst` files.
- rename `*.rst` files to `.*md` as our current default behavior is
  already Markdown-ish
- convert code blocks in `docgen.rst` to Markdown style as an example.
  Other code blocks will be converted in the follow-up PRs
- fix indentation inside Markdown code blocks — additional indentation
  is preserved there
- allow more than 3 backticks open/close blocks (tildas \~ are still not
  allowed to avoid conflict with RST adornment headings) see also
https://github.com/nim-lang/RFCs/issues/355
- better error messages
- (other) fix a bug that admonitions cannot be used in sandbox mode; fix
  annoying warning on line 2711
2022-07-15 19:27:54 +02:00
flywind
286fcef68e [Orc] fixes "streams.readDataStr segafaults" when accepting a string literal (#20019) [backport]
fixes streams.readDataStr accept a string literal
2022-07-15 09:42:54 +02:00
flywind
430a179307 default threads on (#19368)
* default threads on

* make rst gcsafe

* ignore threads option for nimscript

* threads off

* use createShared for threads

* test without threads

* avr threds off

* avr threads off

* async threads off

* threads off

* fix ci

* restore option

* make CI pleased

* fix ic tests

* Update config.nims

* add changelog

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-07-06 13:06:41 +02:00
Daniel Clarke
01b40dc1d7 Fixes return values of execCmd on macos (#19963)
* Fixes return values of execCmd on macos

* update tests to use existing structure

Co-authored-by: daniel <danielclarke@wearepopgun.com>
2022-07-05 22:29:05 +02:00
Zoom
b024a45163 Fix find routines' api to default to last=-1 (#19761)
This changes the default for the `last` parameter of various `find`
routines from `0` to `-1`. Previous default prevents limiting the search
to the first character. This is a logic error, as full text search was
performed for 2 *valid* values of `last`: `0` and `last.high()`.

Adds an overload for `initSkipTable` which returns a newly initialized
table. This encapsulates every single usage of a `var`-acting original
func in this module.

Co-authored-by: flywind <xzsflywind@gmail.com>
2022-06-07 10:35:06 +02:00
Andrey Makarov
4341b06f65 RST: improve simple tables (#19859)
* RST: improve simple tables

* nim 1.0 gotchas

* Still allow legacy boundaries like `----`
2022-06-04 07:03:03 +02:00
Alfred Morgan
15f0b48676 Zectbumo fixes 19824 (#19825)
* borrowed `$` to make Time string friendly

* added sep character parameter

* Revert "added sep character parameter"

This reverts commit 45f4b019a4.

* added sep character parameter

* Revert "borrowed `$` to make Time string friendly"

This reverts commit 10e2e44c9a.

* added uri tests and made changelong entry

* Update lib/pure/uri.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update lib/pure/uri.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update tests/stdlib/turi.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

* Update tests/stdlib/turi.nim

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-05-30 12:09:18 +02:00
kraptor
2c73e84436 "ip" protocol as id 0 is long gone (#19760)
IANA is using id 0 for "HOPOPT" instead of "ip"
for some time now and those systems that still
support the old mapping will stop doing so at
some point in the future.

Some BSDs and openSUSE are already following this
change as per IANA list here:
https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

As new unixes (and maybe Windows, who knows) start
to adopt the updated IANA list, this will keep
failing from time to time, so it's better to
remove the "ip" check altogether.
2022-05-07 20:46:45 +02:00
Danil Yarantsev
2f32b450d3 Really fix StringStream with ARC at compile-time, improve streams test (#19739)
* Fix compile-time StringStream with ARC

* make readDataStr work with ARC, improve test
2022-04-25 11:15:03 +02:00
Jason Beetham
dc4cc2dca5 Fix string stream crashing when created on nimscript due to last fix (#19717) 2022-04-14 11:30:59 +02: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
Jason Beetham
26acc97864 StringStreams no longer errors when intialized with literals on arc/orc (#19708) 2022-04-11 14:27:12 +02:00
Timothee Cour
e78ef57c93 typetraits: add toSigned, toUnsigned (#18445)
* typetraits: add toSigned, toUnsigned

* improve and add tests

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: flywind <xzsflywind@gmail.com>
2022-04-07 17:38:01 -04:00
Juan Carlos
7a50d66346 Removed deprecated httpcore func (#19550)
* Remove Deprecated httpcore func

* Remove Deprecated httpcore func

* Fix a test with Deprecated func

* Restart CI, Apple can code shit anymore I tell you
2022-03-18 07:54:20 +01:00
flywind
6773ffa63d enable nimPreviewDotLikeOps (#19598) 2022-03-09 12:55:20 +01:00
flywind
8f9dd5b349 register callback for marshal in VM (#19578)
* register callback for marshal in VM

* remove unrelated code

* polish

* more tests

* more tests

* add loadVM and toVM
2022-03-08 18:12:31 +01:00
Juan Carlos
8e8231f9d6 Remove deprecated math.c_frexp (#19518)
* Remove Deprecated math proc

* Remove Deprecated math proc

* Remove Deprecated math proc
2022-02-14 14:35:33 +01:00
David Krause
cda77c1520 use OrderedTable instead of OrderedTableRef for mimedb (#19522)
* use OrderedTable instead of OrderedTableRef for mimedb

Signed-off-by: David Krause <enthus1ast@users.noreply.github.com>

* added changelog entry for mimedb change

Signed-off-by: David Krause <enthus1ast@users.noreply.github.com>
2022-02-14 08:56:35 +01:00
Andrey Makarov
801c0f0369 Fix bug 27 of #17340 (#19433)
Fixes silent disappearance of Markdown (pseudo-)link when it's detected as
unsafe protocol. Now it will be converted to plain text in spirit of
[the specification](https://spec.commonmark.org/0.30/#links).
For that sake the check for protocol is added to rst.nim also.
2022-02-07 18:11:53 -05:00
flywind
33bfe5b12c fix parseEnum cannot parse enum with const fields (#19466)
fix #19463
2022-02-04 13:47:03 +01:00
flywind
56a901f9e1 fix broken CI (#19472)
* fix broken CI

* fix

* fix tests
2022-01-31 13:49:20 +01:00
Dominik Picheta
cb894c7094 Merge pull request from GHSA-ggrq-h43f-3w7m
This fixes a CVE (currently
https://github.com/nim-lang/Nim/security/advisories/GHSA-ggrq-h43f-3w7m)
2022-01-29 14:03:01 +01:00
metagn
2bd1aa186e New/better macro pragmas, mark some as experimental (#19406)
* New/better macro pragmas, make some experimental

fix #15920, close #18212, close #14781, close #6696,
close https://github.com/nim-lang/RFCs/issues/220

Variable macro pragmas have been changed to
only take a unary section node.
They can now also be applied in sections with multiple variables,
as well as `const` sections. They also accept arguments.

Templates now support macro pragmas, mirroring other routine types.

Type and variable macro pragmas have been made experimental.
Symbols without parentheses instatiating nullary macros or templates
has also been documented in the experimental manual.

A check for a redefinition error based on the left hand side of variable
definitions when using variable macro pragmas was disabled.
This nerfs `byaddr` specifically, however this has been documented as
a consequence of the experimental features `byaddr` uses.

Given how simple these changes are I'm worried if I'm missing something.

* accomodate compiler boot

* allow weird pragmas

* add test for #10994

* remove some control flow, try remove some logic
2022-01-20 20:57:50 +01:00
James
851e515bba Resolve cross file resolution errors in atomics (#19422) [backport:1.6]
* Resolve call undeclared routine testAndSet

* Fix undeclared field atomicType
2022-01-20 13:58:59 +01:00
flywind
4a38092ac1 Added std/envvars for env vars handling (#19421) 2022-01-20 13:55:19 +01:00
flywind
bc3bee5469 Added std/oserrors for OS error reporting (#19390)
* Added 'std/oserrors' for OS error reporting

* add a simple test

* New code should not support -d:useWinAnsi anymore

thanks to @Araq
2022-01-17 13:06:31 +01:00
flywind
d102b2f54c deprecate unsafeAddr; extend addr (#19373)
* deprecate unsafeAddr; extend addr

addr is now available for all addressable locations, unsafeAddr is deprecated and become an alias for addr

* follow @Vindaar's advice

* change the signature of addr

* unsafeAddr => addr (stdlib)

* Update changelog.md

* unsafeAddr => addr (tests)

* Revert "unsafeAddr => addr (stdlib)"

This reverts commit ab83c99c50.

* doc changes; thanks to @konsumlamm

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-01-16 11:08:38 +01:00
hlaaftana
a95399143f Use openarray of bytes in md5 (#19307)
* Use openarray of bytes in md5
* fix CI
* cleanup
* use noSideEffect for bootstrapping
* fix CI again
* actually fix CI by checking if it works
* this is getting ridiculous
* put old md5 version in compiler, remove vmop
2022-01-15 13:19:05 +01:00
gecko
955040f0f1 Fix remove on last node of singly-linked list [backport:1.6] (#19353) 2022-01-10 10:27:59 +01:00
flywind
9df195ef58 style usages part one (openarray => openArray) (#19321)
* style usages (openArray)

* revert doc changes
2022-01-04 13:29:50 +01:00
rockcavera
526a32e169 Fix #19314 - fixing broken DoublyLinkedList after adding empty DoublyLinkedList (#19315) [backport]
* Update lists.nim

* Update tlists.nim
2022-01-03 20:14:08 +01:00
Carlo Capocasa
e49d52eb61 Add Week-Of-Year Implementation to Times Module (#17223)
* initial

* more tests

* Apply suggestions from code review

idiomatize

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* test iron age dates

* add examples

* fix typo

* consistent param mention

* add since pragrams

* add changelog

* Update lib/pure/times.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* fix examples

* fix negative years

* add getWeeksInYear tests

* add back fix dropped by rebase

* week-year tuple api

* add changelog

* fix doc tags

* add docstrings

* fix typos

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2022-01-03 09:11:23 +01:00
rockcavera
dc5c88ca79 Fix #19297 - fixing broken list after adding empty list (#19299)
* Update lists.nim

* Update tlists.nim

* removed check `if b.tail != nil`

The tail of the list being null it is still possible to retrieve its end by going through all nodes from the head. So checking for null from `b.tail` is unnecessary. However, setting `a.tail = b.tail` only if `a.head != nil`, so you don't break a good list with an already broken one.
2021-12-30 21:52:48 +01:00
Jake Leahy
4da7dbffc5 Extract runnables that specify doccmd (#19275) [backport:1.6] 2021-12-20 17:29:03 +01:00
rockcavera
5ddaf3e1fb fix #19244 - solves the problem of the InAddr object constructor in Windows. (#19259)
* Update winlean.nim

* Update tnet_ll.nim
2021-12-17 09:01:33 +01:00
Miran
c17baaefbc [backport:1.0] json: limit recursion depth (#19252)
* json: limit recursion depth

* do not run this check for JS backend
2021-12-14 18:16:49 +01:00
Nick Wilburn
c55930f2e6 fix: fixes bug in CVerifyPeerUseEnvVars (#19247)
Previously CVerifyPeerUseEnvVars was not being passed into
scanSslCertificates, which meant that we weren't scanning
additional certificate locations given via the SSL_CERT_FILE and
SSL_CERT_DIR environment variables
2021-12-14 12:22:10 +00:00
Carlo Capocasa
0ff4b2ba7e fix bug #14468 zero-width split (#19248) 2021-12-13 07:29:22 +01:00
Jaremy Creechley
4b5cecd902 Various std net improvements (#19132)
* Variant of  that works with raw IpAddresses.

- Add doc tests for new net proc's.
- Aadd recvFrom impl
- Add recvFrom impl -- tweak handling data var

- Update lib/pure/net.nim
	Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>

- cleaning up sendTo args
- remove extra connect test
- cleaning up sendTo args
- fix inet_ntop test
- fix test failing - byte len

* fix test failing - byte len

* debugging odd windows build failure

* debugging odd windows build failure

* more experiments to figure out the windows failure

* try manual assigment on InAddr

Co-authored-by: Jaremy Creechley <jaremy.creechley@panthalassa.com>
2021-12-12 21:39:56 +00:00
Andreas Rumpf
9338aa2497 fixes a possible 'javascript:' protocol exploit [backport:1.0] (#19134)
* fixes a possible 'javascript:' protocol exploit [backport:1.0]

* add tests

* Update tests/stdlib/trstgen.nim

* add the same logic for hyperlinks

* move the logic into a proc

Co-authored-by: narimiran <narimiran@disroot.org>
2021-12-10 09:24:20 +01:00
Andrey Makarov
040d23e799 implement RST & Markdown quote blocks (#19147)
* implement RST & Markdown quote blocks

* compile with nim 1.0

* Fix indentation
2021-11-23 13:02:03 +01:00
Christoph Krybus
ade85ee91f Fix punycode.decode function (#19136)
* Refactor: rename proc to func

* Fix punycode.decode function

This function could only properly decode punycodes containing a single
encoded unicode character. As soon as there was more than one punycode
character group to decode it produced invalid output - the number of
characters was correct, but their position was not.

* Update tpunycode.nim

Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
2021-11-12 22:51:58 -05:00
Andrey Makarov
b21eb1ed36 change os.nim doc links to new style (#19102) 2021-11-08 13:10:01 +01:00
Kaushal Modi
2e0db988e7 tests: Fix warnings in tstrscans (#19082) 2021-11-02 09:06:46 +01:00
Jason Beetham
cc984217a9 Fix VM's sametype impl to work for generics/typedescs (#19073)
* Fix vm's sametype implementation to properly handle generics and typedescs

* actually fixed sametype + have test

* added comments and removed unsafe code
2021-11-02 09:02:53 +01:00