Calvin Rose
2595c8a853
Properly hide private functions in boot.janet
2020-06-10 00:02:07 -05:00
Mike Beller
411c5da6d3
compare functions now work for built ins and 'objects'
2020-06-04 13:49:09 -04:00
Mike Beller
7658ea8335
primitive tests working. issues remain with polymorphic.
2020-06-04 12:46:58 -04:00
Mike Beller
81d301a42b
Initial commit of base functionality for compare
2020-06-04 12:23:54 -04:00
Calvin Rose
b68b0a256e
Start with ev module.
2020-05-28 10:39:40 -05:00
Calvin Rose
e9fdbe0c89
Merge pull request #411 from LouisJackman/make-ctrl-c-interrupt-current-form
...
Make Ctrl-C Cancel the Current Form; Only Exit if Column 0 Outside of Form
2020-05-23 11:33:19 -04:00
Calvin Rose
41f8be2c53
Fix flycheck when using the use
macro.
...
Flycheck originally expected `use` to have
the same arguments as `import`, but this is not the case.
2020-05-21 18:51:17 -05:00
LouisJackman
50df5000c2
Update older run-context code
2020-05-21 18:47:47 +01:00
LouisJackman
3c8930b72b
Get tests passing again by returning keyword rather than nil from chunks
2020-05-21 18:37:15 +01:00
LouisJackman
f0572c4d5f
Remove REPL-within-form thread-local bool
2020-05-21 18:31:21 +01:00
LouisJackman
164ed0b325
Get expected behaviour; cleanup after confirming behaviour is desired
2020-05-20 22:40:05 +01:00
Calvin Rose
e623690295
Use keywords in the assembly interface.
...
This is simply more idiomatic, removes some unused and undocumented
features of the assembly interface, and simplifies it somewhat.
2020-05-19 13:51:39 -05:00
Calvin Rose
b7cfc08fc5
Improve line and col tracking in parser.
...
Unconditionally add line and column information if
a parsed value is a tuple - before, some parsed tuples
had line and col information omitted.
2020-05-18 19:05:27 -05:00
Calvin Rose
92f0e1719b
Be less eager to set macro-form in macex1.
2020-05-18 18:37:41 -05:00
Calvin Rose
9e5f203302
Expose line, col in macros via (dyn :macro-form)
...
This exposes line and column indirectly via
tuple/sourcemap and allows interesting debug macros.
2020-05-18 18:27:35 -05:00
Calvin Rose
df32cd0aca
Update tracev macro to be simpler and single arity.
...
Reference #401
2020-05-18 17:43:41 -05:00
Calvin Rose
ae5dc8c45b
Merge pull request #401 from LouisJackman/add-dbg-core-macro
...
Add a dbg macro for easy var dumping
2020-05-18 18:30:14 -04:00
LouisJackman
b1ed5b0707
Add "trace " prefix missed out from previous commit
2020-05-18 22:02:56 +01:00
LouisJackman
e9a5cfaddd
Adopt Andrew Chamber's suggestions
2020-05-18 21:55:21 +01:00
LouisJackman
e0130e7fd7
"Literal" -> "Expression" for trace-pp msg
2020-05-17 08:18:44 +01:00
LouisJackman
fb491f0d7c
Put back erroneously deleted "Literal"
2020-05-17 08:12:54 +01:00
LouisJackman
9109e369ff
Incorporate suggestions from PR
2020-05-16 20:18:00 +01:00
Calvin Rose
1bb9a9368b
Make sure winsock2.h is included before windows.h
...
This should be true in the normal build, and especially in the
amalgamated build.
2020-05-16 12:41:26 -05:00
LouisJackman
ca3dac7e87
Return an immutable tuple instead
2020-05-16 15:50:47 +01:00
LouisJackman
59302d4f42
Return dbg values to work inside complex exprs
2020-05-16 15:42:16 +01:00
LouisJackman
fabb722c8d
Add a dbg macro for easy var dumping
2020-05-16 15:15:57 +01:00
Calvin Rose
cf670153f9
Add :fresh option to import.
2020-05-15 17:19:37 -05:00
Calvin Rose
c947bda604
Remove .breakall and .clearall conditionally.
...
If disasm not available, these functions cannot be implemented.
2020-05-12 08:52:36 -05:00
Calvin Rose
00451777fe
Add meson builds to sourcehut CI.
2020-05-12 08:46:26 -05:00
Calvin Rose
b1f76139a7
Add several configurable options - #379
2020-05-09 12:00:01 -05:00
Calvin Rose
535ab8302b
Add errorf to core.
2020-05-09 11:06:20 -05:00
Calvin Rose
e3862b86b5
Use spork indent on boot.janet.
2020-05-05 09:17:09 -05:00
Calvin Rose
f7b49a2c91
Improve use of @
in match.
2020-05-04 18:28:20 -05:00
Calvin Rose
5d1fd390a6
Fix debugger regression.
2020-05-02 23:40:00 -05:00
Calvin Rose
1dc32d5e3d
Revert inclusion of dedent.
...
Dedent has been moved to spork as misc function.
There are two many different, incompatible ways to 'dedent'
as string, and it seems rather specific to add to the core like it is.
2020-04-30 21:35:22 -05:00
Calvin Rose
bee415217d
Fix extra bindings.
2020-04-29 21:57:19 -05:00
Calvin Rose
dd458c8ab5
Make JANET_NO_ASSEMBLER not break build.
2020-04-28 23:04:24 -05:00
Calvin Rose
63e9790123
Fix flag check in pretty print.
2020-04-28 10:00:24 -05:00
Calvin Rose
70e1f3ac81
Fix regression in repl.
2020-04-28 08:20:07 -05:00
Calvin Rose
67f1872f4a
Expose debugger-env
...
This makes it easier/possible to use the debugging
functionality in a more flexible way.
2020-04-27 23:32:21 -05:00
Calvin Rose
8bbb7907d6
Run parser error handler in the correct env in run-context.
2020-04-27 20:29:16 -05:00
Calvin Rose
6b0f93ce8a
Update documentation for the -q flag.
2020-04-27 18:57:53 -05:00
Calvin Rose
80f19a0ab7
Fix behavior of -q flag.
...
Don't surpress errors at the repl.
2020-04-27 18:12:22 -05:00
Calvin Rose
d2ebf4b52d
Merge branch 'net'
2020-04-26 12:27:37 -05:00
Calvin Rose
ce7d51f9be
Add dedent to core.
...
Makes longstrings easier to use - can be combined with comptime
for overhead free long strings.
2020-04-26 11:53:26 -05:00
Calvin Rose
9bc5ac05c4
Add the parse function.
2020-04-25 12:46:32 -04:00
Calvin Rose
84974d6c56
Make repl printing work from current environment.
...
Although this "unprotects" output in the repl, people
in a repl usually want control, not protection.
2020-04-24 22:29:02 -05:00
Calvin Rose
a87015598c
Make janet_equals and janet_compare non recursive
...
This makes these operatios use constant stack space rather
than linear stackspace given the size of the inputs. This is important
to prevent certain parser input from causing a stack overflow - in
general, we try to avoid unbounded recursion.
2020-04-24 16:18:31 -05:00
Calvin Rose
c335bf5dc5
Update doc doc.
2020-04-23 12:15:12 -05:00
Calvin Rose
9b5c6112e5
The -q option no longer disables repl output.
2020-04-20 19:28:30 -05:00
Calvin Rose
42c257d0fc
Merge branch 'master' into net
2020-04-19 13:38:51 -05:00
Calvin Rose
122c77dbf6
Merge pull request #353 from andrewchambers/require
...
Fix outdated require docstring.
2020-04-19 10:44:37 -04:00
Calvin Rose
3c66cab4e7
Remove extra binding in require.
2020-04-19 09:44:02 -05:00
Calvin Rose
5c612095a1
Address #352 , #351 , Use :source argument in dofile
...
Also re-add circular dependency detection.
2020-04-19 09:38:18 -05:00
Calvin Rose
3e60e82529
Add circular dependency detection.
...
This detection will not stop compilation, as errors
in general do not stop compilation unless exit on error
is passed inside an import, but should notify the user something
is going on.
2020-04-19 09:35:14 -05:00
Calvin Rose
60f8dd0bfc
Renable :source argument to dofile.
...
Allows for some more interesting usage of
loaders.
2020-04-19 08:54:24 -05:00
Andrew Chambers
2a7008a82c
Fix outdated require docstring.
2020-04-19 23:02:35 +12:00
Calvin Rose
4ac382e553
Add alias JANET_SIGNAL_EVENT.
2020-04-17 16:27:02 -05:00
Calvin Rose
596111c988
Merge branch 'master' into net
2020-04-17 15:08:26 -05:00
Calvin Rose
3eb84fcb13
Fix some typos, make jpm repl work without a project.janet.
2020-04-16 12:11:17 -05:00
Calvin Rose
93fc11ea21
Add edefer.
...
Also improve error messages from vm internal errors.
(Show bad value, not its type).
2020-04-13 20:24:11 -05:00
Calvin Rose
1d13095d19
Merge pull request #340 from pepe/get-vs-in-last
...
Fix last for empty collection, add tests
2020-04-10 19:03:21 -05:00
Calvin Rose
5ed76f197a
Differentiate error from resume and error from resumed fiber.
2020-04-10 18:29:10 -05:00
Calvin Rose
e1f4cadf41
Add debugger to the core repl.
...
Debugger functions are prefixed by periods.
2020-04-10 17:20:23 -05:00
Calvin Rose
3b0e6357ad
Make Ctrl-G in repl show docstring for symbol.
...
Can be used to browse docs without poluting your repl session.
2020-04-10 11:36:23 -05:00
Calvin Rose
02f17bd4e4
Add sort-by and sorted-by.
2020-04-09 20:43:51 -05:00
Josef Pospíšil
b63a0796fd
Fix last for empty collection, add tests
2020-04-09 14:35:57 +02:00
Calvin Rose
081d132538
Address #321
...
Also improve docs for dofile and related functions.
2020-04-04 21:17:15 -05:00
DEADB17
57b08a57a0
Corret typo and match wording for consistency
2020-03-31 23:32:17 -04:00
Josef Pospíšil
b6b70d54ef
Fix typo flie
2020-03-31 15:31:27 +02:00
Calvin Rose
244566ccd4
Remove manual feature definitions in boot.
...
Instead, reuse features as defined in features.h
2020-03-31 07:52:20 -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
Calvin Rose
3d1de237f6
Several changes to the os module.
...
- Add os/symlink
- Add os/realpath
2020-03-24 19:47:21 -05:00
Calvin Rose
77343e02e9
Fixes #304
...
Add chr macro.
2020-03-10 22:46:50 -05:00
Calvin Rose
90b3730a0a
Merge branch 'master' into net
2020-03-07 13:34:13 -06:00
Calvin Rose
d3b9b8d452
For #293 , correct wildcards in dictinoaries.
2020-03-07 10:13:10 -06:00
Calvin Rose
c864828735
Address #293 - wildcard to match macro.
...
The _ symbol will match any value without creating a binding.
2020-03-07 09:40:02 -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
e351dde651
Update CHANGELOG.md and docs for loop and pp.
2020-03-06 17:12:06 -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
8f1527712e
Merge branch 'master' into net
2020-03-05 18:08:35 -06:00
Calvin Rose
47e8f669f5
Fix match behavior for lone nil.
2020-03-05 09:35:00 -06:00
Calvin Rose
10ec319c32
Add better debug info to amalgamated source.
2020-02-27 00:16:54 -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
05bd5767de
Add label macro.
...
A lexically scoped version of prompt is often useful.
2020-02-23 17:15:04 -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
8c41c0b6a7
Address MSVC warning.
2020-02-23 15:27:57 -06:00
Calvin Rose
6a13703e32
Add signal
and fiber/can-resume?
.
...
These additions, along with the change that user signals 0-4 cannot
be resumed, allow delimited continuation semantics, while repsecting
existing forms like `defer`, `with`, `with-vars`, etc.
2020-02-23 13:31:27 -06:00
Calvin Rose
aaabca6fc7
Make flychecker handle more kinds of defs.
...
This should help when redefining certain forms. Will also
not do functional arity checking against nil forms, as that
is the default value when a def doesn't evaluate.
2020-02-21 21:20:40 -06:00
Calvin Rose
b9a2bb8104
Fix documentation for defer.
2020-02-12 09:34:23 -06:00
Calvin Rose
8ae6ae65a1
Merge branch 'master' into net
2020-02-09 20:00:58 -06:00
Calvin Rose
f4d7fd97f6
Working TCP echo server and client.
...
Required a few changes to APIs, namely janet_root_fiber()
to get topmost fiber that is active in the current scheduler.
This is distinct from janet_current_fiber(), which gets the bottom
most fiber in the fiber stack - it might have a parent, and so cannot
be reliably resumed.
This is the kind of situation that makes symmetric coroutines more
attractive.
2020-02-09 20:00:50 -06:00
Calvin Rose
fcc09d7ea9
Clarify docs for some
and all
.
2020-02-05 21:06:39 -06:00
Calvin Rose
7f1f684b21
Merge branch 'master' into net
2020-02-03 20:46:32 -06:00
Calvin Rose
3fdc053d6c
Add flush and eflush ( #278 )
...
These functions interact with Janet's dynamically scoped
IO functions in a manner that is more useful the file/flush.
We can still redirect to a buffer without changing our code.
2020-02-03 18:14:32 -06:00
Calvin Rose
c5907258c3
Merge branch 'master' into net
2020-02-02 13:16:47 -06:00
Calvin Rose
f7ee8bd30d
Update to version 1.7.0.
2020-02-01 23:35:17 -06:00
Calvin Rose
c0d2140d14
Begin net/ module in core.
...
Humble beginnings.
2020-02-01 20:39:54 -06:00
Calvin Rose
1bdde9c4f7
Fix warnings.
2020-01-28 23:46:14 -06:00
Calvin Rose
333ae7c4f8
Make amalgamtion the default when building.
...
This way we can support fewer build configurations. Also, remove
all undefined behavior due to use of memcpy with NULL pointers. GCC
was exploiting this to remove NULL checks in some builds.
2020-01-28 23:38:52 -06:00
Calvin Rose
f7b7c83264
Address #276
2020-01-25 12:08:43 -06:00
Calvin Rose
6f9c9879ca
Add var-
...
We had defn-, def-, defmacro-, but no var-.
2020-01-24 22:52:28 -06:00
Calvin Rose
b8df47e063
Fix regression in take/drop.
2020-01-24 17:39:25 -06:00
Calvin Rose
9dad8bf56d
Remove min-order and max-order.
...
Also address #275 by exposing lflags and cflags
to declare-executable
2020-01-24 17:35:21 -06:00
Calvin Rose
689f2dcbb4
Change default import prefix.
...
Changed from `(string path "/")` to
`(string (last (string/split "/" path)) "/)`.
2020-01-24 16:54:06 -06:00
Calvin Rose
77742dec11
Add source file info on macro compiler error.
2020-01-20 16:45:57 -06:00
Calvin Rose
3cb947b37e
Fix macro errors.
...
debug/stacktrace was being called incorrectly.
2020-01-20 16:05:08 -06:00
Calvin Rose
f4ad627b54
Fix regression in while loops inside each macros.
...
There was a specialization for `(while (not= nil _) ...)` that
was incorrect when the while loop regresses to a thunk.
2020-01-19 16:25:10 -06:00
Calvin Rose
da70807292
Make autocompletion more zsh like
...
Also add a few ctrl sequences from readline, and
ignore unknown ctrl sequences.
Address #264
Adds Ctrl-n, Ctrl-p, and Ctrl-w
Ignores unknown ctrl sequences
No alt-* sequences yet.
2020-01-19 10:38:35 -06:00
Calvin Rose
064475cb8d
Add eachk and eachp.
...
These should make iterating over datastructures easier
without needing the loop macro.
2020-01-18 18:46:49 -06:00
Calvin Rose
51678c1aba
Extend power of the each form
...
This changes the implementation of the `next` function which
is now used to implement each. This let's us iterate over
more types, not just tables and structs.
2020-01-18 17:55:07 -06:00
Calvin Rose
6471b4d100
Add preliminary repl completion via tab.
2020-01-17 23:03:50 -06:00
Calvin Rose
7f9b2b34d1
Clarify import docs for dynamic bindings.
2020-01-17 18:06:00 -06:00
Calvin Rose
6d9e51e4be
Fix documentation for if-with.
...
It was the same as when-with.
2020-01-16 18:12:05 -06:00
Calvin Rose
174ff87946
Change printing of abstracts with tostring in pp
...
This change makes pretty printing not hide "abstractness".
2020-01-16 18:10:17 -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
f709d7eb40
Add module/add-paths
...
This should make it much easier to make custom DSLs work
well with the import system. No need to mess about with import paths,
things will just work.
2020-01-12 20:59:45 -06:00
Calvin Rose
a68ee7aac6
Update Copyright 2020.
2020-01-12 10:50:37 -06:00
Calvin Rose
099a957e6c
Update macex1 to properly handle break
...
Things mostly worked fine, but technically
break should be handled as a special form not a function call.
2019-12-29 16:44:53 -05:00
Calvin Rose
5142722da3
Remove aliases for deprectaed functions.
2019-12-28 17:51:05 -05: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
5b9eda5e87
Add root-env
...
This makes images smaller without needing to make sure
that no references to the root environment occur in the final
image.
2019-12-12 17:25:04 -06:00
Calvin Rose
36b2f27873
Merge branch 'master' into threads-3
2019-12-12 17:07:03 -06:00
Calvin Rose
1a6eb52f11
Add protect macro.
...
A more functional version of try catch.
2019-12-09 17:32:02 -06:00
Calvin Rose
ee646dadf2
Merge branch 'master' into threads-3
2019-12-07 12:14:44 -06:00
Calvin Rose
4a0ee5df7d
Address #215
...
Also update docs for module/expand-path.
2019-12-06 19:54:11 -06:00
Calvin Rose
4de6c2ad61
Address #211
...
Scripts run from the command line will automatically
call a main function if it exists.
2019-12-06 19:14:12 -06:00
Calvin Rose
dbcceefc20
Fix bad merge.
2019-12-04 22:41:30 -06:00
Calvin Rose
1a4035b02c
Merge branch 'master' into threads-3
2019-12-04 22:39:30 -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
f39cf702db
Address #212 - don't include janet args in script args.
2019-12-04 08:30:36 -06:00
Calvin Rose
db9e431bf7
Address #213 - disallow non-indexed ds for loop range.
2019-12-04 08:18:54 -06:00
Calvin Rose
328454729e
Add nan?
2019-12-03 21:24:22 -06:00
Calvin Rose
a1f35e21c7
Merge branch 'master' into threads-3
2019-12-03 18:11:32 -06:00
Calvin Rose
3a14aad615
Address issue #205 .
2019-12-02 18:34:08 -06:00
Calvin Rose
70c8b6838d
Use make-image-dict and load-image-dict in thread/new
...
Rather than messing with janet_core_dictionary, we
instead cache the core enevironment, and pull out the
needed tables from there. This is more flexible, more correct, and
also exposes janet_resolve_core, which can be easily used from the C
API.
2019-12-02 04:15:22 -06:00
Calvin Rose
212479188a
Have separate encode and decode dicts for threads
...
This is more correct and mirrors the way marshal -> unmarshal works.
2019-12-01 21:53:39 -06:00
Calvin Rose
6a763aac95
Work on threads.
...
Add send and receive.
2019-12-01 20:28:12 -06:00
Calvin Rose
5cd6580c2d
Merge branch 'threads-3' of github.com:janet-lang/janet into threads-3
2019-12-01 20:25:57 -06:00
Andrew Chambers
ded08b6e1e
Add truthy? to core.
2019-12-01 14:34:41 +13:00
Calvin Rose
bca0392738
First work on threading.
...
Posix only, needs to be disabled on windows. Also
the Makefile needs to be configurable, and meson.build
needs to take pthreads into account.
2019-11-26 23:13:53 -06:00
Calvin Rose
7df0ec6aed
Fix up debug/step and janet_step.
...
Also allow debugging on all signals, including errors.
This is gated behind (setdyn :debug true) in the repl.
2019-11-25 20:00:13 -06:00
Calvin Rose
d37c43716a
Lots of work on improving debugging.
...
doc macro can take no arguments and print out
all bindings. Fix an issues with the vm skipping
over a breakpoint in some situations.
Add examples/debugger.janet for proof of concept
debugger.
2019-11-24 17:45:53 -06:00
Calvin Rose
5171dfd2a8
Fix docstring.
2019-11-16 20:43:21 -06:00
Calvin Rose
bcd2089f71
Version 1.5.1
2019-11-16 17:17:13 -06:00