1
0
mirror of https://github.com/janet-lang/janet synced 2024-06-29 00:23:18 +00:00
Commit Graph

594 Commits

Author SHA1 Message Date
Calvin Rose
80729353c8 Add :lazy option for ffi/context for jpm quickbin usage. 2022-06-13 21:26:03 -05:00
Calvin Rose
105ba5e124 Add ffi/context and ffi/defbind helpers.
Wrap the very bare-bones FFI library to be a bit more
useful out of the box.
2022-06-12 18:48:47 -05:00
Calvin Rose
ad1b50d1f5 Update dofile function signature. 2022-06-12 18:03:23 -05:00
Calvin Rose
6d970725e7 Update boot.janet for typos. 2022-06-11 21:19:42 -05:00
Calvin Rose
c75b088ff8 Format boot.janet with janet-format. 2022-06-10 19:13:23 -05:00
Calvin Rose
33bb08d53b Merge branch 'master' into ffi 2022-06-10 16:24:55 -05:00
Calvin Rose
6d188f6e44 Improve .ppasm function. 2022-06-10 16:24:40 -05:00
Calvin Rose
c3648331f1 Expose an easy to use debugger function. 2022-06-10 15:39:29 -05:00
Calvin Rose
a5b66029d3 Expose the built-in debugger in more places. 2022-06-10 15:23:15 -05:00
Calvin Rose
282d1ba22f Implement sys v abi on x64 partially. 2022-06-06 18:54:17 -05:00
Calvin Rose
2f64a6b0cb Add parse-all function as a natural extension to the parse function. 2022-05-28 19:02:17 -05:00
bakpakin
e0b7533c39 Add toggle macro. 2022-05-12 15:36:29 -05:00
Calvin Rose
487d333024 Add module/value function to make grabbing bindings out module tables. 2022-05-05 19:24:44 -05:00
John Gabriele
471204b163
boot.janet docstrings (part 3, last part)
Added some backticks around code in docstrings to distinguish them from prose.

Also some light editing.
2022-04-20 18:31:06 -04:00
John Gabriele
9287b26042
boot.janet docstrings (part 2)
Added some backticks around code in docstrings to distinguish them from prose.

Also some light editing.
2022-04-19 01:55:37 -04:00
John Gabriele
96602612ba
boot.janet
Added some backticks around code in docstrings to distinguish them from prose.
2022-04-17 22:35:04 -04:00
Calvin Rose
e01b65fd3d Fix some printing issues for docs. 2022-04-16 11:40:33 -05:00
Calvin Rose
a964b164a6 Merge branch 'master' of github.com:janet-lang/janet 2022-04-13 17:20:49 -05:00
Calvin Rose
1aac0489d7 Add a number of defs for used dynamic bindings. 2022-04-13 17:20:33 -05:00
sogaiu
bf9a60f70d Use defdyn for syspath in boot.janet 2022-04-13 19:39:41 +09:00
Calvin Rose
4e31d85349 Address #804 - save and restore module cache when flychecking.
Calling flychecking cannot change the module cache.
2022-02-12 10:36:45 -06:00
Calvin Rose
461576e7a2 Add defdyn macro to allow docs and checking for dyns.
Using keywords for the names of dynamic bindings emphasized their
dynamic nature and how they actually work, but is opaque when it comes
to documentation and error detection. Janet uses early binding for name
resolution by default in most places, dyns should be no different.

The `defdyn` macro allows one to create aliases for keywords that can
have docstrings, be imported and exported, etc. The aliases _must_
follow the usual lisp convention of earmuffs - this is not
restricting since the underlying keyword lookup mechanism is still
completely accessible to users.

Example:

(defdyn *my-dynamic-binding* "Sends the plumbus to the thingamizer when
 enabled")

The above creates a normal binding (as created with `def`) for
`*my-dynamic-binding*` that is bound to the keyword
`:my-dynamic-binding`.

There is an optional prefix for defdyns that can be used to avoid name
collisions - *defdyn-prefix*

Example:

(setdyn *defdyn-prefix* "mylib/")
(defdyn *my-dynamic-binding* "Plumbus thingamizer")
(pp *my-dynamic-binding*)

> :mylib/my-dynamic-binding
2022-02-11 20:37:52 -06:00
Ian Shehadeh
6412768000 Add match documentation for & rest pattern 2022-01-20 09:19:21 -05:00
Ian Shehadeh
82688b9a44 add checks to & _ pattern in match macro
This commit adds 2 checks for & rest pattern in the match macro:
- & is followed by exactly 1 item
- & is followed by a symbol
2022-01-20 09:16:02 -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
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
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
sogaiu
1326ded048 Tweak match docstring 2021-12-25 16:56:10 +09:00
Michael Camilleri
939d1dcae9
Only set :current-file in run-context if source is a path 2021-12-13 12:06:58 +09:00
Michael Camilleri
bf29a54272
Clarify nested loop behaviour in loop macro 2021-12-09 10:41:56 +09:00
Calvin Rose
e8c738002b Add extra "prefix" parameter to debug/stacktrace. 2021-12-04 13:03:05 -06:00
Grazfather
139bef2142 map: Fix indexing for 3+ data structures 2021-12-03 16:15:43 -05:00
Michael Camilleri
6bf9f89429
Update location of current file in run-context 2021-11-29 10:05:04 +09:00
Calvin Rose
425a0fcf07 Add quoted literal support in the match macro. 2021-11-08 15:33:11 -06:00
sogaiu
fdc94c1353 Tweak short-fn docstring 2021-11-04 18:11:53 +09:00
Calvin Rose
9cc4e48124 Update changelog and allow evaluating streams with dofile. 2021-10-30 14:43:06 -05:00
Calvin Rose
9a06660fdb fix call to table/proto-flatten 2021-10-30 09:15:23 -05:00
Calvin Rose
5c35d24e13 Fix nil check issue. 2021-10-29 19:29:54 -05:00
Calvin Rose
fd37567c18 Docstring fix. 2021-10-29 11:13:07 -05:00
Calvin Rose
8b2d278840 Add min-of and max-of. 2021-10-26 17:46:24 -05:00
Calvin Rose
74c9cf03d0 Fix -r switch in repl 2021-10-14 17:25:12 -05:00
Calvin Rose
50bced49ad
Merge branch 'master' into use-deprecation-mechanism-for-file-popen 2021-09-21 15:15:36 -05:00
Calvin Rose
033c6f1fdb Add -i flag to run .jimage files as scripts. 2021-09-19 19:47:57 -05:00
Calvin Rose
6c58347916 Remove thread module.
Instead, use the more general and non-blocing `ev/` module.
2021-09-19 14:19:32 -05:00
Calvin Rose
b0d0d9cad2 Address #809 - treat first docstring line different from others.
Only do this if the docstring starts with an open parentheses.
2021-09-18 12:41:11 -05:00
sogaiu
d5c8eb048a Apply deprecation machinery to file/popen 2021-09-18 17:08:56 +09:00
Calvin Rose
5464a7a379 Allow passing a function to directly to ev/go.
Makes ev/call less useful but ev/go more useful. No need
to construct as many identical intermediate fibers.
2021-08-30 22:22:22 -05:00
Calvin Rose
b903433284 Merge branch 'master' of github.com:janet-lang/janet 2021-08-29 11:15:43 -05:00
Calvin Rose
9909adb665 Remove JANER_HEADERPATH from boot process.
That is a jpm thing.
2021-08-29 10:43:58 -05:00
Josef Pospíšil
29ea408980 Fix spawn-thread doc about its return 2021-08-28 15:39:49 +02:00
Calvin Rose
0ab96b8e47 Fix #771 2021-08-26 22:23:21 -05:00
Calvin Rose
846c9e5e12 Fix #759 - Add -E flag for one-liners.
Use the `short-fn` DSL here for argument passing.
2021-08-21 13:16:41 -05:00
Calvin Rose
685d2b460c Address #765. Make assert into a macro. 2021-08-21 12:27:58 -05:00
Calvin Rose
e552757edc Fix threaded supervisor channels - Fix #766
Some pointer casting with abstract types was incorrect, resulting
in strange behavior when trying to use supervisor channels that were
threaded. This fix also adds the ability to supply a supervisor channel
directly when creating a thread.
2021-08-16 21:14:06 -05:00
Calvin Rose
87b8dffe23 Deprecate the thread module. 2021-08-15 17:36:47 -05:00
Calvin Rose
97e5117a3f Fix some issues and improve channel closing.
Still not fully working, seems to be deadlock/channel issue when
sending events between threads.
2021-08-15 13:14:33 -05:00
Calvin Rose
c94d7574bc
Merge pull request #754 from harryvederci/patch-1
Improve docstring for the invert function.
2021-08-08 12:51:24 -05:00
Calvin Rose
a38cb5df18
Merge pull request #757 from subsetpark/document-match
Add documentation of @ pattern in match
2021-08-08 12:51:00 -05:00
Zach Smith
5407868620 Add documentation of @ pattern in match 2021-08-07 15:09:37 -04:00
Harry Prins
7edf77561b
Refer to argument. Change past tense to present. 2021-08-07 18:03:10 +02: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
Harry Prins
5f3378213b
Improve docstring for the invert function. 2021-08-06 18:33:49 +02:00
sogaiu
2080ac3bda Tweak get-in behavior 2021-08-06 08:24:26 +09:00
Calvin Rose
7e5f226480 Put source mapping info in stack traces. 2021-07-29 21:29:08 -05:00
Calvin Rose
40561340a8
Merge pull request #721 from uvtc/patch-1
docs for doc, searching for strings
2021-07-26 15:21:39 -05:00
Calvin Rose
030dd747e9 Merge branch 'master' of github.com:janet-lang/janet 2021-07-25 20:21:59 -05:00
John Gabriele
e356b7141c
Update boot.janet 2021-07-25 17:26:31 -04:00
bakpakin
4cae7e6d5d When building amalgamated build on windows, patch source-map.
We don't want any backslahes cropping up in the offical distribution of
janet.c.
2021-07-25 15:53:38 -05:00
John Gabriele
76acbf9bb6
Clarify docs on take and drop functions
Pass in indexed and bytes, return tuples and strings, respectively.
2021-07-24 18:44:49 -04:00
Calvin Rose
a89c377c92 Add the fiber-fn macro which slightly generalizes coro. 2021-07-22 17:59:01 -05:00
Calvin Rose
1ef6db16ed Add janet_vm_save and janet_vm_load.
This lets a user multiplex multiple Janet VMs on a single
thread or process if they are willing to implement context switching
themselves.
2021-07-16 20:59:03 -05:00
Calvin Rose
04ca945ecf Address #711 - don't persist (dyn :exit) 2021-06-24 14:51:08 -05:00
Calvin Rose
87f8fe14dd Prepare for 1.16.1 release. 2021-06-09 19:08:24 -05:00
Calvin Rose
2eadb21eb7 Update changelog. 2021-05-31 16:51:53 -05:00
Calvin Rose
69afa2a7a3
Merge branch 'master' into fix-shadow 2021-05-31 16:05:29 -05:00
Josef Pospíšil
a4325372e2 Rename level const to not to shadow line in eval1 2021-05-31 21:51:31 +02:00
Calvin Rose
4b96b73858 Add -w and -x flags to janet for linting. 2021-05-31 14:36:25 -05:00
Calvin Rose
60214dc659 Update for windows compiler warning. 2021-05-30 16:42:58 -05:00
Calvin Rose
d204e06e11 Use lint information in run-context. 2021-05-30 10:33:46 -05:00
Calvin Rose
84f82f5465 Remove code delimtiers from defn and defmacro. 2021-05-29 20:37:30 -05:00
Calvin Rose
c911f7c47e Address #694 - Update doc-format with more features.
Also allows having doc-format print in color with
(dyn :doc-color).
2021-05-29 20:34:22 -05:00
Calvin Rose
7c757ef3bf Make jpm configurable for environments like MinGW. 2021-05-26 10:07:11 -05:00
Calvin Rose
81186bf262 Merge branch 'master' of github.com:janet-lang/janet 2021-05-19 18:43:50 -05:00
Calvin Rose
eeef5b0896 Add as-macro and module/add-syspath 2021-05-19 18:18:00 -05:00
sogaiu
e5a2df93ab Make doc work for special forms 2021-05-07 08:47:33 +09: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
Calvin Rose
8fc8974b60 Add from-pairs to core. #683
This always creates a table, use `table/to-struct` to
create a struct.
2021-04-29 12:06:24 -05:00
Calvin Rose
90e5828d5d Update printing when entering debugger. 2021-03-19 15:38:46 -05:00
Calvin Rose
b3e80308d4 Change inheritance rule. 2021-03-19 15:18:19 -05:00
Calvin Rose
c9097623d6 Add group-by and partition-by to the core.
Semantics are mostly emulated from Clojure.
2021-03-04 19:34:36 -06:00
Calvin Rose
6392b37c47 Merge branch 'master' of github.com:janet-lang/janet 2021-02-28 13:05:05 -06:00
Calvin Rose
4fcc8075d4 Release 1.15.3 2021-02-28 13:04:24 -06:00
Michael Camilleri
1fea5f8fe7
Fix call to match in run-context 2021-02-28 14:23:17 +09:00
Calvin Rose
b795d13f61
Merge pull request #642 from pyrmont/feature.run-context-location
Allow source location in run-context to be updated
2021-02-26 16:36:03 -06:00
John Gabriele
be7dab4d17
Update boot.janet 2021-02-23 22:30:42 -05:00
John Gabriele
0e44ce5cba
Update boot.janet 2021-02-23 22:26:53 -05:00
John Gabriele
1f8c2781dd
sort doc
Clarify doc for `sort` and `sorted`. Also in `sort`, changed arg name.
2021-02-23 22:24:59 -05:00
Michael Camilleri
f381a9c773
Check that new source location is a string 2021-02-22 12:50:44 +09:00
Michael Camilleri
855a9a01fc
Allow source location in run-context to be updated 2021-02-22 12:38:56 +09:00
Calvin Rose
92928d5c4f Update definition of or. 2021-02-16 17:00:27 -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
Andrew Owen
926b68d62e Switch out by to before? in sort functions.
Makes docstrings easier to read, and reduces confusion with sorted-by
and sort-by.
2021-02-04 22:28:46 -07:00
Calvin Rose
d374e90033 Update sort documentation. 2021-02-04 20:11:24 -06:00
sogaiu
1c158bd4ff Tweak module/add-paths docstring 2021-02-03 21:11:16 +09:00
Calvin Rose
dd117e81c2 Fix parser/insert.
We need to add the tuple wrapping code there as well.
2021-02-02 18:55:24 -06:00
Calvin Rose
d122a75efd Cleanup boot.janet to be more like normal source code.
Don't use `undef`, just use private defines.
2021-01-31 09:08:39 -06:00
Calvin Rose
c63fe6ef8a Make flycheck follow GNU standards for errors. 2021-01-30 12:51:38 -06:00
Calvin Rose
72ec89dfe9 Change output format for line+col. 2021-01-30 11:33:15 -06:00
Calvin Rose
0b14e913da Merge branch 'master' of github.com:janet-lang/janet 2021-01-23 13:54:36 -06:00
Calvin Rose
85155bb2b4 Reference #478 Update peg/compile to use dyn for default grammar. 2021-01-23 13:54:02 -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
Calvin Rose
317ab6df6b Add ev/thread and ev/do-thread.
- Also fix setting supervisor with net/accept-loop.
2021-01-22 12:52:45 -06:00
Andrew Owen
1fcaffe6b0 Change tracev to upscope, add test 2021-01-21 23:40:28 -07:00
Calvin Rose
0acf167e84
Merge pull request #602 from pyrmont/feature.module-docstrings
Display module-level docstrings with (doc)
2021-01-20 22:11:38 -06:00
Josef Pospíšil
251486e4aa Fix ev/call doc 2021-01-20 20:31:41 +01:00
Michael Camilleri
c6467be60d
Conform display of path with existing display of source map info 2021-01-20 10:47:55 +09:00
Michael Camilleri
4dd512ad28
Use print-module-entry function to display docstring 2021-01-20 10:16:59 +09:00
Michael Camilleri
28076b9385
Display module-level docstrings with (doc) 2021-01-20 10:01:31 +09:00
Calvin Rose
49dcc816ae Update os/shell to be non-blocking as well. 2021-01-18 16:44:22 -06:00
Calvin Rose
c5da87b860 Fix broken doc format.
Many assumptions in the parsing code that could cause infinite
loops, as well as assuming things were non-nil.
2021-01-17 11:36:48 -06:00
Andrew Owen
c6aa536590 Clean up env dance 2021-01-16 12:47:50 -07:00
Andrew Owen
7f74ff3dd7 Restore :source property to keep import* working at REPL 2021-01-15 02:59:17 -07:00
Andrew Owen
c4a95e9a1e Update error handling, kill a bikeshed argument 2021-01-15 01:53:14 -07:00
Andrew Owen
71f9e2b1d7 Add support for a profile.janet
Add support for a profile.janet, along with a flag for disabling it's use.
2021-01-15 01:31:23 -07:00
sogaiu
c56b876bfe Tweak update docs 2021-01-13 23:04:06 +09: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
dfbdd17dce Add doc-of function to core for reverse documentation lookup. 2021-01-11 20:32:26 -06:00
Calvin Rose
3883460202 Remove length checks to a number of core functions.
This lets them be more generic and implemented over a wider range of
data types, such as fibers.
2021-01-11 15:01:41 -06:00
Calvin Rose
11067d7a56 Update module and rem operator for int types. 2021-01-09 14:47:43 -06:00
Calvin Rose
32e8ac912d Merge branch 'master' of github.com:janet-lang/janet 2021-01-07 18:08:08 -06:00
Calvin Rose
e403fb4652 Do not try and preload imports that are relative. 2021-01-07 18:07:47 -06:00
Josef Pospíšil
5a2a134c95 Remove redundant do 2021-01-07 14:38:58 +01:00
Calvin Rose
4e7ad3c7ce Add initial implementation for supervisor channels.
Supervisor channels are a simple concept to more efficiently
enable dynamic, structure concurrency. When a top-level fiber
completes (or errors), it will push itself to it's supervisor
channel if it has one (instead of printing a stacktrace). This
let's another fiber poll a channel and "supervise" a set of fibers.
2021-01-06 23:19:22 -06:00
Calvin Rose
f206b476d1 Fix #550 - add varfn to safe forms for flycheck. 2021-01-06 17:31:08 -06:00
Calvin Rose
dd2595c53f Merge branch 'master' of github.com:janet-lang/janet 2021-01-06 17:27:50 -06:00
Calvin Rose
545df28d71 Add flycheck function to core.
Also make flychecking work with stdin out of the box.
2021-01-06 17:27:17 -06:00
Josef Pospíšil
c7f382add6 Update doc for thread/new and remove ws in loop's 2021-01-04 18:29:00 +01:00
Calvin Rose
81f62b246c
Merge pull request #545 from felixr/master
Revert my buggy hybrid sort
2021-01-03 16:39:23 -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
e5242c67ff Update changelog and documentation. 2021-01-03 16:30:43 -06:00
Calvin Rose
4355420994 Remove function eachy.
Instead use `each`.
2021-01-03 16:19:23 -06:00
Felix Riedel
19576effbe Revert "Tweak sort: use insertion sort for small arrays"
This reverts commit 0ea77cabfb.
2021-01-03 20:09:50 +00:00
Calvin Rose
6b268c5df4 find-index now takes optional default. 2021-01-03 09:33:52 -06:00
Calvin Rose
62f783f1dc Merge branch 'master' of github.com:janet-lang/janet 2021-01-03 09:26:31 -06:00
Calvin Rose
8655530b19 Rename predicates in module/paths 2020-12-29 19:52:26 -06:00