summary refs log tree commit diff stats
path: root/compiler/commands.nim
Commit message (Collapse)AuthorAgeFilesLines
* fixes #19396; Nimdoc hide nonexported fields (#21305)ringabout2023-02-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * suppresses non-exported fields of types and adds command-line option to re-enable this if desired * corrected the doctest that produced a CI error * an embarrassingly bad error in reasoning * modified a nimdoc test to reflect updated behavior * needed another change to bring utils.html doctest in sync with update * add info * fix nimdoc * lint * render postfix * fixes a problem * fixes nimdoc * fix nimdoc --------- Co-authored-by: johnperry-math <john.perry@usm.edu> Co-authored-by: johnperry-math <devotus@yahoo.com>
* fixes #21209; exclude threads options for JS (#21233)ringabout2023-01-081-0/+2
|
* docgen: implement cross-document links (#20990)Andrey Makarov2023-01-041-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * docgen: implement cross-document links Fully implements https://github.com/nim-lang/RFCs/issues/125 Follow-up of: https://github.com/nim-lang/Nim/pull/18642 (for internal links) and https://github.com/nim-lang/Nim/issues/20127. Overview -------- Explicit import-like directive is required, called `.. importdoc::`. (the syntax is % RST, Markdown will use it for a while). Then one can reference any symbols/headings/anchors, as if they were in the local file (but they will be prefixed with a module name or markup document in link text). It's possible to reference anything from anywhere (any direction in `.nim`/`.md`/`.rst` files). See `doc/docgen.md` for full description. Working is based on `.idx` files, hence one needs to generate all `.idx` beforehand. A dedicated option `--index:only` is introduced (and a separate stage for `--index:only` is added to `kochdocs.nim`). Performance note ---------------- Full run for `./koch docs` now takes 185% of the time before this PR. (After: 315 s, before: 170 s on my PC). All the time seems to be spent on `--index:only` run, which takes almost as much (85%) of normal doc run -- it seems that most time is spent on file parsing, turning off HTML generation phase has not helped much. (One could avoid it by specifying list of files that can be referenced and pre-processing only them. But it can become error-prone and I assume that these linke will be **everywhere** in the repository anyway, especially considering https://github.com/nim-lang/RFCs/issues/478. So every `.nim`/`.md` file is processed for `.idx` first). But that's all without significant part of repository converted to cross-module auto links. To estimate impact I checked the time for `doc`ing a few files (after all indexes have been generated), and everywhere difference was **negligible**. E.g. for `lib/std/private/osfiles.nim` that `importdoc`s large `os.idx` and hence should have been a case with relatively large performance impact, but: * After: 0.59 s. * Before: 0.59 s. So Nim compiler works so slow that doc part basically does not matter :-) Testing ------- 1) added `extlinks` test to `nimdoc/` 2) checked that `theindex.html` is still correct 2) fixed broken auto-links for modules that were derived from `os.nim` by adding appropriate ``importdoc`` Implementation note ------------------- Parsing and formating of `.idx` entries is moved into a dedicated `rstidx.nim` module from `rstgen.nim`. `.idx` file format changed: * fields are not escaped in most cases because we need original strings for referencing, not HTML ones (the exception is linkTitle for titles and headings). Escaping happens later -- on the stage of `rstgen` buildIndex, etc. * all lines have fixed number of columns 6 * added discriminator tag as a first column, it always allows distinguish Nim/markup entries, titles/headings, etc. `rstgen` does not rely any more (in most cases) on ad-hoc logic to determine what type each entry is. * there is now always a title entry added at the first line. * add a line number as 6th column * linkTitle (4th) column has a different format: before it was like `module: funcName()`, now it's `proc funcName()`. (This format is also propagated to `theindex.html` and search results, I kept it that way since I like it more though it's discussible.) This column is what used for Nim symbols resolution. * also changed details on column format for headings and titles: "keyword" is original, "linkTitle" is HTML one * fix paths on Windows + more clear code * Update compiler/docgen.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Handle .md and .nim paths uniformly in findRefFile * handle titles better + more comments * don't allow markup overwrite index title for .nim files Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Add `--genCDeps` for better integration with CMake (#20950)Jaremy Creechley2022-11-291-0/+3
| | | | | | | | | | | | | | | | | * add gencdeps option * add case statement * Update compiler/main.nim * Update compiler/main.nim * Apply suggestions from code review Fixes Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fixes #20426; remove `maincommand` and `m` options since they are a no op ↵ringabout2022-09-261-1/+1
| | | | | | | | | | | | | | | | | since 2014 (#20429) * bump macOS image on Azure CI to macos-11 ##[warning]The macOS-10.15 environment is deprecated, consider switching to macos-11(macos-latest), macos-12 instead. For more details see https://github.com/actions/virtual-environments/issues/5583 * fix CI error * fixes #20426; remove `maincommand` and `m` options since they are a noop since 2014 and causes confusion fixes #20426 https://github.com/nim-lang/Nim/commit/7f7b13a45f73c6d9dcca3ce8388833189d77426c#diff-d949f8c356fd2dc9ceedc6f3dbbd01e2c806269dd0a8ad6516facf589fa2c99a makes it a no op, but it causes a regression because it should add `expectArg(switch, arg, pass, info)` before the discard statement. It causes https://github.com/nim-lang/Nim/issues/20426 to happen. Without `expectArg(switch, arg, pass, info)`, `-mm:orc` is wrongly interpreted as `-m` and compiler, which doesn't make sense. It should either abort compilation or prints `argument for command line option expected: '-m'` message. Since they are a no op since 2014, let's remove it to clear the confusion. Let's wait and see whether it breaks something. * add a changelog
* defaults to ORC (#19972)ringabout2022-09-231-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Fix #16937; --clib option pass library name to backend C compiler correctly ↵Tomohiro2022-09-011-1/+1
| | | | | | | | | | | | | (#19754) * Fix 16937: Make --clib option works * Make tests/compiler/tcmdlineclib.nim works from any current dir * Try to fix link error on macosx * Add a comment to tests/compiler/tcmdlineclib.nims Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* defines the `gcRefc` symbol which allows writing specific code for refc (#20009)flywind2022-07-171-0/+1
| | | | | | | | | | | | | | | | | | * 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>
* Improve Markdown code blocks & start moving docs to Markdown style (#19954)Andrey Makarov2022-07-151-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* remove noop option `gc:v2` (#19810)flywind2022-06-101-2/+0
| | | | | * remove noop option gc:v2 * changelog
* Add 'usages' option to the --stylechecks error msg (#19759)Zoom2022-05-041-2/+2
|
* add warnings for gc:option (#19722)flywind2022-04-251-42/+49
|
* fix nim check nimscript [backport: 1.6] (#19444)flywind2022-03-231-0/+2
| | | | fix #19440; fix #3858
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* support useVersion:1.6 (#19601)flywind2022-03-101-0/+4
|
* make compileOption("panics") work (#19568)solarizedalias2022-02-271-0/+1
|
* setjump => setjmp [backport: 1.2] (#19496)flywind2022-02-061-1/+1
|
* undefine C symbols in JS backend [backport:1.6] (#19437)flywind2022-02-041-2/+3
| | | fix #19330; fix #19059
* support set other GCs after `mm = orc` or `mm = arc` is set in the global ↵flywind2022-01-271-20/+34
| | | | | | | | | config (#19455) * support set other GCs after arc/orc in global config fix #15535 * set before
* nimscript ignore the threads option (#19370)flywind2022-01-131-1/+1
| | | because nimscript doesn't support threads and causes troubles when the threads option is on
* added --nimMainPrefix switch; fixes #15955; refs #16945 [backport:1.6] (#19235)Andreas Rumpf2021-12-101-0/+1
|
* renamed 'gc' switch to 'mm'; [backport:1.6] (#19187)Andreas Rumpf2021-11-241-2/+2
| | | | * renamed 'gc' switch to 'mm'; [backport:1.6] * better docs
* fixes #18921 [backport] (#18930)Andreas Rumpf2021-09-301-9/+11
|
* strict effects (#18777)Andreas Rumpf2021-09-021-2/+1
| | | | | | | | | | | | | | | | | * fixes #17369 * megatest is green for --cpu:arm64 * docgen output includes more tags/raises * implemented 'effectsOf' * algorithm.nim: uses new effectsOf annotation * closes #18376 * closes #17475 * closes #13905 * allow effectsOf: [a, b] * added a test case * parameters that are not ours cannot be declared as .effectsOf * documentation * manual: added the 'sort' example * bootstrap with the new better options
* move PNode.comment to a side channel, reducing memory usage during ↵Timothee Cour2021-08-291-1/+2
| | | | | | | | | | | | | | | | | compilation by a factor 1.25x (#18760) * move PNode.comment so a side channel, reducing memory usage * fix a bug * fixup * use sfHasComment to speedup comment lookups * fix for IC * Update compiler/parser.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* fix #18674 --nimcache now works better with --os:windows (#18675)Timothee Cour2021-08-111-0/+4
|
* followup #17852, disallow all:on for now (#18311)Timothee Cour2021-06-201-0/+2
|
* support `--hint:all:off --hint:x` (ditto with `--warnings` + friends) (#17852)Timothee Cour2021-06-201-30/+29
| | | | | * select all hints via `--hint:all:on|off`, etc * simplify code with setutils * address comment
* docgen: move to shared RST state (fix #16990) (#18256)Andrey Makarov2021-06-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * docgen: move to shared RST state (fix #16990) * Update lib/packages/docutils/rst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update lib/packages/docutils/rst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update lib/packages/docutils/rst.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * rename `cmdDoc2` to `cmdDoc` * fix (P)RstSharedState convention * new style of initialization * misc suggestions * 1 more rename * fix a regression Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* fixes #18058 (#18162)Andreas Rumpf2021-06-031-0/+2
|
* config system: special case -d:release and -d:danger [backport:1.4] (#18051)Andreas Rumpf2021-05-201-4/+15
|
* `doc2tex`: generate docs to Latex (#17997)Andrey Makarov2021-05-141-0/+1
| | | | | * `doc2tex`: generate docs to Latex * address some comments
* fixes #15848 [backport:1.2] (#17959)Andreas Rumpf2021-05-071-1/+2
|
* system.nim cleanup some exported constants which should never have be… ↵Andreas Rumpf2021-05-011-4/+1
| | | | | | (#17909) * system.nim cleanup some exported constants which should never have been exported
* add `--processing:dots|filenames|off` to customize `hintProcessing` (#17817)Timothee Cour2021-04-231-0/+10
|
* `--filenames:abs|canonical|legacyRelProj` for filenames in compiler msgs ↵Timothee Cour2021-04-211-1/+17
| | | | | | | (replaces `--listfullpaths:on|off`) (#17746) * use canonicalImport for filename_magicSauce * --filenames:abs|canonical|magic * rename: magic => legacyRelProj
* IC navigator: added support for include files (#17784)Andreas Rumpf2021-04-191-24/+45
| | | | | | | | | | | | | | | | | * ic fixed navigator crash when track wrong/missed Also fixed an issue with getNimcacheDir not observing the outDir. * closer, but not sure how to test[skip ci][ci skip] * IC navigator: added support for include files * update * make posix happy via expandFilename * update Co-authored-by: Saem Ghani <saemghani+github@gmail.com>
* IC: first steps towards 'nim check --def --ic:on' (#17714)Andreas Rumpf2021-04-141-0/+3
| | | | | | | | | * IC: first steps towards 'nim check --def --ic:on' * IC navigator: deduplicate output lines * IC navigator: progress * IC navigator: use a different nimcache entry * IC navigator: special logic for templates/macros * IC navigator: proper error messages * IC navigator: prepare for testing code; document only what currently works somewhat
* fix #2844 #3911; add --spellsuggest to suggest symbols in scope with similar ↵Timothee Cour2021-03-161-0/+4
| | | | | | | spellings on undefined symbol error (#16067) * add --spellsuggest to suggest symbols in scope with similar spellings on undefined symbol errors * implement --spellsuggest with 0 arguments
* fix #17267 (#17273)flywind2021-03-071-2/+5
| | | | | | | | | | | | | | | | | * remove unnecessary when statement * remove outdated codes * reuse jsffi * move js json coverage * fix #17267 * address comments * Update compiler/main.nim * Update tests/threads/tjsthreads.nim
* follow #17245 deprecate refchecks (#17261)flywind2021-03-051-2/+6
| | | | | * follow #17245 deprecate refchecks * changelog * address comments
* deprecate newruntime (#17245)flywind2021-03-041-0/+1
| | | | | | * deprecate newruntime * tests * Update compiler/commands.nim
* followup #17225: simplify code after removing gc2, generational (#17242)Timothee Cour2021-03-031-6/+5
|
* fix #16731: using deprecated flags triggers a warning (#17225)Timothee Cour2021-03-021-23/+19
| | | | | | * using deprecated flags triggers a warning * cleanups * fixup * address comments
* `--nilseqs` is now a deprecated noop (#17211)Timothee Cour2021-03-011-2/+4
| | | | | * --nilseqs is now a deprecated noop * fix tests; fix: future => sugar
* document `since` (#17048)Timothee Cour2021-02-161-5/+3
| | | | * document `since` * address comment
* `--hintAsError` (#16763)Timothee Cour2021-01-201-4/+6
| | | | | | | * --hintAsError * add test, changelog * condsyms
* Deprecate TaintedString (#15423)Juan Carlos2021-01-151-2/+2
| | | | Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Dominik Picheta <dominikpicheta@googlemail.com>
* IC: next steps (#16632)Andreas Rumpf2021-01-121-3/+3
| | | | | | | | | | | | | * removed dead code * beginnings of a rodfile reader * IC: record global VM state changes and pragma state changes * IC: replay pragmas and VM state changes * implemented rod load file simuation for easier, extensive testing * critical bugfix * IC: stress test logic; should also help with recursive module dependencies; WIP * IC: loading from .rod files begins to work reliably * removed ugly hacks * yet another silly mistake
* IC: next steps (#16550)Andreas Rumpf2021-01-071-8/+9
| | | | | | | | | | | | | | | | | | * cleanups * ast.nim: cleanups * IC: no more sym.tab field, stored externally in the module graph * nimble compiles again * rodfiles: store bitwidth of integers and the endianness in the cookie because we serialize 'int' directly * rodfiles: added compilerproc and export sections * rodfiles: added all the missing sections * rodfiles: track the missing information * IC: architecture for lazy loading of proc bodies * make tests green again * completed the lazy loading of proc bodies * symbol lookup integration, part 1 * symbol lookup integration, part 2 * symbol lookup integration, part 3 * make tcompilerapi work again * rodfiles: fixed config change handling