Commit Graph

79 Commits

Author SHA1 Message Date
Danil Yarantsev
56461c280f Change stdlib imports to use std prefix in most examples (#17202) 2021-02-28 13:17:19 -08:00
Pietro Peterlongo
57d2c293d3 fix parseChar see #16240 (#16245)
* fix parseChar

* do not introduce new double backticks
2020-12-06 10:14:55 +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
Andreas Rumpf
9a34009f00 ORC and stdlib optimizations (#15362) 2020-09-19 00:27:43 +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
Timothee Cour
b7b84fa165 parseutils: integerOutOfRangeDefect => integerOutOfRangeError (#14627) 2020-06-09 23:57:27 -07:00
Jacek Sieka
7d6cbf290a Error -> Defect for defects (#13908)
* Error -> Defect for defects

The distinction between Error and Defect is subjective,
context-dependent and somewhat arbitrary, so when looking at an
exception, it's hard to guess what it is - this happens often when
looking at a `raises` list _without_ opening the corresponding
definition and digging through layers of inheritance.

With the help of a little consistency in naming, it's at least possible
to start disentangling the two error types and the standard lib can set
a good example here.
2020-04-28 19:56:01 +02:00
Juan Carlos
46ca19ff18 Deprecate DCE:on (#13839) 2020-04-02 02:58:43 +02:00
Andreas Rumpf
dc94c81cb0 fixes #13605 (#13611) 2020-03-09 13:13:54 +01:00
Kaushal Modi
c4ff4e553e [backport] Make all parseutils examples auto-checking (#13238)
- Also fix one example's output (ikString -> ikStr, ikVar instead of ikExpr)
2020-01-23 17:14:22 +01:00
Mera
4a754ff392 [backport] Fix typo and improve in code-block of 'lib/pure/parseutils.nim' (#13231) [ci skip] 2020-01-23 06:49:27 +01:00
narimiran
b17ed2ca9c [backport] run nimpretty on parsers 2019-09-30 13:58:08 +02:00
Federico Ceratto
39290cf88c Fix spellings (#12277) [backport] 2019-09-27 07:02:54 +02:00
Alvydas Vitkauskas
a644f443bc Fix: remove pragma inline from parseBin|Oct|Hex (#11105) 2019-04-24 19:46:13 +02:00
Alvydas Vitkauskas
ae2923e5de Make parseutils.parseBin|Oct|Hex generic (#11067)
* make parsutils.parseBin generic and improve runnableExamples
* reimplement parseBin/Oct/Hex and improve runnableExamples
* update changelog.md file with parseBin/Oct/Hex and fix a typo
2019-04-24 17:26:01 +02:00
Oscar Nihlgård
86a91c1a4a Fix parseutils.parseBiggestInt regression (#10348) 2019-01-18 19:15:29 +01:00
Thomas T. Jarløv
6fb618da4b better docs: parseutils 2019-01-18 14:17:25 +01:00
Miran
214f48eae9 Remove long deprecated stuff (#10332) 2019-01-18 07:18:32 +01:00
Araq
1cb5e20620 parseutils.nim: help the codegen produce better code 2019-01-16 17:59:24 +01:00
Oscar Nihlgård
1d7e3a84fd Improve exception usage in parseutils (#10284) 2019-01-15 23:48:19 +01:00
Timothee Cour
14223c4b7f Update parseutils.nim 2018-12-05 11:27:22 -08:00
Andreas Rumpf
223e92b83a stdlib: documenation updates, the exception names have been changed 2018-10-25 07:42:45 +02:00
Andreas Rumpf
9331f06c0b parsutils: minor doc improvements 2018-10-24 21:52:33 +02:00
Vindaar
e80be6173d Add parse bin int, fixes #8018 (#8020)
* clarify `parseHexInt`, `parseOctInt` docstring and exception msgs

* add `parseBinInt` based on `parseutil.parseBin` implementation

Adds a `parseBinInt`, which parses a binary integer string and returns
it as an integer. This is based on the implementation of
`parseutil.parseBin`, removing the unnecessary parts.

* add tests for all `parse(Hex|Oct|Bin)Int` procs

* replace `parse*Int` proc impls by call to parseutil procs

Replaces the `parse(Hex|Oct|Bin)Int` procedure implementation by calls
to the `parseutil` procs, which receive a mutable argument.

Has the main advantage that the empty string as well as a "prefix
only" string, e.g. "0x" counts as an invalid integer.

Also moves the `parseOctInt` proc further up in the file so that all
`parse` procs are below one another.

* replace `var L` by `let L` in `parse` procs

There's no reason for the usage of `var` here.

* add `maxLen` optional arg for `parseutil.parse(Oct|Bin)`

Plus small change to test cases.

* update changelog about `parse*Int` procs

* fix `rejectParse` template in `tstrutils`

* make sure only `s.len` chars are parsed, if `maxLen+start` > s.len

Fixes a previous bug in `parseHex` (and now affected `parseOct` and
`parseBin`), which allowed to set `start + maxLen` to be larger than
the strings length. This resulted in an out of bounds access.

* move `parse*Int` proc change to breaking changes, add double `
2018-06-13 13:32:12 -04:00
data-man
856dc4c5c1 Fixes for parseUntil when until.len == 0 (or nil) 2018-05-25 18:52:04 +03:00
Araq
bbb0fd4eb7 remove deprecated stuff from the stdlib; introduce better deprecation warnings 2018-05-05 21:45:07 +02:00
Andreas Rumpf
a97684e277 parseutils does not depend on the zero terminator anymore 2018-04-29 01:08:01 +02:00
Jacek Sieka
72dfe176f5 remove dead code elimination option (#7669) 2018-04-23 11:02:38 +02:00
Dmitry Atamanov
6ca563dd2e Add a more number parsers to the scanf macro (#6985) 2018-01-05 17:36:56 +01:00
Andreas Rumpf
55cdaaef6f added parseutils.parseSaturatedNatural 2017-11-19 02:58:28 +01:00
Federico Ceratto
1f3e1fe758 Add link to streams module 2017-10-21 20:55:15 +01:00
Matt Riggott
c24dc7944a Add space to fix RST in captureBetween docs (#5769) 2017-05-04 20:09:24 +02:00
flyx
ac9c2126e6 Added BiggestUInt (#5378) 2017-02-13 11:20:07 +01:00
Araq
b357e80833 added strscans stdlib module 2016-05-10 22:03:07 +02:00
Araq
c55ff72ea7 split too long lines 2016-05-10 22:03:07 +02:00
Anatoly Galiulin
c34a68d76f Remove dead code 2016-03-31 10:51:40 +06:00
Anatoly Galiulin
9aa845c6b6 Add parseUInt and parseBiggestUInt functions to stdlib (parseutils, strutils) 2016-03-30 17:38:57 +06:00
Andreas Rumpf
2c2ab6884c fixes strutils.unescape; refs #3634 2016-01-17 21:29:25 +01:00
Araq
8d39669233 fixes #2909 2015-06-15 00:56:20 +02:00
Oleh Prypin
22db40e5e4 Turn some test outputs into actual tests 2015-04-21 15:59:32 +03:00
Oleh Prypin
32109a7867 Don't run non-test code when defined(testing) 2015-04-21 14:37:29 +03:00
Federico Ceratto
657dca5c3b Fix typos 2015-02-15 16:20:32 +00:00
Federico Ceratto
c95f6f117a Fix typos 2015-02-15 16:06:06 +00:00
Araq
8f587e2eab fixes #2041 2015-01-31 11:49:19 +01:00
Araq
b2d1889951 bugfix: don't overwrite the number value in case of a parsing error 2015-01-27 01:33:48 +01:00
Araq
7b480ea2ba got rid of old code that used to be required for bootstrapping 2014-12-08 08:43:56 +01:00
Araq
4523b29d7a Nimrod renamed to Nim 2014-08-28 09:59:26 +02:00
Araq
11b6958755 big rename 2014-08-27 23:42:51 +02:00
Araq
2f43fdb837 renamefest 2014-08-23 01:43:49 +02:00