Calvin Rose
c3c42ef56f
Fix case for #336 .
...
Also consider ascii 127 (delete) non-printable for string escapes.
2020-04-06 00:11:22 -05:00
Calvin Rose
a3c55681b2
Address #336 case 6
2020-04-05 21:39:39 -05:00
Calvin Rose
fcc610f539
Address #336 case 4
...
Set funcenv fields to NULL before any possible panics.
2020-04-05 19:18:59 -05:00
Calvin Rose
5bbd507858
Address #336 case 3
...
Fix error condition for bad abstract types - don't return NULL, panic.
2020-04-05 17:38:14 -05:00
Calvin Rose
b145d47863
Address cases 1 and 2 of #336 .
...
Mainly related to not checking ints < 0.
2020-04-05 08:01:18 -05:00
Calvin Rose
87ecdb8112
Change \UXXXXXXXX -> \UXXXXXX and check codepoint max.
...
No need to add two extra leading zeros, as the max unicode
codepoint is 0x10FFFF.
2020-04-05 07:09:53 -05:00
Calvin Rose
ae70a03383
Address #306 - Add unicode escapes.
...
Unicode escapes have the same syntax as go - \uXXXX or \UXXXXXXXX.
2020-04-04 21:46:08 -05:00
Calvin Rose
a0d61e45d5
Change os/perm-str to os/perm-string.
2020-04-03 15:23:29 -05:00
Calvin Rose
ff163a5ae4
Use modulo instead of remainder for even?/odd?.
...
Works better for negative and fractional numbers.
2020-03-28 10:23:28 -05:00
Calvin Rose
65379741f7
Address edge case of reduce2 when ind is empty.
...
Same for accumulate 2.
2020-03-27 12:45:40 -05:00
Calvin Rose
3eb0927a2b
Add accumulate(2) and reduce2
...
These functions are variations on reduce and can be quite useful.
Improve error message for jpm as well.
2020-03-26 21:35:11 -05:00
Leah Neukirchen
3ee43c3abb
add os/mktime, an inverse to os/date.
2020-03-18 23:45:02 +01:00
Calvin Rose
b0d8369534
Increase reference accuracy of on-stack close envs.
...
Using a bitset to indicate which stack values are upvalues, we
can more accurately track when a reference to a stack value
persists after the stack frame exits.
2020-03-18 09:30:10 -05:00
Andrew Chambers
7c4ffe9b9a
Add test cases for closure edge cases.
2020-03-18 15:40:41 +13:00
Calvin Rose
77343e02e9
Fixes #304
...
Add chr macro.
2020-03-10 22:46:50 -05:00
Calvin Rose
a3d4ecddba
Address #301
...
Incorrect bounds checking and offset calculation in buffer/blit.
2020-03-08 20:44:03 -05:00
Calvin Rose
d3b9b8d452
For #293 , correct wildcards in dictinoaries.
2020-03-07 10:13:10 -06:00
Calvin Rose
e0c9910d85
Add :range-to and :down-to to loop.
...
Fully inclusive ranges are generally useful and
do not complicate implementation much.
2020-03-07 09:34:11 -06:00
Calvin Rose
714bd61d56
Address #300
...
Check for empty capture stack in replace rule.
2020-03-06 10:05:20 -06:00
Calvin Rose
6123c41f13
Harden semantics for and and or macros.
...
There was perviously a bit of fuzziness on returning false/nil
from these macros that has been removed.
2020-03-06 08:37:59 -06:00
Calvin Rose
47e8f669f5
Fix match behavior for lone nil.
2020-03-05 09:35:00 -06:00
Calvin Rose
734c85d7ef
Properly handle recursion with labels.
...
Use an empty buffer, which has pointer equality semantics, for
tag from a label.
2020-02-23 17:35:01 -06:00
Calvin Rose
59d288c429
Add prompt
and return
.
...
User friendly delimited continuations. While this was doable with
signals before, this does not require C and will play nicely with
existing error handling, defers, and with statements.
2020-02-23 16:46:54 -06:00
Calvin Rose
20d5d560f3
Add bf to main test suite.
2020-02-22 19:18:08 -06:00
Calvin Rose
4fe005e3c3
Add righthand operator overloading.
...
This is like python. Now, we just need to readd fuzzy
comparisons to have what python needs. Overloading
math functions would be neat, too.
2020-01-22 18:59:41 -06:00
Calvin Rose
7c92c64730
Remove mutable operators on inttypes.
...
Mutations break hash table invariants, are a rather
silly performance optimization for a language like Janet.
2020-01-21 17:47:34 -06:00
Calvin Rose
962cd7e5f5
Add when-with and if-with
...
This is useful for reading from files.
2020-01-15 22:56:40 -06:00
Calvin Rose
65be9ae095
Add defer and assert to the core.
2020-01-15 22:39:14 -06:00
Calvin Rose
a68ee7aac6
Update Copyright 2020.
2020-01-12 10:50:37 -06:00
Calvin Rose
f0e04e734c
Test for regressions in #249
...
Use two separate natives in compiled executable.
2020-01-12 10:45:59 -06:00
Calvin Rose
3d40c95e80
Add ability to Janet signal from C functions.
...
While C functions are not re-entrant, signaling from a C function
can be used to implement async returns. When resuming a fiber that
signalled from within a C function, the fiber is started after the
instruction that emitted the signal. The resume argument is used
as the return result from the c function.
2020-01-10 20:44:16 -06:00
Calvin Rose
c6b639b939
Add comptime error test.
2019-12-31 12:16:19 -05:00
Calvin Rose
b872ee024f
Add test for issue #232
2019-12-31 11:36:21 -05:00
Andrew Chambers
c2f8441572
Add file/temp.
2019-12-30 12:00:35 +13:00
Calvin Rose
022be217a2
Remove ==, not==, and order[<,<=,>,>=].
...
This unifies equality and comparison checking. Before, we had
separate functions and vm opcodes for comparing general values vs.
for comparing numbers, where the numberic functions were polymorphic and
had special cases for handling NaNs. By unfiying them, abstract types
can now better integrate with other number types and behave as keys.
For now, the old functions are aliased but will eventually be removed.
2019-12-28 16:04:15 -05:00
Calvin Rose
f1afc5b0b4
Address #214
...
This adds several common patterns, which are defined in
boot.janet. This essentially gives more primitive patterns
to work with out of the box.
Fix build when JANET_REDUCED_OS is defined.
2019-12-14 20:39:14 -06:00
Calvin Rose
49954c7a30
Remove top-level unquote for comptime macro
...
True top level unquote currently requires basically double compilation
as it currently stands. Also, implementing such double compilation
looses all source mapping information. This is a compromise
implementation that makes it clear that this works differently than
a true top-level unquote.
2019-12-04 19:53:13 -06:00
Calvin Rose
2487162ccf
Add top level unquote and macro envs.
...
This improves macros that eval their arguments and
makes them easier to write.
2019-12-04 18:39:13 -06:00
Calvin Rose
4199c42fe2
Add support for nested quasiquotation.
...
This brings Janet more in line with Scheme,
Common Lisp, and Clojure.
2019-12-04 16:40:53 -06:00
Calvin Rose
70328437f1
Add math/rng-buffer.
...
Allow math/seedrandom to use buffer as seed.
2019-12-03 20:33:21 -06:00
Calvin Rose
600bed9f6d
Merge pull request #209 from andrewchambers/cryptorand2
...
Add os/cryptorand.
2019-12-03 19:12:32 -06:00
Andrew Chambers
0ac5b243c7
Add os/cryptorand.
2019-12-04 14:02:37 +13:00
Andrew Chambers
9911c90b1d
Handle missing get case.
2019-12-04 13:58:21 +13:00
Andrew Chambers
5ae520a2c9
Integers convert to plain number strings.
...
A user can use (type n) to find the true type, the old behavior did not
seem useful for most uses of the string function.
2019-12-01 23:10:52 +13:00
Andrew Chambers
ded08b6e1e
Add truthy? to core.
2019-12-01 14:34:41 +13:00
Calvin Rose
688d297a18
Address Issue #184 .
...
Fix strtod.c with better range checking to prevent DOS.
2019-11-28 23:23:37 -05:00
Andrew Chambers
07db4c530e
Add os/environ.
2019-11-28 19:00:52 +13:00
Calvin Rose
74d51ab08b
Address issue #180 - string/check-set
...
Fix the function and add test to further clarify that
implementation is correct. Also fix empty string case.
2019-11-25 20:33:16 -06:00
Andrew Chambers
976dfc7195
Minor fixes for parser
...
Check length before dereferencing buffer in tokenchar.
Check keywords are valid utf-8.
Fix minor typos.
2019-11-24 08:19:04 +13:00
Calvin Rose
16f6261b44
Improve randomness of numbers from new rng.
...
First few numbers are very biased.
2019-11-10 17:44:59 -06:00