Commit Graph

296 Commits

Author SHA1 Message Date
ee7
b70e33f5bb strutils: improve doc comments for replace funcs (#17427)
This commit fixes mispellings of "occurrence" introduced by:
- 76a3b350ce (#17337)
- 8e8bea9044 (#17339)
and adds the same "every occurrence of" in the `replaceWord` func.

Other changes:
- Prefer "replace with" to "replace by".
- Be more consistent with "the" - prefer "of the character" given that
  we wrote "by the character".
- Try to be more consistent with writing the types - add
  "the string `sub`" given that we wrote "the character `sub`".
2021-03-20 13:22:50 +01:00
Héctor M. Monacci
8e8bea9044 Clarify behaviour of char replace (#17339)
Clarify behaviour of char replace by adding ```every ocurrence of character```
2021-03-19 11:19:41 -07:00
Héctor M. Monacci
76a3b350ce Clarify behaviour of ``replace`` (#17337)
* Clarify behaviour of ```replace```

Clarify behaviour of ```replace``` by adding the word ```every```

* Update lib/pure/strutils.nim

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

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
2021-03-11 14:05:57 +01:00
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
flywind
3f38f8fbb7 add strbasics.strip (#16280) 2021-02-24 10:22:47 +01:00
Danil Yarantsev
4e619a6bea A few rst doc fixes (#17151)
* Fix a couple of rst formatting issues

* no need for the extra space
2021-02-23 08:59:13 +01:00
Timothee Cour
b9994925f5 remove all uses of condsyms symbols defined prior to bootstrap nim 0.20.0 (#16918)
* nimNoArrayToCstringConversion deadcode
* nimbabel deadcode
* nimHasalignOf deadcode
* nimvarargstyped deadcode
* nimhygiene deadcode
* nimNewTypedesc deadcode
* nimlocks deadcode
* nimHasCppDefine deadcode
* nimHasRunnableExamples deadcode
* nimHasNilChecks deadcode
* nimSymKind deadcode
* minor macros refactoring
* nimVmEqIdent deadcode
* nimNoNil deadcode
* nimNoZeroTerminator deadcode
* nimHasSymOwnerInMacro deadcode
* nimVmExportFixed deadcode
* nimNewRuntime deadcode
* nimAshr deadcode
* nimUncheckedArrayTyp deadcode
* nimHasTypeof deadcode
* nimErrorProcCanHaveBody deadcode
* nimHasHotCodeReloading deadcode
* nimHasSignatureHashInMacro deadcode
* nimHasDefault deadcode
* nimMacrosSizealignof deadcode
2021-02-17 09:32:36 +01:00
flywind
c04f305bf7 make cstrutils work in VM (#16590)
* make cstrutils work in VM

* more
2021-01-05 17:52:26 +01:00
flywind
5fb56a3b2c refactor cmpIgnoreStyle and cmpIgnoreCase (#16399)
* init

* support strutils

* more

* better

* Call len once per string/cstring

* Change var to let

* Compare ternary on first char

* More appropriate param name

* fix

* better

* one test

* impl

* more efficient

* minor

Co-authored-by: Clyybber <darkmine956@gmail.com>
2020-12-31 11:54:40 +01:00
flywind
417c2509c4 strip minor improvement (#16444)
* strip minor improvement
* add more tests
* Update tests/stdlib/tstrutils.nim

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
2020-12-23 11:57:48 +01:00
flywind
8cd3655dee make the docs of strutils a bit better (#16368) 2020-12-17 13:37:32 +01:00
ee7
84fea7c144 strutils.nim: Use func everywhere (#16281)
* strutils.nim: procs with {.noSideEffect.} -> func

* strutils.nim: procs without {.noSideEffect.} -> func

* strutils.nim: proc -> func for links

* strutils.nim: proc -> func in doc comments

* test: add strutils to strictFuncs test

* test: proc -> func in errmsg test
2020-12-07 17:07:12 +01:00
flywind
baf37b5cc7 use funcs and fix links in strutils (#16277)
* use funcs and inline in strutils

* use funcs
2020-12-07 10:41:25 +01:00
Bung
5a43a20f53 toXXAscii use xor op, saving 30%~50% time (#16193)
* toXXAscii use xor op, saving 30%~50% time

* Update lib/pure/strutils.nim

Co-authored-by: hlaaftana <10591326+hlaaftana@users.noreply.github.com>

* Update lib/pure/strutils.nim

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: hlaaftana <10591326+hlaaftana@users.noreply.github.com>
2020-11-30 18:24:12 +01:00
flywind
cbc793b30b move tests to testament (#16101)
* move tests to testament

* minor

* fix random

* disable test random
2020-11-24 19:06:41 +01:00
ee7
42c434fa3d Docs(strutils): Fix broken links (#15912)
The `dedent` and `unindent` links were introduced by commit d67c5cb751
(#15264).
2020-11-11 10:37:14 +08:00
cooldome
d62f3627aa EnumUtils, speed up findStr in compiler (#15777)
* add parseEnumRange
* fix runnable example
* update changelog
* use parseEnumRange in compiler
* reorganise code
* add changelog, make single normalizer argument
2020-11-03 16:26:16 +01:00
Timothee Cour
235e4930ab simplify toHex (#15821) 2020-11-02 14:48:36 +01:00
Miran
ec059240b0 promote collect macro as a map+filter replacement (#15788)
* promote `collect` macro as a map+filter replacement

* Update lib/pure/collections/sequtils.nim
2020-10-30 10:12:01 +01:00
Miran
c0fdc8b215 fix toHex - make it work with int literals (#15770) 2020-10-30 10:04:53 +01:00
Miran
eb2a4961c7 various documentation fixes [backport] (#15422) 2020-09-29 23:43:12 +02:00
Clyybber
d67c5cb751 Add strutils.indentation and make unindent use it (#15264)
* Add strutils.indentation and make unindent use it

* Code style

* Fix bootstrapping

* Improve wording

* Fix test

* Introduce without breaking change

* Fix

* Reduce diff

* Fix docs link

* Add since annotation

* Update changelog
2020-09-22 10:43:12 +02:00
Yuriy Glukhov
28a64869f0 Fixed undeclared nimIdentNormalize compilation error in parseEnum (#15343) 2020-09-16 19:41:57 +02:00
Miran
4fb17bc03b fix #15257, toHex couldn't handle large uint64 (#15261) [backport:1.2] 2020-09-04 09:23:27 +02:00
Bung
e2b1491905 Fix #11352 strutil.insertSep() fails on negative numbers (#15087)
* fix #11352 strutil.insertSep handle negtive number

* test for #11352

* optimize

* not parts string var

* Update lib/pure/strutils.nim

Thanks!

Co-authored-by: alaviss <leorize+oss@disroot.org>

* need to be countdown

Co-authored-by: alaviss <leorize+oss@disroot.org>
2020-07-28 11:47:22 +02:00
Juan Carlos
cbcaf2bbc4 Clean out strutils (#14859)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
2020-07-01 23:16:50 +02:00
Andreas Rumpf
da29222f86 init checks and 'out' parameters (#14521)
* 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
2020-06-23 10:53:57 +02:00
Kaushal Modi
bf0e1c696f Remove the uses of {.procvar.} pragma (#14359)
This pragma did nothing.

Ref:
- https://github.com/nim-lang/Nim/issues/2172#issuecomment-383276469
- https://github.com/nim-lang/Nim/issues/12975
2020-05-15 23:37:24 +02:00
hlaaftana
3e060cfb0a => supports pragmas & names (+ changed behavior) (#14200)
* => supports pragmas & names (+ changed behavior)

(x, y: int) is now parsed as (x: int, y: int) instead of
(x: auto, y: int) inside => and ->.

* fix pragma check

* fixes, use since & LHS of -> supports pragmas
2020-05-03 10:22:49 +02:00
Andreas Rumpf
cc60caedb3 fixes #14054 [backport:1.2] (#14061)
* fixes #14054

* make tests green again

* more tests are green

* maybe now
2020-04-30 06:48:57 +02:00
Vindaar
d42c5a575d base parseEnum on a case statement, fixes #14030 (#14046)
* base `parseEnum` on a case statement, fixes #14030

* apply simplifactions / clean up, remove `norm` node, use strVal

* export `normalize` in json.nim

* cmp using nimIdentNormalize, error at CT if ambiguous enum found

`nimIdentNormalize` provided by @cooldome.

We track all names of the branches we have created so far and error if
a duplicate is found.

Dummy change to make github react...

* fix docstring of `nimIdentNormalize`

* make `typ` arg `typedesc`, add lineinfo, call norm. only once
2020-04-22 09:41:56 +01:00
Clyybber
fb94836bc7 Tiny since cleanup (#13286) 2020-01-28 20:02:07 +01:00
hlaaftana
e7744b0909 Rename isNilOrWhitespace to isEmptyOrWhitespace and make it use allCharsInSet (#13258)
* Rename isNilOrWhitespace to isEmptyOrWhitespace

* Make isEmptyOrWhitespace use allCharsInSet(Whitespace)
2020-01-26 14:02:07 +01:00
Andy Davidoff
bd8f49cbd3 replace some runtime repr in stdlib for gc:arc (#12716) 2019-11-25 10:13:30 +01:00
b3liever
0c4d81241a Version of trimZeros without temp strings (#12633) 2019-11-11 12:54:17 +01:00
Andreas Rumpf
3ba3307d61 remove deprecated procs (#12535) 2019-11-05 11:05:46 +01:00
Miran
ffa9a7405f fix #8242, fix #12586: fix 'formatFloat' with 'precision = 0' (#12592)
* fix #8242, fix #12586: fix 'formatFloat' with 'precision = 0'

'formatFloat' with 'precision = 0' now gives the same result
(a number without a decimal point) in all backends.
This is compatible with Python's formatters, too.

* fix failing tests

* add changelog entry

* add version switch
2019-11-05 10:31:23 +01:00
Arne Döring
99078d80d7 introduce csize_t instead of fixing csize (#12497) 2019-10-31 19:18:12 +01:00
Jjp137
3ad48069d3 Fix word wrapping 2019-10-22 17:59:12 -07:00
Jjp137
93461aee34 Fix many broken links
Note that contrary to what docgen.rst currently says, the ids have
to match exactly or else most web browsers will not jump to the
intended symbol.
2019-10-22 17:59:12 -07:00
Andreas Rumpf
889b745b2b Revert "Fixes #12187 (#12321)" (#12447)
This reverts commit 00c31e8766.
2019-10-18 15:59:22 +02:00
Clyybber
00c31e8766 Fixes #12187 (#12321)
* Fixes #12187
* Point to fork of compactdict
Since the original repo is now archived / read-only
2019-10-08 14:15:47 +02:00
Ridho Pratama
678775601a Fixed sizeOf to sizeof (#12347) 2019-10-03 19:38:37 +02:00
narimiran
dcf3181bd1 [backport] run nimpretty on string stuff 2019-09-30 13:58:13 +02:00
Federico Ceratto
39290cf88c Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
Araq
c94647aeca styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error 2019-07-10 12:42:41 +02:00
Miran
23e95dc629 [bugfix] fix delete in strutils and sequtils (#11535) 2019-06-20 21:04:37 +02:00
narimiran
cf47c2c60c [other] documentation: deprecation comments are now auto-generated 2019-06-19 14:21:46 +02:00
Charles Blake
6dc6487311 Disambiguate idents now that all 3 rfind's are included in the RTL. 2019-06-15 03:46:21 -04:00
Charles Blake
e7188cdfa8 Add missing ,int to type signature in doc comment references. 2019-06-13 10:20:43 -04:00