| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The strutils `delete` func with signature
func delete*(s: var string, first, last: int)
was deprecated in adba5eb45e0a, in favor of one with signature
func delete*(s: var string, slice: Slice[int])
However, a few procedures still used the deprecated form. This commit
updates them, resolving these deprecation warnings:
rstgen.nim(766, 12) Warning: use `delete(s, first..last)`; delete is deprecated [Deprecated]
strutils.nim(1651, 19) Warning: use `delete(s, first..last)`; delete is deprecated [Deprecated]
strutils.nim(1679, 7) Warning: use `delete(s, first..last)`; delete is deprecated [Deprecated]
strutils.nim(2472, 7) Warning: use `delete(s, first..last)`; delete is deprecated [Deprecated]
Before this commit:
- `trimZeros` called `s.delete(i+1, i)` for an input that lacks a
trailing zero (like "1.23").
- `removePrefix*(s: var string, prefix: string)` called
`s.delete(0, -1)` when the prefix was the empty string.
which did not modify `s`, nor raise an error. But the newer slice
`delete` raises an `IndexDefect` when the start of the slice is greater
than the end, so we avoid calling the new `delete` for such a case.
Recall that exceptions inheriting from `system.Defect` are not tracked
with the `.raises: []` exception tracking mechanism [1], so this commit
does not break existing code like:
proc foo {.raises: [].} =
var s = "abc1.20"
s.removePrefix("abc")
s.trimZeros()
doAssert s == "1.2"
The `strutils.delete` deprecation was motivated by a problem with
`system.delete` [2][3]:
`system.delete` had surprising behavior when the index passed to it
was out of bounds (it would delete the last entry then). Compile
with `-d:nimStrictDelete` so that an index error is produced
instead.
Be aware however that your code might depend on this quirky behavior
so a review process is required on your part before you can use
`-d:nimStrictDelete`. To make this review easier, use the
`-d:nimAuditDelete` switch, which pretends that `system.delete` is
deprecated so that it is easier to see where it was used in your
code.
`-d:nimStrictDelete` will become the default in upcoming versions.
A similar deprecation happened with `sequtils.delete` [4], but that
deprecated form is already not used in this repo.
[1] https://github.com/nim-lang/Nim/blob/2dec69fe5aa6/doc/manual.md#exception-tracking
[2] https://github.com/nim-lang/Nim/blob/2dec69fe5aa6/changelogs/changelog_1_6_0.md#system
[3] https://github.com/nim-lang/Nim/commit/92cb76571432
[4] https://github.com/nim-lang/Nim/commit/1d6863a7899f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* remove find optimization
close #19500
* save find to std
* add simple tests
* Apply suggestions from code review
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Co-authored-by: sandytypical <43030857+xflywind@users.noreply.github.com>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
|
|
|
| |
rfind on empty needle returns haystack len
|
|
|
|
|
| |
Revert "add `fromChar` (#20332)"
This reverts commit 846cc746a2350ad3f845a4eb0ce97b864891cd35.
|
|
|
| |
`fromChar` converts `char` to `SomeInteger`, related to `isDigit`
|
|
|
| |
Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add more Ascii Chars sets
- add UpperCaseLetters set
- add LowerCaseLetters set
- add Punctuations set
- add PrintablesNoWhiteSpace set
- add Printables set
- add isPunctuationAscii func
- add isPrintableAscii func
* Omit isPunctuationAscii and isPrintableAscii procs
* Apply suggestions for adding Wider Ascii Chars sets
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
* Update strutils.nim
Co-authored-by: Clay Sweetser <Varriount@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes the default for the `last` parameter of various `find`
routines from `0` to `-1`. Previous default prevents limiting the search
to the first character. This is a logic error, as full text search was
performed for 2 *valid* values of `last`: `0` and `last.high()`.
Adds an overload for `initSkipTable` which returns a newly initialized
table. This encapsulates every single usage of a `var`-acting original
func in this module.
Co-authored-by: flywind <xzsflywind@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix questionable suggestion in `stutils` docs
- Removes the recommendation to pass a string slice for getting a relative
index for `find` and `rfind` functions, as this currently makes a string
copy, while a simple subtraction is enough.
- Docstring for `SkipTable` type.
* Doc layout fixup
|
| |
|
|
|
|
|
|
| |
Fixes three broken cross references to `rfind` in strutils.
Breakage due to signature changes of the `rfind` methods.
Co-authored-by: adigitoleo <adigitoleo@dissimulo.com>
|
|
|
|
|
|
|
| |
* Make nimIdentNormalize return "" when passed ""; fixes #19067
Fixes #19067
* Add tests for nimIdentNormalize
|
| |
|
| |
|
| |
|
|
|
|
| |
consistent with sequtils.delete; follows #18487 (#18510)
|
|
|
|
| |
identifier` nimrtl error (#18406)
|
|
|
|
|
|
|
|
|
| |
* reuse algorithm.fill while building SkipTable
* Update lib/pure/strutils.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
|
| |
|
|
|
| |
It does not return anything.
|
|
|
|
|
| |
* use strstr for a faster find implementation
* stress the -d:release and -d:danger switches
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* fix nim js cmp fails at CT
* Add `hasClosure` to `std/effecttraits`
* type
* Update changelog.md
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
* fix #14011
* Delete ttypetraits.nim
* Apply suggestions from code review
* fix #17473
* Revert "fix #14011"
This reverts commit 0eed97a84b172b198bf4e6de69c04b84ef9d9f93.
* Update lib/system.nim
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit fixes mispellings of "occurrence" introduced by:
- 76a3b350ce0f (#17337)
- 8e8bea9044f0 (#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`".
|
|
|
| |
Clarify behaviour of char replace by adding ```every ocurrence of character```
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
| |
|
| |
|
|
|
|
|
| |
* Fix a couple of rst formatting issues
* no need for the extra space
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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
|
|
|
|
|
| |
* make cstrutils work in VM
* more
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
| |
* strip minor improvement
* add more tests
* Update tests/stdlib/tstrutils.nim
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
| |
* use funcs and inline in strutils
* use funcs
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
| |
* move tests to testament
* minor
* fix random
* disable test random
|
|
|
|
| |
The `dedent` and `unindent` links were introduced by commit d67c5cb75171
(#15264).
|
|
|
|
|
|
|
|
| |
* add parseEnumRange
* fix runnable example
* update changelog
* use parseEnumRange in compiler
* reorganise code
* add changelog, make single normalizer argument
|
| |
|
|
|
|
|
| |
* promote `collect` macro as a map+filter replacement
* Update lib/pure/collections/sequtils.nim
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
| |
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|