Commit Graph

1902 Commits

Author SHA1 Message Date
Andrey Makarov
a34dd3d77a Markdown code blocks part 3 (#20117)
No logic was added, just 4 more files migrated.
2022-08-04 09:32:23 +02:00
random-bites
02cbd7dc53 Edits to sections 'Open arrays' and 'varargs'. (#20140) 2022-08-03 08:44:14 +02:00
quantimnot
313ce91533 [Doc] Fix some minor markup errors in manual (#20112)
* Fix header level for noalias pragma section.
* Fix code snippet outside of code block that raised an error with `rst2html`.
* Fix broken 'Convertible relation' links that were raising warnings.

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-07-31 20:08:01 -04:00
Lancer11211
efd5c571bf .forbids pragma: defining forbidden tags (#20050)
* .forbids pragma: defining illegal effects for proc types

This patch intends to define the opposite of the .tags pragma: a way to define effects which are not allowed in a proc.

* updated documentation and changelogs for the forbids pragma

* renamed notTagEffects to forbiddenEffects

* corrected issues of forbids pragma

the forbids pragma didn't handle simple restrictions properly and it also had issues with subtyping

* removed incorrect character from changelog

* added test to cover the interaction of methods and the forbids pragma

* covering the interaction of the tags and forbids pragmas

* updated manual about the forbids pragma

* removed useless statement

* corrected the subtyping of proc types using the forbids pragma

* updated manual for the forbids pragma

* updated documentations for forbids pragma

* updated nim docs

* updated docs with rsttester.nim

* regenerated documentation

* updated rst docs

* Update changelog.md

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>

* updated changelog

* corrected typo

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
2022-07-26 07:40:49 +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
tersec
1a9123eb90 Use passc and passl consistently with compiler checking (#20068) 2022-07-21 09:41:33 +02:00
Don-Duong Quach
efdcc00169 Fixed errors in Nim Backend integration docs. (#20046)
Fixed errors in Nim Backend integration.
Section "Nim invocation example from C"
NimMain needs a declaration and function declarations have external
linkage by default.
Also with the order of arguments to gcc with a static lib,
maths.c needs to come before the static lib.
2022-07-17 09:32:33 +02:00
Peter Guld Leth
0d8bec6956 Fix typo in line 456 (#20047) 2022-07-17 00:00:28 +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
Tanguy
ce4078acd4 Allow recursive closure iterators (#19939) 2022-06-30 23:19:04 +02:00
Khaled Hammouda
caf6aff06b Fix distinct requiresInit test and manual (#19901)
fix distinct test and manual
2022-06-22 12:36:30 +02:00
JJ
e7e8f437c4 Keep the doc sidebar on the screen while scrolling (#19851)
* [docgen] Group sidebar sections into <details> (open by default)

* [docgen] Consistent indentation in generated HTML

(this is a boon for working on docgen's html/css output)

* [docgen] Move Source/Edit buttons inside main div

This makes styling the documentation significantly easier.

* [docgen] Somewhat consistent CSS formatting

* [docgen] Keep the sidebar onscreen while scrolling

* [docgen] Tweak CSS for the sticky sidebar

* [docgen] search type=text ==> type=search

* [docgen] Update expected doc output

* [docgen] Fix Group by Type sidebar placement bug

* [docgen] Curse you, whitespace (fix tests)

* [docgen] Fix rst2html tests

Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
2022-06-15 15:40:56 +02:00
quantimnot
6f4bacff67 Extend and document compiler debugging utilities (#19841)
* Add two debugutils procs that native debuggers can break on use to
  execute commands when code of interest is being compiled.
* Add GDB and LLDB programs to disable and enable breakpoints and
  watchpoints when code of interest is being compiled.
* Extend the `intern.rst` docs regarding debugging the compiler.

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-06-10 20:40:08 +02:00
flywind
415689323c clarify how to restart CI (#19845) 2022-06-08 18:17:25 +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
quantimnot
d30c6419a0 Refactor and doc package handling, module name mangling (#19821)
* Refactor and doc package handling, module name mangling

* Consolidate, de-duplicate and extend package handling
* Alter how duplicate module names of a package are handled
* Alter how module names are mangled
* Fix crash when another package is named 'stdlib' (test case added)
* Doc what defines a package in the manual

Modules with duplicate names within a package used to be given 'fake'
packages to resolve conflicts. That prevented the ability to discern if
a module belonged to the current project package or a foreign package.
They now have the proper package owner and the names are mangled in a
consistent manner to prevent codegen clashes.

All module names are now mangled the same. Stdlib was treated special
before, but now it is same as any other package. This fixes a crash
when a foreign package is named 'stdlib'.

Module mangling is altered for both file paths and symbols used by the
backends.

Removed an unused module name to package mapping that may have been
intended for IC. The mapping was removed because it wasn't being used
and was complicating the issue of package modules with duplicate names
not having the proper package owner assigned.

* Fix some tests

* Refactor `packagehandling`

* Remove `packagehandling.withPackageName` and its uses
* Move module path mangling from `packagehandling` to `modulepaths`
* Move `options.toRodFile` to `ic` to break import cycle

* Changed import style to match preferred style

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-05-30 18:52:19 +02:00
quantimnot
497af2c0d9 Doc preferred import style in compiler (#19832)
Doc prefered import style in compiler

Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-05-30 11:07:47 +02:00
Michael New
14960fa754 Fix typo and incorrect pragma name (#19847) 2022-05-30 10:40:15 +08:00
flywind
d81edcacc6 Add link to std/tempfiles in the docs; fix #19155 (#19807) 2022-05-24 17:53:01 +02:00
quantimnot
a8426fc789 Fix default testament target in docs and cli help (#19796)
Co-authored-by: quantimnot <quantimnot@users.noreply.github.com>
2022-05-23 06:12:34 +02:00
flywind
33888a7384 [manual] TLock => Lock (#19785)
* [manual] TLock => Lock

* minor
2022-05-17 07:37:26 +02:00
Alfred Morgan
85bc8326ac varargs example erroneously transformed "abc" to "def" (#19781) 2022-05-10 20:21:35 +08:00
Jake Leahy
832b8c5034 Fix link to experimental manual in macro pragmas section [skip ci] (#19753) 2022-05-03 10:08:39 +08:00
tersec
8e6136dd59 document localPassC consistently with compiler; fix ANSI capitalization (#19721) 2022-04-25 11:06:53 +02:00
Andrey Makarov
bb839029d5 Move common Latex code into class nimdoc.cls (#19734) 2022-04-21 15:06:09 -04:00
Leon
152dab0983 fix: Fix introductory macro examples (#19706)
Co-authored-by: adigitoleo <adigitoleo@dissimulo.com>
2022-04-09 17:51:44 +02:00
Omar Flores
86e93eb293 Fixed description as option in advopt.txt (#19635)
* Fixed formatting error in warningAsError.

There was only a single space character between the warning and its description, so it shows up as part of the name (in bold) and with no description.
Copied the way hotCodeReloading was formatted, with the description in a new line.

Also changed descriptions from 'ditto' to what the description it references says.

* Fixed typo in advopt.txt

Corrected 'hints' to 'warnings' in updated advopt.txt.
2022-03-26 09:56:10 +01:00
treeform
400e0260b8 Add more info for {.bycopy.} (#18815)
* Add more info for {.bycopy.} 

See confusion here: https://github.com/nim-lang/Nim/issues/18807

I hope this will help people googling to find this.

* Update doc/manual.rst

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2022-03-24 07:35:29 +01:00
flywind
4c76f9f152 support useVersion:1.6 (#19601) 2022-03-10 17:01:27 +01:00
huantian
590d397852 Fix typo in Nim Tutorial pt3 (#19579) 2022-03-02 13:53:59 +08:00
tersec
f019e999d4 keep casing of noinit and noreturn pragmas consistently documented (#19535) 2022-02-18 16:06:11 +01:00
Sizhe Zhao
b2c5d7b4ff Documentation: Fix word usage (#19529) 2022-02-14 22:15:59 +00:00
flywind
891329cd4b move io out of system (#19442)
* move io out of system

* fix tests

* fix tests

* next step

* rename to syncio

* rename

* fix nimscript

* comma

* fix

* fix parts of errors

* good for now

* fix test
2022-02-02 17:10:11 +01:00
flywind
520881af9a update outdated link (#19465)
Ref https://github.com/nim-lang/Nim/issues/19463
2022-01-28 21:08:38 -05: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
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
flywind
342b74ef70 move type operation section and remove deepcopy document (#19389)
ref #19173; because deepcopy is not fit for ORC/ARC which was used for spawn and spawn will be removed from compiler
2022-01-15 11:25:09 +01:00
Leon
a9135095f0 docs: Mention import foo {.all.} syntax (#19377)
Mention the `import foo {.all.}` syntax in the manual,
with a caveat about private imports.
Also link to the experimental importutils module.

Co-authored-by: adigitoleo <adigitoleo@dissimulo.com>
2022-01-13 14:40:27 +01:00
Nan Xiao
39a27783fc docs: Fix typo in tut1.rst (#19324) 2022-01-04 10:42:21 +01:00
Nan Xiao
bd4f76a2e3 docs: Fix typo in tut1.rst (#19309) 2022-01-03 10:30:26 +01:00
hlaaftana
61d682e733 Allow full commands and blocks in type sections (#19181)
* allow full commands and blocks in type sections
* update grammar
* fix changelog [skip ci]
* more tests
* even more tests
2022-01-02 07:29:55 +01:00
rockcavera
ef634cc251 Update manual.rst (#19301) 2022-01-01 13:33:29 +01:00
Andreas Rumpf
a9223d4cdd nep1: make header reflect reality (#19294) 2021-12-29 12:18:32 +01:00
Andreas Rumpf
a61bbf7d8d fixes grammar typos [backport] (#19289) 2021-12-27 17:28:19 +01:00
Don-Duong Quach
610516e027 Fixed typo in manual.rst unsafeAssign->uncheckedAssign. Fixes part 1 of #19266 (#19267) 2021-12-17 20:58:31 +01:00
Nan Xiao
78b86b7942 basicopt.txt: Unify the format (#19251) 2021-12-14 09:54:01 +01:00
Ștefan Talpalaru
1a92edeb89 nimc.rst: fix table markup (#19239) 2021-12-11 05:15:44 +01:00
Andreas Rumpf
7ff43d07b2 added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235) 2021-12-10 14:28:59 +01:00
Ștefan Talpalaru
69aabdab80 nimRawSetjmp: support Windows (#19197)
* nimRawSetjmp: support Windows

Using `_setjmp()` directly is required to avoid some rare (but very
annoying) exception-related stack corruption leading to segfaults on
Windows, with Mingw-w64 and SEH.
More details: https://github.com/status-im/nimbus-eth2/issues/3121

Also add "nimBuiltinSetjmp" - mostly for benchmarking.

* fix for Apple's Clang++
2021-12-10 06:31:29 +01:00
flywind
faacd63bf6 the title of PR should contain a brief description (#19211)
In addition to an issue number, the title of a PR should contain a brief description; then users can follow the progress more easily from the title.
2021-12-06 10:04:54 +01:00