summary refs log tree commit diff stats
path: root/compiler/parser.nim
Commit message (Collapse)AuthorAgeFilesLines
* allow omitting stmts using `finally` as post expr blocks; make it consistent ↵ringabout2023-02-141-1/+1
| | | | | with `else`, `except` etc. (#21361) allow omitting stmts using `finally` as post expr blocks
* Implemented basic macro expand functionality (#20579)Ivan Yonchovski2023-01-271-5/+65
| | | | | | | | | | | | | | | | | | * Implemented level based macro expand functionality - it can handle single macro call or expand whole function/proc/etc and it - In addition, I have altered the parser to provide the endInfo for the node. The usefulness of the `endInfo` is not limited to the `expandMacro` functionality but also it is useful for `ideOutline` functionality and I have altered the ideOutline functionality to use `endInfo`. Note `endInfo` most of the time is lost during the AST transformation thus in `nimsuggest.nim` I am using freshly parsed tree to get the location information. * Make sure we stop expanding correctly * Test CI * Fix tv3_outline.nim
* fix in msg `doAssert()` to update grammar.txt (#21179)rockcavera2022-12-271-1/+1
|
* fixes #21144; try expression will not match the less indentation except (#21152)ringabout2022-12-211-1/+3
| | | fixes #21144; try expression will not match the less indent except
* fix issue #20922 by handling missing expr in `exprList` for `tkOf` (#20930)Vindaar2022-12-081-5/+23
| | | | | | | | | | | | | | | | | | * fix issue #20922 by handling missing expr in `exprList` for `tkOf` * fix line numbers in test case * rewrite exprList requiring expr, add optionalExprList for except As suggested by @metagn. * update test case to reflect new code * update grammar.txt * update line numbers in test case taking into account nimout Given the number of errors that are produced it seems easier to do it this way instead of using `tt.Error`.
* Named arguments in commands + many grammar fixes (#20994)metagn2022-12-061-112/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Breaking parser changes, implement https://github.com/nim-lang/RFCs/issues/442 Types are separated from expressions and better reflected in the grammar. * add test * more accurate grammar * fix keyword typedescs * accept expressions in proc argument lists * CI "fixes" * fixes * allow full ref expressions again, adapt old tests * cleanup, fix some tests * improve grammar, try and revert semtypes change * restrict sigil binding to identOrLiteral * fix, should have caught this immediately * add changelog entry, fix double not nil bug * correct grammar * change section * fix * real fix hopefully * fix test * support LL(1) for tuples * make grammar.txt too
* allow proc expressions in place of statements (#20935)metagn2022-11-291-7/+15
| | | properly fixes #18714
* refactor strongSpaceB with an enum (#20809)ringabout2022-11-101-2/+2
| | | refactor strongSpaceB
* fixes #15688; handle `strongSpace` overflow issues (#20724)ringabout2022-11-031-8/+8
| | | | | | | * fixes #15688; handle `strongSpace` overflow issues * stop at 1 * change the type of strongSpaceA to bool
* DAA and 'out' parameters (#20506)Andreas Rumpf2022-10-061-4/+1
| | | | | | | | | | | * DAA and 'out' parameters * progress * documented strictDefs and out parameters * docs, tests and a bugfix * fixes silly regression
* correct grammar (ref #20199) and add check for grammar.txt (#20494)ringabout2022-10-061-10/+27
| | | | | | | * correct grammar; ref #20199 * add check for keeping grammar.txt up-to-date * add nimTestGrammar
* add default field support for object in ARC/ORC (#20480)ringabout2022-10-041-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * fresh start * add cpp target * add result support * add nimPreviewRangeDefault * reduce * use orc * refactor common parts * add tuple support * add testcase for tuple * cleanup; fixes nimsuggest tests * there is something wrong with cpp * remove * add support for seqs * fixes style * addd initial distinct support * remove links * typo * fixes tuple defaults * add rangedefault * add cpp support * fixes one more bugs * add more hasDefaults * fixes ordinal types * add testcase for #16744 * add testcase for #3608 * fixes docgen * small fix * recursive * fixes * cleanup and remove tuple support * fixes nimsuggest * fixes generics procs * refactor * increases timeout * refactor hasDefault * zero default; disable i386 * add tuples back * fixes bugs * fixes tuple * add more tests * fix one more bug regarding tuples * more tests and cleanup * remove messy distinct types which must be initialized by original types * add tests * fixes zero default * fixes grammar * fixes tests * fixes tests * fixes tests * fixes comments * fixes and add testcase * undo default values for results Co-authored-by: flywind <43030857+xflywind@users.noreply.github.com>
* remove deprecated type pragma syntax, fix bugs that required it (#20199)metagn2022-09-031-28/+10
| | | | | | | | | | | | | | | | | | | | | | | | * remove deprecated pragma syntax from 0.20.0 closes #4651, closes #16653 with a cheap fix for now due to how early `tfFinal` is set * remove type pragma between name and generics * undo removal, try removing bind expression (0.8.14) * fix test, unremove bind expr * remove again * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> * dependencies @ HEAD & weave test dependencies * try fix package ci Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
* fixes #19662; Indent level errored for first line (#19718)flywind2022-04-251-0/+4
|
* move assertions out of system (#19599)flywind2022-03-231-0/+3
|
* Allow full commands and blocks in type sections (#19181)hlaaftana2022-01-021-9/+19
| | | | | | | * allow full commands and blocks in type sections * update grammar * fix changelog [skip ci] * more tests * even more tests
* fixes grammar typos [backport] (#19289)Andreas Rumpf2021-12-271-3/+3
|
* treat do with pragmas but no parens as proc (#19191)hlaaftana2021-12-051-3/+9
| | | fixes #19188
* fix #12274 (#19180)hlaaftana2021-11-241-1/+1
|
* fixes #19011 [backport:1.6] (#19114)Andreas Rumpf2021-11-091-1/+1
|
* fixes #18847 [backport] (#18870)Andreas Rumpf2021-09-201-2/+3
|
* formal grammar updates [backport:1.2] (#18803)Andreas Rumpf2021-09-041-27/+23
|
* move PNode.comment to a side channel, reducing memory usage during ↵Timothee Cour2021-08-291-5/+9
| | | | | | | | | | | | | | | | | 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 RFC #341: dot-like operators are now parsed with same precedence as `.` ↵Timothee Cour2021-08-251-5/+29
| | | | | | | | | | | | | | | | | | | | | (#18711) * fix RFC #341: dot-like operators are now parsed with same precedence as `.` * fixup * [skip ci] address comment in changelog * address comment * update grammmar * add manual entry * fixup * -d:nimPreviewDotLikeOps * address comment to unblock PR: move nimPreviewDotLikeOps out of config/config.nims
* support same-line doc comments in routines (#18595)Timothee Cour2021-07-271-0/+7
| | | | * support same-line comments in routines * remove assert as per review comment
* Make error message for empty new-styled concept more descriptive (#18506)konsumlamm2021-07-181-0/+2
| | | | | | | * Allow empty new-styled concept Slightly improve error messages * Make empty new-styled concepts an error
* Fix #16426 (#18377)Clyybber2021-06-281-5/+8
|
* Small parser loop fix (#17904)Clyybber2021-04-301-0/+1
| | | | * Fix loop on error with nim check in semiStmtList * Add test
* refs #15667 improve invalid indentation errors, report when & where `=` ↵Timothee Cour2021-04-101-4/+15
| | | | | | | | | | | could be missing (#16397) * refs #15667 improve invalid indentation errors * also show line info where = is missing * add test * add more tests
* parser.nim: simply layout changeAraq2021-03-301-1/+2
|
* unify tuple expressions (#13793)Arne Döring2021-03-301-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * unify tuple expressions * fix test * fix test * apply feedback * Handle empty tuples * Fix rendering named unary tuple * Protect static NimNode against stripping * Slightly less hacky * Revert "Slightly less hacky" This reverts commit 170c5aec0addc029f637afbc948700ca006b7942. * Slightly less hacky * Cleanup * Fix test * Fix another test * Add condsym * Rebase fallout * changelog: Move from compiler changes to language changes * Add stricter tests * Add empty tuple example to doc/astspec * Fix test Co-authored-by: Clyybber <darkmine956@gmail.com>
* custom integer literals (#17489)Andreas Rumpf2021-03-241-5/+13
| | | | | | | * user defined integer literals; refs #17020 * updated renderer.nim * use mlexerutils helper * imported all test cases from https://github.com/nim-lang/Nim/pull/17020 * final grammar updated
* new-style concepts implementation, WIP (#15251)Andreas Rumpf2021-02-241-5/+11
| | | | | | | | | | | | | * fixes #15210 [backport:1.2] * make tests green * make ordinal work * makes Swapable test compile * make Indexable example work * concepts: 'self' is now 'Self' * concepts: make Dictionary example compile * document the new concept implementation * concepts: make typeDesc work properly * concepts: allow documentation comments (d'oh)
* add finally as post expr block [backport:1.4] (#16896)hlaaftana2021-02-011-1/+5
|
* remove conditionals on nimHasUserErrors, nimNoNilSeqs2, nimNoNilSeqs (#16861)Timothee Cour2021-01-291-2/+0
| | | | | | | | | * cleanup docs for type(nil) | type(nil); simplify nimHasUserErrors * simplify nimNoNilSeqs2 * simplify nimNoNilSeqs * fixup
* Use modern enums in compiler (#15775)cooldome2020-11-021-1/+1
|
* implements https://github.com/nim-lang/RFCs/issues/258 (#15503)Andreas Rumpf2020-10-061-9/+16
| | | | | | | | | * implements https://github.com/nim-lang/RFCs/issues/258 * don't be too strict with custom pragma blocks * cast pragmas: documentation * added most missing inference query procs to effecttraits.nim
* parser hotfix: don't run into endless loops; regression (#15468)Andreas Rumpf2020-10-021-4/+16
|
* Fix #15305 (#15311)Clyybber2020-09-121-2/+1
| | | | | * Fix #15305 * Fix test
* Better semiStmtList parsing (#15123)Clyybber2020-09-091-78/+44
| | | | | | | * Better semiStmtList parsing * Add examples from forums and wiki * Move parseIfExpr near parseIfOrWhen * Update grammar
* Expand hoisted default params in sem (#15270)Clyybber2020-09-051-1/+1
| | | | | | | | | * Expand hoisted default params in sem Introduce ast.newTree{I,IT} Add test for default params in procs * Cleanup * Simplify hoist transformation and expand test
* Big compiler Cleanup (#14777)Clyybber2020-08-281-187/+182
|
* fixes #15111 (#15136)Andreas Rumpf2020-08-011-1/+3
|
* init checks and 'out' parameters (#14521)Andreas Rumpf2020-06-231-1/+5
| | | | | | | | | | | * I don't care about observable stores * enforce explicit initializations * cleaner code for the stdlib * stdlib: use explicit initializations * make tests green * algorithm.nim: set result explicitly * remove out parameters and bring the PR into a mergable state * updated the changelog
* improve the parser's error messageAraq2020-06-191-1/+1
|
* parser.nim: minor refactorings (#14540)Andreas Rumpf2020-06-011-9/+6
|
* make `from` an operator (#14241)hlaaftana2020-05-081-3/+5
|
* make case-object transitions explicit, make unknownLineInfo a const, replace ↵Jasper Jenkins2020-01-171-9/+9
| | | | a few magic numbers with consts (#13170)
* fixes #10665 (#13141) [backport]Andreas Rumpf2020-01-141-22/+26
|
* Cosmetic compiler cleanup (#12718)Clyybber2019-11-281-191/+190
| | | | | | | | | | | | | | | | | | * Cleanup compiler code base * Unify add calls * Unify len invocations * Unify range operators * Fix oversight * Remove {.procvar.} pragma * initCandidate -> newCandidate where reasonable * Unify safeLen calls