38 Commits

Author SHA1 Message Date
Laylie
f8294ce06e Fix scanTuple undeclared identifier 'scanf' (#24759)
Without this fix, trying to use `scanTuple` in a generic proc imported
from a different module fails to compile (`undeclared identifier:
'scanf'`):

```nim
# module.nim
import std/strscans

proc scan*[T](s: string): (bool, string) =
  s.scanTuple("$+")
```

```nim
# main.nim
import ./module
 
echo scan[int]("foo")
```

Workaround is to `export scanf` in `module.nim` or `import std/strscans`
in `main.nim`.
2025-03-10 22:47:03 +08:00
Jake Leahy
5b9ff963c5 Minor std/strscans improvements (#24566)
#### Removes UnInit warnings when using `scanTuple` 

e.g. this would emit a warning
```nim
import std/strscans

proc main() =
  let (ok, number) = "123".scanTuple()
```

![image](https://github.com/user-attachments/assets/68170ac6-402d-48b0-b8b6-69e71f4b70ae)

#### Error for wrong type now points to the passed in variable

```nim
import std/strscans

var str: string
discard "123".scanf("$i", str)
```

it gave this warning before

![image](https://github.com/user-attachments/assets/096e56d2-0eb5-4c67-9725-25caa97afebd)
now it returns

![image](https://github.com/user-attachments/assets/736a4292-2f56-4cf3-a27a-677045377171)
2024-12-25 09:27:12 +01:00
ringabout
d31cce557b more strictdef fixes for stdlibs (#24535) 2024-12-13 19:06:43 +01:00
Stephen
080a072336 Fix grammar (#23090) 2023-12-18 13:25:49 +08:00
ringabout
4d11d0619d complete std prefixes for stdlib (#22887)
follow up https://github.com/nim-lang/Nim/pull/22851
follow up https://github.com/nim-lang/Nim/pull/22873
2023-10-30 17:03:04 +01:00
Andreas Rumpf
6b04d0395a allow tuples and procs in 'toTask' + minor things (#22530) 2023-08-22 21:01:08 +02:00
Andrey Makarov
a660c17d30 Markdown code blocks migration part 8 (#22478) 2023-08-15 06:27:36 +02:00
ringabout
b2c5f6f3c8 give a deprecate warning when using newPar to construct tuple expressions (#20312)
* error/deprecate when using `newPar` to construct tuple expressions

* Update lib/core/macros.nim

* fixes
2022-09-06 21:38:08 +02:00
ringabout
e8ae2dc90b bootstrap the compiler with nimPreviewSlimSystem (#20176)
* bootstrap the compiler with nimPreviewSlimSystem

* threads
2022-08-09 16:32:29 +08:00
flywind
f8d6a53227 typo [backport] (#18967) 2021-10-07 12:01:27 +02:00
Miran
e616675c41 various small documentation improvements (#18602) 2021-07-28 14:31:13 +02:00
haxscramper
430c30299f [FIX] use mixin for strscans.scanp (#17371) 2021-03-19 20:16:52 +01:00
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
Jason Beetham
5a58440ebe Added strscans.scanTuple (#16300)
* Added since and changelog
2020-12-12 23:29:20 +01:00
Miran
2220aaeaef add support for parsing chars in scanf macro (#16240) 2020-12-03 17:34:30 +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
Miran
15ff89cec1 [backport] fix #15064, strscans.scanf edge case for '$+' (#15223) 2020-08-25 09:57:15 +02:00
Nindaleth
84c956d9da fix a few dead links and a missing sentence in documentation (#12387) 2019-10-08 15:24:34 -04:00
narimiran
dcf3181bd1 [backport] run nimpretty on string stuff 2019-09-30 13:58:13 +02:00
Tristano Ajmone
6ebbff0a11 Fix strscans Docs (#11408) [ci skip]
Amend two typos in the documentation of strscans library:

- `a ^* b` instead of `a ^+ b`.
- Remove hyphen from `$w` ASCII identifier `[A-Z-a-z_][A-Za-z_0-9]*`
  (matching `IdentStartChars` definition in parseutils).
2019-06-05 16:20:13 +02:00
xzfc
95a60dc780 Fix strscans.scanp (#9518)
* strscans: fix typo

* strscans: fix #9240

* strscans: add tests
2018-10-28 13:35:30 +01:00
Vindaar
e9addb3ab2 fix #8925 by using getTypeInst instead of getType 2018-09-17 19:34:40 +02:00
Araq
ea1c28294a fixes #8925 2018-09-15 00:32:40 +02:00
Vindaar
d34233b501 [DOC] fix typos in strscans documentation (#8885) 2018-09-05 14:57:36 +02:00
data-man
664b949d54 Better error messages in scanf. 2018-05-30 23:49:56 +03:00
Andreas Rumpf
37901b50b3 strscans module does not rely on the zero terminator anymore 2018-04-29 01:07:13 +02:00
Andreas Rumpf
1d1d6f39a3 make tests green again 2018-04-13 17:45:58 +02:00
Araq
06e68feadb strscans: fix the type checking logic; improve the documentation 2018-01-06 17:27:19 +01:00
Mathias Stearn
9bc2638399 Fix typos in scanf docs (#7035) 2018-01-06 15:08:58 +01:00
Dmitry Atamanov
6ca563dd2e Add a more number parsers to the scanf macro (#6985) 2018-01-05 17:36:56 +01:00
Andreas Rumpf
eadba5a345 make countup et al take only a single type parameter in order to prevent type guesses 2017-11-02 19:02:08 +01:00
Araq
5768eaa2fd fixes #6487 2017-10-14 22:35:20 +02:00
konqoro
ff835d56a3 Docs: add one more example in strscans module 2017-08-01 18:22:20 +03:00
Araq
51ece61f03 documentation for strscans.scanp; fixes #5154 2017-02-26 23:25:50 +01:00
konqoro
5adb639948 strscans: Fix examples 2016-12-06 20:00:21 +02:00
Andreas Rumpf
64663387db fixes #4562 2016-08-04 01:37:41 +02:00
Araq
e101773d8b added scanp macro as an alternative to pegs 2016-05-10 22:03:07 +02:00
Araq
b357e80833 added strscans stdlib module 2016-05-10 22:03:07 +02:00