tionis
9cc0645a1e
added test for thaw and freeze
2023-05-20 17:35:25 +02:00
tionis
0f35acade1
use SIGTERM for os/proc-kill signal test
2023-05-16 18:47:38 +02:00
tionis
71d51c160d
added simple test for signal handling in os/proc-kill using :kill
2023-05-16 13:27:52 +02:00
Calvin Rose
7e65c2bdad
Fix #1130 - mod flipped for signed integers.
2023-05-11 18:15:37 -05:00
Ico Doornekamp
5cd729c4c1
Added os.strftime()
2023-05-11 06:08:19 +02:00
Calvin Rose
7d57f87007
Address #1121 - disallow extra splices.
...
This turns splices that are ignored into compiler errors. Other
alternatives here should also be considered, for example making this
a compiler warning rather than an error. For example, the latest
spork as of a3ee63c137ee3234987dbbca71b566994ff8ae8c has an error of this
kind, but the resulting program does work correctly.
Also disallow splice propagation - code of the
form (+ 1 (do ;[2 3 4]) 5).
2023-05-06 13:12:31 -05:00
Calvin Rose
4cc4a9d38b
(and ... <truthy-value> true) will return true
as per docs.
2023-05-06 10:16:05 -05:00
sogaiu
a9fae49671
Tweak long-string|bytes peg in test suite files
2023-04-30 21:55:43 +09:00
Calvin Rose
4ed3f2c662
Merge pull request #1114 from ianthehenry/drop-from-end
...
drop with a negative count now drops from the end
2023-04-24 09:16:10 -05:00
Calvin Rose
b8c936e2fe
Merge pull request #1113 from ianthehenry/catseq
...
add catseq
2023-04-24 09:07:38 -05:00
Ian Henry
54b54f85f3
drop with a negative count now drops from the end
2023-04-23 21:39:14 -07:00
Ian Henry
ccd874fe4e
add catseq
2023-04-23 21:20:01 -07:00
Ian Henry
9dc7e8ed3a
peg replacement functions have access to captures
...
When peg/replace or peg/replace-all are given a function to serve as the text
replacement, any captures produced by the PEG are passed as additional
arguments to that function.
2023-04-23 09:15:46 -07:00
Ian Henry
485099fd6e
string and peg replacement functions can now take functions
...
Functions will be invoked with the matched text, and their result will be
coerced to a string and used as the new replacement text.
This also allows passing non-function, non-byteviewable values, which will be
converted into strings during replacement (only once, and only if at least
one match is found).
2023-04-23 08:36:17 -07:00
ML
b6175e4296
Add keep-syntax
and keep-syntax!
functions
...
These functions are designed to make it easier to properly preserve the
sourcemap and tuple type in macros. This commit also modifies the threading
macros to make use of these functions.
2023-04-07 21:09:52 -04:00
Calvin Rose
aa5c987a94
Change semantics of bracketed tuple equality.
...
Comparison between different bracket and normal tuples
will now take into account the delimiter type. This solves strange
non-locality issues in the compiler due to this false equality, and is
more consistent with Janet's otherwise strong equality philosophy.
2023-03-03 18:24:02 -06:00
sogaiu
3c523d66e9
Add file/tell
2023-02-21 20:19:17 +09:00
Calvin Rose
c55d93512b
Add buffer/push-at for easier manipulation of buffers
...
buffer/blit is difficult to use, and while buffer/push is the easiet
buffer manipulation function to use it only appends to the buffer.
buffer/push-at lets users manipulate buffers at any index - useful
for buffers used as an in-memory databases, for example.
2023-02-12 11:26:00 -06:00
Calvin Rose
3e82fdc125
Update symbolmapping code with marshal/unmarshal.
2023-02-03 17:33:11 -06:00
Jona Ekenberg
fa277c3797
added future test for upvalues and symbolslots
2023-02-01 21:26:29 +01:00
Jona Ekenberg
c0c8ab25e6
added symbolslots to asm
2023-02-01 21:12:42 +01:00
Jona Ekenberg
b685bf3026
updated symbolslots-test
2023-02-01 11:46:36 +01:00
Jona Ekenberg
587aa87d28
symbolslots now use janet_v vectors, flat structure
2023-02-01 11:06:33 +01:00
Jona Ekenberg
88813c4f87
initial slotsyms implementation
2023-02-01 09:39:24 +01:00
Calvin Rose
dacbe29771
Allow round-tripping more functions with disasm and asm.
...
Nested functions that captured with environments didn't
work well with asm.
2023-01-30 09:04:42 -06:00
bakpakin
a490937cd9
Add :mingw value when getting the OS setting when compiled with mingw.
2023-01-21 11:50:03 -06:00
Calvin Rose
2093ab2baa
Update copyrights.
2023-01-07 15:04:56 -06:00
Calvin Rose
a0f40042cb
Update copyright year.
2023-01-07 15:03:35 -06:00
Calvin Rose
76be8006a4
Add channel marshalling.
2022-11-10 16:32:54 -06:00
Calvin Rose
dfc0aefd87
Merge pull request #1028 from autumnull/master
...
Made peg 'not' and 'if-not' drop their captures on success
2022-09-13 15:20:10 -05:00
Calvin Rose
356b39c6f5
Add test case for #1027
2022-09-12 19:00:59 -05:00
Autumn!
9341081a4d
Made peg 'not' and 'if-not' drop their captures on success
2022-09-12 23:07:56 +01:00
Calvin Rose
14657a762c
Fix peg RULE_SET op code when at tail of string in some cases.
2022-09-05 14:11:03 -05:00
Techcable
e78a3d1c19
Add unit tests for contains?
2022-08-26 21:47:18 -07:00
bakpakin
f8a9efa8e4
Allow binding pre-loaded symbols in windows FFI.
...
Mimic the posix RTLD_NOW setting for dlopen by iterating
opened DLLs to look for symbols.
2022-08-14 13:26:13 -05:00
Calvin Rose
2c927ea768
Add testcase for issue #1005
2022-08-02 12:34:24 -05:00
Josef Pospíšil
515891b035
Add basic test for tabseq
2022-07-02 07:43:28 +02:00
Calvin Rose
cfaae47cea
Fix trailing :pack-all or :pack in struct.
2022-06-19 13:06:19 -05:00
Calvin Rose
cbe833962b
Remove bad suite0009 test. Close #871
...
The issue is that there was no synchronization on writes.
The stability of the test relied on the fact that the server
would read in an entire message in one call to ev/read, which
would _almost_ always happen since the messages are so small.
2022-06-19 10:01:10 -05:00
Calvin Rose
b5720f6f10
On suite0009 errors for localname/peername, add info
...
Tag when the issue in the server or in the client. On windows, sometimes
these seemed to get swapped for strange reason.
2022-06-19 09:31:43 -05:00
Calvin Rose
d803561582
Fix ffi/defbind for non-lazy bindings.
...
Add testing to bind to symbols in current binary.
2022-06-18 10:14:42 -05:00
Calvin Rose
a1172529bf
Fix named arguments with optional args.
2022-06-18 09:46:28 -05:00
Calvin Rose
cff718f37d
Add suite0012 stub with delay test.
2022-06-17 17:27:42 -05:00
Calvin Rose
87fc339c45
Add named arguments with the &named symbol.
...
Similar to &keys, but more ergonomic.
2022-06-12 13:53:18 -05:00
Calvin Rose
b3aed13567
Use janet_getnat when non-negative integer needed.
2022-05-05 18:27:29 -05:00
Calvin Rose
a895219d2f
Fix #971 - remove to rule optimization
...
For to and thru, we need to restore eveytime through the loop since rules need
run with the right captures on the stack, especially if they have any
sort of backrefs.
2022-04-29 19:15:56 -05:00
bakpakin
427f7c362e
Fix os/execute regression.
2022-04-27 22:59:27 -05:00
Calvin Rose
8045e29a52
Merge pull request #932 from ishehadeh/feature/int-to-bytes
...
Add int/to-bytes: Serialize int/[su]64 to a buffer
2022-03-06 13:11:08 -06:00
Ian Shehadeh
bbb3e16fd1
int/to-bytes: return a buffer instead of a tuple
...
Buffers make more sense for this function because one of their primary
use cases is working with bytes.
The tuple implementation was an array of floats, which is less
performant and ergonomic for common operations. (i.e: bit manipulation)
Buffers also have the advantage they are mutable, meaning the user
can write ints to an existing buffer.
2022-03-05 08:21:53 -05:00
Calvin Rose
d7ea122cf7
Fix #928 - Fix hashing of negative 0.
2022-03-04 21:20:20 -06:00
Ian Shehadeh
6aea7c7f70
add int/to-bytes
...
int/to-bytes unpacks the bytes of a 64-bit integer into a tuple.
2022-03-04 08:48:54 -05:00
Ian Shehadeh
75845c0283
int/to-number: restrict input to JANET_INTMAX/MIN
...
Previously int/to-number would fail if the input was outside
the range of an int32.
Because Janet numbers are doubles,
they can safely store larger ints than an int32.
This commit updates int/to-number to restrict the
value to the range of integers a double can hold, instead of an int32.
2022-02-21 12:54:38 -05:00
Ian Shehadeh
88db9751d7
add int/to-number: converts s64 and u64 to numbers
...
(int/to-number value) converts an s64 or u64 to a number.
It restricts the value to the int32 range,
so that `int32?` will always suceeded when called on the result.
2022-02-20 16:16:52 -05:00
Calvin Rose
a097537a03
Fix #919 - strange quasiquote behavior.
...
Nested expression in the quasiquote were being compiled with the "hint"
flag passed to the expression compilation, essentially telling the
compiler to put intermediates into the final slot, possibly overwriting
other intermediate values. This fix removes that flags on any recursive
calls to quasiquote.
2022-02-09 20:31:10 -06:00
Calvin Rose
06f613e40b
Update signature of :missing-symbol hook.
...
don't take env table as explicit argument - it is already available
as the env table of the fiber.
2022-01-27 21:24:01 -06:00
Calvin Rose
61c8c1e8d2
Merge pull request #914 from pyrmont/feature.missing-symbols
...
Support looking up missing symbols during compilation
2022-01-24 18:16:53 -06:00
Calvin Rose
46738825c0
Fix formating on master.
2022-01-21 16:44:11 -06:00
Michael Camilleri
1eb34989d4
Support looking up missing symbols during compilation
2022-01-21 13:07:11 +09:00
Michael Camilleri
2f3b4c8bfb
Consolidate related tests
2022-01-21 13:02:56 +09:00
Ian Shehadeh
651e12cfe4
test nested '& destructure and empty rest array
...
This commit adds two new tests for destructure patterns with '&:
- Test that the rest array can be empty
- Test that & can be nested
2022-01-20 08:54:56 -05:00
Ian Shehadeh
71cffc973d
add test: destructure with a nested tuple before &
...
This test ensures rest patterns work when
preceded by a more complicated pattern.
2022-01-19 14:01:28 -05:00
Ian Shehadeh
db631097b1
add support for & _ to match macro
...
This commit adds support for using & _ syntax to bind the remaining
values in an array in the match macro.
The commit also adds a few tests for the new syntax in suite0008
2022-01-19 13:29:34 -05:00
Ian Shehadeh
0d31674166
remove debug print in test suite0001
2022-01-19 12:49:02 -05:00
Ian Shehadeh
cb5af974a4
POC "rest" pattern in destructuring
...
Add support for using [& rest] to match the remaining values
in an array or tuple when destructuring.
the rest pattern is implemented by pushing remaining values in the
rhs to the stack once & is found on the lhs.
Then tuple is called and the result is assigned
to the next symbol on the lhs.
This commit DOES NOT implement handling for malformed patterns.
2022-01-15 14:51:44 -05:00
Calvin Rose
ffadf673cf
Merge branch 'master' of github.com:janet-lang/janet
2022-01-08 11:27:48 -06:00
Calvin Rose
5b5a7e5a24
Make top level vars reuse ref cell when redefined at the top level.
...
This improves the repl experience while not messing with existing code
very much, if at all.
2022-01-08 11:27:08 -06:00
Michael Camilleri
30a0c77d19
Fix 'redefs' typo in test suite
2022-01-07 13:28:22 +09:00
Calvin Rose
07ec89276b
Disable file read test to help CI.
2022-01-06 20:52:21 -06:00
Calvin Rose
a37dc1af9d
Merge branch 'redefs-work'
...
- Change the global binding name from :redefs to :redef
- Simplify internal representation of "redefinable bindings"
- Store "redefinable bindings in :ref rather than :value inside the
environment entries. This makes such bindings more like vars that
can't be set rather than defs.
2022-01-06 20:45:20 -06:00
Calvin Rose
03458df140
Merge pull request #898 from pyrmont/feature.redefs
...
Support redefinable `def` and `defmacro` bindings using `:redef`
2022-01-06 20:44:18 -06:00
Calvin Rose
99cfbaa63b
Tweaks on redef feature branch.
2022-01-06 20:38:15 -06:00
Ian Shehadeh
8d8a6534e3
add test for calling ev/read on normal fd
...
The test is almost identical to the os/open + :write test.
The only difference is the content is read back in with :read, not slurp
2022-01-06 19:35:30 -05:00
Michael Camilleri
ea9d5ec793
Change metadata keyword back to :redef
2022-01-02 12:35:22 +09:00
Michael Camilleri
ec65f038a8
Support :dynamic-defs dynamic binding
2021-12-29 16:39:00 +09:00
Michael Camilleri
8347439644
Support redefinable bindings
2021-12-18 13:05:16 +09:00
Calvin Rose
8ff2fecb26
Update readme.
2021-12-04 13:25:02 -06:00
Calvin Rose
309c3aaeb8
Merge pull request #867 from pyrmont/feature.custom-out-functions
...
Support sending output to a function
2021-12-04 11:17:58 -06:00
Calvin Rose
6f4af5fef8
Merge branch 'master' of github.com:janet-lang/janet
2021-12-04 10:28:16 -06:00
Calvin Rose
868cdb9f8b
Fix channel packing bug.
2021-12-04 10:28:00 -06:00
Grazfather
a69799aa42
Add tests for mapping different length sequences
2021-12-03 20:47:48 -05:00
Josef Pospíšil
e6babd84f7
Fix math/gamma and add math/log-gamma
2021-11-24 10:55:32 +01:00
Calvin Rose
868ec1a7e3
Add test case for missing struct proto
2021-11-23 23:17:24 -06:00
Calvin Rose
a99500aebf
Update suite0009 assert again.
2021-11-18 20:46:26 -06:00
Calvin Rose
aa5095c23b
Update assert message in suite0009
2021-11-18 20:39:29 -06:00
Calvin Rose
6660c1da38
Don't truncate test output on failures.
2021-11-12 20:06:28 -06:00
Michael Camilleri
4e263b8c39
Support using functions with :out dynamic binding
2021-11-13 01:42:44 +09:00
Calvin Rose
425a0fcf07
Add quoted literal support in the match macro.
2021-11-08 15:33:11 -06:00
Calvin Rose
7205ee5e0a
Update test output.
2021-11-06 19:29:15 -05:00
Calvin Rose
72c5db8910
Update test suite to better distinguish functional errors with
...
localname/peername.
2021-11-06 19:19:49 -05:00
Calvin Rose
2aa1ccdd76
Update test helper to be even les noisy.
2021-11-06 11:20:09 -05:00
Calvin Rose
0284df503f
Make test output less verbose
2021-11-06 11:01:21 -05:00
Calvin Rose
39c6be7cb7
Fix #861 - parser/produce caused state to be invalid for parser/state.
...
parser/produce was leaving a counter in the root state undecremented.
2021-11-04 19:38:37 -05:00
Calvin Rose
9cc4e48124
Update changelog and allow evaluating streams with dofile.
2021-10-30 14:43:06 -05:00
Calvin Rose
34c7f15d6d
Always return port in peername and localname
2021-10-30 10:56:40 -05:00
Calvin Rose
03f99752a7
Merge branch 'master' into struct-proto
2021-10-29 16:42:34 -05:00
Calvin Rose
6e38bf1578
Use more inclusive check for the %j formatter for valid symbols.
...
We did not allow arbitrary utf8 to be printed with %j, even though the parser
allows. Thos changes uses the existing built in utf8 detectiotion to
exclude only unprintable symbols from the docstring.
2021-10-29 11:08:53 -05:00
Calvin Rose
06aa0a124d
Add math/gcd
and math/lcm
to the core.
2021-10-24 11:43:07 -05:00
bakpakin
504411eade
Update suite 009 to do read and write in parallel.
2021-09-28 12:05:28 -05:00
Calvin Rose
cccbdc164c
Add (number combinator to peg).
...
This allows using Janet's number parser without creating
intermediate strings.
2021-09-19 13:02:16 -05:00
bakpakin
40ef224a95
Update test code.
2021-09-11 10:34:08 -05:00
llmII
21b3e4052c
Don't print stuff in tests, CI looks wacky
2021-09-07 17:21:10 -05:00
llmII
077bf5ebae
Create test case for localname/peername
2021-09-07 07:12:43 -05:00
Calvin Rose
a78cbd91da
Address #753 - fix gensym regression.
2021-08-06 16:25:53 -05:00
Calvin Rose
bb5c3773f1
Fix fiber aware combinators to use general iteration instead of fiber
...
specifics.
2021-08-06 16:17:47 -05:00
Calvin Rose
2e641a266d
Merge pull request #752 from sogaiu/get-in-tweak
...
Tweak get-in behavior
2021-08-06 15:14:33 -05:00
Zach Smith
34019222c2
Make take/take-while/take-until fiber-aware
2021-08-06 15:40:29 -04:00
sogaiu
547fda6a40
Add tests
2021-08-06 10:05:34 +09:00
Calvin Rose
e76b8da269
Add semantics for closing channels.
...
This makes certain algorithms simpler as channels
now have an explicit lifetime - multiple readers can coordinate
closing without needing to ensure the same number of reads as writes.
2021-07-30 19:26:42 -05:00
Calvin Rose
f11b2c5a0d
Merge pull request #717 from yumaikas/fix-os-open-write-windows
...
Fix os open write windows, and add TerminateProcess calls
2021-07-24 07:52:40 -05:00
Andrew Owen
e8a86013da
Add fixes for :write on filestreams that come from os/open
2021-07-24 02:30:00 -06:00
Calvin Rose
230b734663
Delete jpm and related testing from this repository.
...
JPM and related functionality has been moved to it's own repository
and will be versioned separately from Janet. The distribution process
could later be modified to bundle a version of jpm with Janet but this
is perhaps not needed.
2021-07-15 20:49:41 -05:00
Andrew Owen
12cfda1f58
Add TerminateProcess to janet_proc_gc and os_proc_kill on Windows
2021-07-11 04:05:11 -06:00
Andrew Owen
96b4e71704
Add TerminateProcess to janet_proc_gc and os_proc_kill on Windows
2021-07-11 03:56:08 -06:00
Calvin Rose
da5328bae5
Merge branch 'master' of git.sr.ht:~bakpakin/janet
2021-05-31 15:14:39 -05:00
Calvin Rose
bbae43f259
Update copyright dates.
2021-05-31 13:46:02 -05:00
bakpakin
14fedbf063
Update copyright.
2021-05-31 09:53:52 -05:00
Calvin Rose
4d983e54b5
Initial struct prototype code.
...
Also add a number of cfunctions for manipulating structs
with prototypes.
2021-05-29 11:43:18 -05:00
Calvin Rose
1baab5eb61
Remove typed arrays from the core.
...
Typed arrays will instead live in an external jpm nodule.
Also, changes have been made to `jpm` to allow other natives to use the
typedarray headers.
2021-04-29 12:33:49 -05:00
Lue
64ec9f9cb6
Allow .cc file extension in jpm declare-native
2021-03-25 13:19:05 -04:00
Michael Camilleri
ec2d7bf349
Support adding arbitrary metadata to bindings
2021-03-24 09:38:12 +09:00
Calvin Rose
4fcc8075d4
Release 1.15.3
2021-02-28 13:04:24 -06:00
Calvin Rose
96513665d6
Address #641 - add undef combinator.
...
The (undef rule :tag) combinator lets a user "scope" tagged captures.
After the rule has matched, all captures with tag :tag can no longer be
refered to by their tag. However, such captures from outside
rule are kept as is. If no tag is given, all tagged captures from rule
are unreferenced. Note that this doesn't `drop` the captures, merely
removes their association with the tag. This means subsequent calls to
`backref` and `backmatch` will no longer "see" these tagged captures.
2021-02-26 17:25:09 -06:00
Calvin Rose
a5f237993d
Don't fail testing when ev disabled.
2021-02-20 10:56:54 -06:00
Calvin Rose
c68264802a
Fix #638 - update fiber status in certain cases.
...
This fixes a regression from changes to janet_try. In some cases, we
would not update the status of a fiber when signaling, which left the
fiber's status as whatever it had previously. This could lead to strange
control flow issues.
2021-02-20 10:55:16 -06:00
Calvin Rose
742469a8bc
Address #640 .
...
Allow for a zero length match at the end of a string when using the
to or thru combinators.
2021-02-19 16:10:03 -06:00
Leah Neukirchen
c16a9d8463
Fix or with zero arguments.
...
The value is nil to be consistent for and/or and all/some.
Also add some tests for and/or.
2021-02-16 19:59:03 +01:00
Calvin Rose
7e2c433abc
Fix #636
2021-02-14 14:34:52 -06:00
Calvin Rose
10dcbc639a
Immediate instuctions will now call :compare method.
2021-02-08 11:53:25 -06:00
Calvin Rose
dd8de1e9ac
Merge pull request #609 from yumaikas/master
...
Change tracev to upscope instead of using let
2021-01-22 19:02:27 -06:00
Andrew Owen
1fcaffe6b0
Change tracev to upscope, add test
2021-01-21 23:40:28 -07:00
Calvin Rose
49dcc816ae
Update os/shell to be non-blocking as well.
2021-01-18 16:44:22 -06:00
Calvin Rose
462e74ef87
Add os/proc-close to close all pipes associated with a subprocess.
...
This will not leak handles until the GC runs in most use cases.
2021-01-16 15:11:07 -06:00
Calvin Rose
a1cc5ca045
Fix #593 .
...
Also add ev/give-supervisor to the core.
2021-01-16 07:18:07 -06:00
Calvin Rose
4f2d1cdc00
Go back to a single supervisor channel per fiber.
...
We now also use the fiber mask to figure out which flags to wait for.
2021-01-12 21:35:28 -06:00
Calvin Rose
9078d3bd37
Update CHANGELOG.md
2021-01-11 18:54:50 -06:00
Calvin Rose
5e1a8c86f9
Add more network and subprocess testing with redirection.
2021-01-11 18:32:56 -06:00
Calvin Rose
bf01bf631d
More work on windows networking code.
...
Remove use of WSARecv and WSASend since for whatever reason
they seem suspect. We may want to revisit this later.
2021-01-11 18:00:31 -06:00
Calvin Rose
80c5ba32b5
Remove wait from CI testing for networking tests.
...
We want to expose any existing race conditions.
2021-01-11 15:55:12 -06:00
Calvin Rose
f0dbc2e404
Fix subprocess spawning on windows.
...
Also fix (:read stream :all)
2021-01-11 11:10:23 -06:00
Calvin Rose
4df1ac5b23
Fix some issues in os.c to diagnose improve windows subprocess code.
2021-01-11 09:06:39 -06:00
Calvin Rose
11067d7a56
Update module and rem operator for int types.
2021-01-09 14:47:43 -06:00
Calvin Rose
bcba0c0279
Fix #548 - string/split bug.
...
Also update docstrings for string/find. The 'skipping'
behavior that was documented only applies to to string/replace-all.
2021-01-05 18:54:51 -06:00
Calvin Rose
2ca9300bf7
Add sort tests.
2021-01-03 16:45:37 -06:00
Calvin Rose
87badc71d2
Remove :generate verb from loop.
...
Instead, one case use `:in` as with otehr data structures.
2021-01-03 16:38:38 -06:00
Calvin Rose
115556fcf2
Merge branch 'ev_execute'
2021-01-03 11:48:00 -06:00
Calvin Rose
62f783f1dc
Merge branch 'master' of github.com:janet-lang/janet
2021-01-03 09:26:31 -06:00
Calvin Rose
9e42ee153c
Merge branch 'master' into HEAD
2020-12-30 12:19:13 -06:00
Calvin Rose
2357b6162f
Update test-install target.
2020-12-26 15:42:13 -06:00
Calvin Rose
25ded775ad
Add array/clear.
...
Also improve map, find-index, and find to work on data structures
which do not defined length.
2020-12-18 12:37:58 -06:00
Michael Camilleri
77b79e9899
Update (parser/where) to support optional line and column
2020-12-15 14:12:33 +09:00