Commit Graph

63 Commits

Author SHA1 Message Date
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
Araq
a7911addf7 parseBiggestFloat is now builtin 2014-07-16 00:41:03 +02:00
Reimer Behrends
8b8a21cb59 Fixed parsing of float literals.
Float literals were not parsed properly when their fractional part
exceeded 53 significant bits. This affected in particular math.PI
and math.E. Rather than reinventing the wheel, this patch reuses
C's strtod() implementation, which already does the heavy lifting
with respect to correctness, though some caution is necessary to
keep float parsing locale-independent.
2014-05-23 11:27:39 +02:00
Araq
73c6efdf66 'nil' as a statement is deprecated, use an empty 'discard' instead 2014-01-19 16:54:59 +01:00
Araq
92b8fac94a case consistency part 4 2013-12-27 23:10:36 +01:00
Araq
2df9b442c6 case consistency part 1 2013-12-27 15:48:53 +01:00
Grzegorz Adam Hankiewicz
67cea2b9b5 Explains parseHex initialization quirk. 2013-07-16 01:11:20 +02:00
Araq
6c8e740b57 made parseBiggestFloat faster for large exponents 2013-07-01 00:33:11 +02:00
Grzegorz Adam Hankiewicz
72a3e21f28 Removes executable bit for text files. 2013-03-16 23:53:07 +01:00
dom96
92a7933504 The httpserver module now supports POST requests. Fix for captureBetween in the parseutils module. 2012-05-06 23:03:18 +01:00
Araq
b2746c4659 added system.setControlCHook, system.writeStackTrace 2012-02-19 23:37:37 +01:00
Araq
ccd58fba2c bugfix: semfold supports merging of '&' 2012-02-19 21:01:04 +01:00
Araq
4f1b89c30c year 2012 for most copyright headers 2012-01-02 23:07:35 +01:00
dom96
264de4537e Added ftpclient module. Fixed docs in sockets module. Added dll tests to test suite. 2011-11-04 00:22:04 +00:00
Araq
d819350145 bugfix: new GCC version requires -ldl to come after object files 2011-11-03 20:17:46 +01:00
Araq
9fb36bd20c compilation cache: mostly working; generics not yet 2011-10-25 15:26:36 +02:00
Araq
7c34357856 bugfix: $ escaping in interpolatedFragments 2011-09-26 07:45:33 +02:00