summary refs log tree commit diff stats
path: root/compiler/main.nim
Commit message (Collapse)AuthorAgeFilesLines
* Add `--genCDeps` for better integration with CMake (#20950)Jaremy Creechley2022-11-291-0/+22
| | | | | | | | | | | | | | | | | * 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>
* 'lock levels' are deprecated, now a noop (#20539)ringabout2022-10-111-1/+0
| | | | | * 'lock levels' are deprecated, now a noop * fixes tests
* fixes #9462; jsondoc --index can generate a theindex.json (#20205)ringabout2022-09-061-1/+5
|
* Improve Markdown code blocks & start moving docs to Markdown style (#19954)Andrey Makarov2022-07-151-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* fix #17286 nim check -b:js works (#19704)flywind2022-04-091-0/+2
| | | | | * fix #17286 nim check -b:js works * fix
* fix nim check nimscript [backport: 1.6] (#19444)flywind2022-03-231-1/+5
| | | | fix #19440; fix #3858
* move assertions out of system (#19599)flywind2022-03-231-0/+4
|
* rst: add missing line/column info for some warnings (#18383)Andrey Makarov2021-07-201-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * rst: add missing line/column info for some warnings * add workaround * use TLineInfo/FileIndex for storing file names * fix blank lines in include file (rm harmful strip) * don't use ref TLineInfo * return `hasToc` as output parameter for uniformity * 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> * address review - stylistic things * Update compiler/docgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * unify RST warnings/errors names * doAssert + minor name change * fix a bug caught by doAssert * apply strbasics.strip to final HTML/Latex * rm redundant filename * fix test after rebase * delete `order` from rnFootnoteRef, also display errors/warnings properly when footnote references are from different files * Update compiler/lineinfos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update lib/packages/docutils/rstast.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * revert because of error: Error: cannot prove that it's safe to initialize 'info' with the runtime value for the discriminator 'kind' * Update lib/packages/docutils/rstgen.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * apply suggestion * Update lib/packages/docutils/rst.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * add Table for string->file name mapping * do not import compiler/lineinfos * fix ambiguous calls Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: narimiran <narimiran@disroot.org>
* 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>
* merge BuildMode into SuccessX, remove code duplication w drnim, add useful ↵Timothee Cour2021-06-141-34/+6
| | | | | | | | | | | info to successx, add gc to compilesettings (#18252) * merge BuildMode into SuccessX, add more info * refactor duplicated with drnim * fixup * address comment
* config system: special case -d:release and -d:danger [backport:1.4] (#18051)Andreas Rumpf2021-05-201-1/+2
|
* `doc2tex`: generate docs to Latex (#17997)Andrey Makarov2021-05-141-9/+16
| | | | | * `doc2tex`: generate docs to Latex * address some comments
* fix #17853 (ascii message separator broke json nim dump) (#17887)Timothee Cour2021-04-291-1/+2
|
* Implement https://forum.nim-lang.org/t/7848#50018 (#17874)c-blake2021-04-291-4/+4
| | | | | | | | | | | | | | | | | | | | * Implement https://forum.nim-lang.org/t/7848#50018 with just the same `SuccessX` hint category, build mode on a separate, final line, and no change to how the mode is spelled for -d:release/-d:danger. * Change to add a new BuildMode hint category and keep testament in sync as per comment. * Add "--hint:buildmode:off" to `defaultHintsOff`. * Remove as requested. * As requested for tests clean up. * Address code review. * Address code review. * Mirror db456423116a9b19666f551f4d38aded3964c2e2
* `--usenimcache` (implied by `nim r main`) now caches some compile options to ↵Timothee Cour2021-04-251-17/+34
| | | | | | | | | | | avoid recompiling when project was previously compiled with such options. (#17829) * `--usenimcache` (implied by `nim r main`) now caches some compile options to avoid recompiling when project was previously compiled with such options. * works * add test * changelog * use std/with
* `--filenames:abs|canonical|legacyRelProj` for filenames in compiler msgs ↵Timothee Cour2021-04-211-3/+5
| | | | | | | (replaces `--listfullpaths:on|off`) (#17746) * use canonicalImport for filename_magicSauce * --filenames:abs|canonical|magic * rename: magic => legacyRelProj
* unit separator (#17730)Andreas Rumpf2021-04-201-2/+2
| | | | | * use the ASCII Unit Separator so that error messages can be handled precisely by the tooling * updated testament
* -d:nimDebug: calls doAssert false instead of quit (#17739)Timothee Cour2021-04-171-3/+3
|
* IC: first steps towards 'nim check --def --ic:on' (#17714)Andreas Rumpf2021-04-141-3/+12
| | | | | | | | | * 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
* IC: integrity checking (#17695)Andreas Rumpf2021-04-111-1/+3
| | | | | | * IC: integrity checking: the plumbing code * progress * progress + bugfix (yes, the code already found a bug) * implemented integrity checking
* fix #17190 `nimscript` now accepts arbitrary file extensions for `nim e ↵flywind2021-04-011-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | main.customext` (#17596) * fix #17190 * cah * merge * Update tnimscriptwithnimext.nim * Update tnimscriptwithmacro.nims * Apply suggestions from code review * Delete tnimscriptwithnimext.nim * Update tests/tools/tnimscriptwithmacro.nims * fix * fix * add a test * Apply suggestions from code review Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Apply suggestions from code review * Update changelog.md Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* IC: green tests (#17311)Andreas Rumpf2021-03-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * IC: renamed to_packed_ast module to ic module * IC: don't store the --forceBuild flag, makes it easier to test * IC: enable hello world test * Codegen: refactorings for IC; changed the name mangling algorithm * fixed the HCR regressions * life is too short for HCR * tconvexhull is now allowed to use deepCopy * IC exposed a stdlib bug, required a refactoring * codegen: code cleanups * IC: even if a module is outdated, its dependencies might come from disk * IC: progress * IC: better name mangling, module IDs are not stable * IC: another refactoring helping with --ic:on --gc:arc * disable arraymancer on Windows for the time being * disable arraymancer altogether * IC: make basic test work with 'nim cpp' * IC: progress on --ic:on --gc:arc * wip; name mangling for type info
* stricter checks for RST headlines (#17089)Andrey Makarov2021-02-201-0/+8
|
* IC: next steps (#16729)Andreas Rumpf2021-01-231-9/+17
| | | | | | | | | | | * IC: dead code elimination pass * preparations for a different codegen strategy * added documentation to the newly written code * IC: backend code * IC: backend adjustments * optimized the compiler a bit * IC: yet another massive refactoring * fixes regressions * cleanups
* IC: next steps (#16632)Andreas Rumpf2021-01-121-3/+9
| | | | | | | | | | | | | * 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
* compiler: minor refactoring (#16633)Andreas Rumpf2021-01-081-12/+11
|
* make --gc:arc --exceptions:quirky work again [backport:1.4] (#16583)Andreas Rumpf2021-01-041-2/+0
| | | | | * make --gc:arc --exceptions:quirky work again [backport:1.4] * fixes #16404 [backport:1.4]
* big steps torwards an efficient, simple IC implementation (#16543)Andreas Rumpf2021-01-021-3/+2
| | | | | | | | | | | | | | | | | | | * reworked ID handling * the packed AST now has its own ID mechanism * basic serialization code works * extract rodfiles to its own module * rodfiles: store and compare configs * rodfiles: store dependencies * store config at the end * precise dependency tracking * dependency tracking for rodfiles * completed loading of PSym, PType, etc * removed dead code * bugfix: do not realloc seqs when taking addr into an element * make IC opt-in for now * makes tcompilerapi green again * final cleanups Co-authored-by: Andy Davidoff <github@andy.disruptek.com>
* fix `hintProcessing` dots interference with `static:echo` and `hintCC`; add ↵Timothee Cour2020-12-301-1/+1
| | | | | | | | | | tests for `nim secret`, add tests for hintProcessing, misc other bug fixes (#16495) * fix dots interfering with static:echo * add tests * fix hintProcessing dots for hintCC * improve trunner tests * fix bug: readLineFromStdin now writes prompt to stdout, consistent with linenoise and rdstdin * disable a failing test for windows
* fix `nim secret` dots interfering with prompt (#16491)Timothee Cour2020-12-281-1/+2
| | | | | * fix nim secret dots * cleanups
* refactorings to prepare the compiler for IC (#15935)Andreas Rumpf2020-12-171-3/+3
| | | | | | | | | | | | | | * added ic specific Nim code; WIP * make the symbol import mechanism lazy; WIP * ensure that modules can be imported multiple times * ambiguity checking * handle converters and TR macros properly * make 'enum' test category green again * special logic for semi-pure enums * makes nimsuggest tests green again * fixes nimdata * makes nimpy green again * makes more important packages work
* cmdline: improve command processing (#16056)Timothee Cour2020-11-261-66/+33
|
* Correct all eggs (#15906)Miran2020-11-101-1/+1
| | | | * "eg" is a misspelled "egg", "e.g." is "exempli gratia" * Also, "ie" is "i.e.".
* new: `nim -e:cmd` to run a command directly; also fixes #15731 (#15687)Timothee Cour2020-11-091-2/+3
| | | | | | | | | | | | | | | * new: `nim -i cmd` * rename -i to -e (for eval); consistent with majority of other programing languages * `nim e -e:cmd` now works; bugfix: `echo cmd | nim e -` now works * honor --betterRun * address comments * --eval alias for -e (replaces undocumented --eval which was a noop) * --eval now defaults to e (nimscript) instead of r * address comment: remove -e, only keep --eval * address comment * fixup * Update compiler/nimconf.nim Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
* Use modern enums in compiler (#15775)cooldome2020-11-021-2/+2
|
* explicit ID generation for easier IC (#15559)Andreas Rumpf2020-10-251-11/+6
| | | | | | | | | | | | | | | | | * refactoring: idents don't need inheritance * refactoring: adding an IdGenerator (part 1) * refactoring: adding an IdGenerator (part 2) * refactoring: adding an IdGenerator (part 3) * refactoring: adding an IdGenerator (part 4) * refactoring: adding an IdGenerator (part 5) * refactoring: adding an IdGenerator (part 5) * IdGenerator must be a ref type; hello world works again * make bootstrapping work again * progress: add back the 'exactReplica' ideas * added back the missing exactReplica hacks * make tcompilerapi work again * make important packages green * attempt to fix the build for 32 bit machines (probably need a better solution here)
* refactoring: moved setOutFile to where it belongsAndreas Rumpf2020-10-111-14/+0
|
* minor reformatingAraq2020-10-061-1/+1
|
* Big compiler Cleanup (#14777)Clyybber2020-08-281-2/+2
|
* VM profiler (#14833)Ico Doornekamp2020-07-091-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * Crude VM profiler * Added --profileVM flag, refactoring * fixed FileLine hash * Use TLineInfo instead of own FileLine, updated formatting * Refactoring, moved PStackFrame to vmdefs for cleaner data structure * Moved vmprofiler to separate file * Simplified TLineInfo hash, use toFileLineCol for output * Hash * Moved profile data into Config, dump only once at end of run * Changed profile output header to show '#instr' instead of 'count' * Do not accumulate instrcount for non-top frames Co-authored-by: Ico Doornekamp <git@zevv.nl>
* Fix #12745 (#14879)Tomohiro2020-07-021-0/+5
|
* bug fixes with sfMainModule, hints, mainPackageNotes, mainPackageId, ↵Timothee Cour2020-06-041-3/+14
| | | | | | | hintSuccessX (#14555) * SuccessX `out` now works with --compileOnly and jsonscript; fix bugs in jsonscript * several bug fixes; eg: `nim doc lib/system/io` now is sane * dummy edit to force docs CI
* * honor --errorMax even for tools (eg drnim, nim doc) (#14546)Timothee Cour2020-06-021-3/+3
| | | * fix a bug that prevented nim doc compiler/nim on windows
* fix #6583, fix #14376, index+search now generated for all projects, many bug ↵Timothee Cour2020-05-251-73/+43
| | | | | | | | | fixes with nim doc (#14324) * refs #6583 fix nim doc output * changelog * change default for outDir when unspecified * cleanups * --project implies --index
* no more code duplication bw liMessage and rawMessage + several bug fixes ↵Timothee Cour2020-05-221-4/+2
| | | | | | | (#14415) * no more code duplication bw rawMessage and liMessage; fixes some bugs in rawMessage * all compiler messages work with hint:msgorigin
* fix some issues with --backend (#14363)Timothee Cour2020-05-161-28/+49
| | | | | * fix some issues with --backend * fix https://github.com/timotheecour/Nim/issues/175; improve upon #14306
* `nim doc --backend:js`, `nim doc --doccmd:-d:foo`, `nim r --backend:js`, ↵Timothee Cour2020-05-111-31/+38
| | | | | | | | | | `--doccmd:skip` + other improvements (#14278) * `nim doc --backend:js|cpp...` `nim doc --doccmd:'-d:foo --threads:on'` `nim r --backend:cpp...` (implies --run --usenimcache) * --usenimcache works with all targets * --docCmd:skip now skips compiling snippets; 50X speedup for doc/manual.rst
* fixes #14209 [backport:1.2] (#14213)Andreas Rumpf2020-05-051-0/+3
| | | | * fixes #14209 [backport:1.2] * improve stability
* fix https://github.com/timotheecour/Nim/issues/152: avoid writing spurious ↵Timothee Cour2020-05-041-2/+0
| | | | | | | | | `^[[0m` to stderr when callStyledWriteLineStderr not called (#14214) * fix https://github.com/timotheecour/Nim/issues/152 `^[[0m` is inserted in stderr for `echo code | nim c -` * resetAttributes not even needed, already handled in styledWriteLine * simplify tests in tests/trunner.nim thanks to this fix
* new cmd: `nim r main [args...]` to compile & run, saving binary under ↵Timothee Cour2020-04-231-8/+17
| | | | | | $nimcache/main (#13382) * implement `nim r main` to compile and run, saving binary to $nimcache * remove outFileAbs for now