Calvin Rose
54a04b5894
Fix some more recursion issues with pegs.
...
A keyword reference only counts as visited if we have
it as cached in the memoized->table, and we know it was
originally referenced from the same grammar table. If these
two conditions are true, then compilation must work correctly.
Also add janet_table_get_ex.
2019-08-29 19:56:04 -05:00
Calvin Rose
8bc8709d0e
Try to address memoization problem in pegs.
2019-08-29 19:09:43 -05:00
Calvin Rose
133ad0d355
Add test for longstring matcher using backmatches.
2019-08-24 19:02:55 -04:00
Calvin Rose
711fe64a51
Add backmatch operator to pegs.
...
(backmatch [tag?]) is similar to a back reference in regular expressions
(NOT to backwards capture in a peg). It only matches a pattern if
it exactly matches the text of the last capture. It does not consume
or push any captures to the capture stack.
2019-08-24 18:57:01 -04:00
Calvin Rose
9ba8728176
Update module system.
...
Add relative imports and path normalization. This should
help towards a more composable build/dependency system.
2019-06-18 22:10:13 -04:00
Calvin Rose
bbcfaf1289
Fix use after free bug in buffer/format when printing self.
2019-05-08 15:25:25 -04:00
Andrew Chambers
1759252071
Fix use after free in buffer/push-string.
2019-05-08 10:49:25 -04:00
Calvin Rose
1596511175
Fix undefined behavior bug with errors.
...
janet_vm_return_reg should only be set when janet_continue
is called. Otherwise, a panic may dump it's error message in
the wrong place, resulting in undefined behavior (often showing
the last return value or worse, segfaulting).
2019-04-10 23:29:40 -04:00
Calvin Rose
c6edf03ae8
Fix some code style, add tuple/type function.
...
We need to be able to detect tuple type from janet code, otherwise
tuples will contain hidden state. The tuple/type function is able
to detect the flags in the tuple so the programmer can access them
if needed.
2019-02-09 12:21:11 -05:00
Calvin Rose
f284776490
Address #24
2019-01-28 20:30:45 -05:00
Calvin Rose
e755f98300
Address #23
2019-01-25 20:31:08 -05:00
Calvin Rose
b4934ceddc
Make parser errors a bit better for files with no closing
...
delimiters.
2019-01-17 23:43:46 -05:00
Calvin Rose
2c1b506213
Add tagged captures for a better (more correct) form of look behind.
2019-01-16 22:38:11 -05:00
Calvin Rose
612a245961
More work on peg. Disable indexed backrefs and replace substitution
...
with accumulation.
2019-01-16 21:11:55 -05:00
Calvin Rose
4eeadd7463
Add optional form to peg (shorthand for (between 0 1 patt)).
2019-01-15 14:08:03 -05:00
Calvin Rose
3a9b50ea4a
Update peg doc and remame some peg specials.
2019-01-14 22:17:13 -05:00
Calvin Rose
90313afd40
Update PEG documentation and peg syntax.
...
Disable tail calls in the root scope for better
stacktraces, as the root scope may contain a single call
to a failing function, as in the case of the test suite.
2019-01-14 20:41:32 -05:00
Calvin Rose
d0ec89c7c1
Update Matchtime captures to not include all of the
...
matched text automatically, and fix pattern recursion
in grammars.
2019-01-14 17:44:21 -05:00
Calvin Rose
170e785b72
Fix recursion in grammars.
2019-01-14 15:06:35 -05:00
Calvin Rose
192705113e
Add Matchtime captures to peg (Equivalent to LPegs lpeg.Cmt).
...
This allows that pattern to call an external function to
check if some text should match or not. This allows for
matching any possible language a computer can recognize.
2019-01-14 11:45:45 -05:00
Calvin Rose
ff0d3a0081
Compile pegs to bytecode with (peg/compile). Peg
...
performance is improved, and peg syntax has been expanded with a few
more keywords.
2019-01-13 23:54:41 -05:00
Calvin Rose
798c88b4c8
Update peg to allow functions over captures. Update C API
...
to make janet function calls easier and faster from C (still
needs an object pool for fibers, though). Fix bug in scan-number
and add many more peg tests.
2019-01-12 17:31:15 -05:00
Calvin Rose
83f4a11bf3
Add some more tests, add parameterized captures to patterns,
...
and fix some bugs.
2019-01-12 11:04:47 -05:00
Calvin Rose
d7626f8c57
Add more capturing capabilities including substitutions, as well
...
as back references for PEGs. More documentation is needed for PEG
syntax, but the amount required will need an external document, not
just a docstring.
2019-01-12 10:16:25 -05:00
Calvin Rose
40845b5c1b
Initial peg implementation. Tree walk interpretted with
...
no captures, so not yet ready.
2019-01-11 19:22:24 -05:00
Calvin Rose
16ebb11181
Add buffer/bit functions and buffer/blit. Expose janet_gethalfrange
...
in the C api for less duplicated range checking code.
2019-01-09 13:25:51 -05:00
Calvin Rose
5b1a3b8208
Make grammar tool completely generate grammar from scratch.
...
Remove grammar from source tree.
2019-01-08 19:59:54 -05:00
Calvin Rose
67f26b7d72
Fix = should have been ==. Add some tests for vm type asserts.
2019-01-08 12:26:01 -05:00
Calvin Rose
d5bab72620
Add a test for making method calls
2019-01-07 14:54:39 -05:00
Calvin Rose
6f3bc3d577
Update copyright date, fix types, remove trailing whitespace.
2019-01-06 03:23:03 -05:00
Calvin Rose
5b62c8e6db
Better working panic implementation and more cleanup in main vm loop.
2019-01-05 00:33:20 -05:00
Calvin Rose
b9c0fc8201
Allow calling keywords and symbols as functions to look
...
themselves up in a data structure. Allow calling a data
structure to look up the argument.
2019-01-03 22:48:43 -05:00
Calvin Rose
a679f60e07
Add assembly test.
2019-01-02 19:58:27 -05:00
Calvin Rose
0d4ab7dee0
Add some more test cases for bad arities.
2018-12-30 18:44:00 -05:00
Calvin Rose
6b4824c2ab
Fix error behavior when calling functions with incorrect arities.
2018-12-30 18:41:44 -05:00
Calvin Rose
7880d73201
Add some documentation for looping and the loop macro.
...
Also add :pairs verb to the loop macro and some more tests.
2018-12-29 17:23:31 -05:00
Calvin Rose
17283241ab
Fix bug in compiler with if form under certain conditions.
...
Begin bundled 'cook' tool for managing janet projects.
2018-12-25 15:32:42 -05:00
Calvin Rose
bc8be266f5
Update match macro to test for array/tuples and table/structs.
2018-12-08 11:04:19 -05:00
Calvin Rose
11cd1279d7
Update Makefile and fix fiber issues. When
...
creating an invalid fiber with the C api, the
program could segfault. This protects against this kind
of segafault.
2018-12-02 15:29:21 -05:00
Calvin Rose
52c919d96f
Add qq (, uq and uqs) for a quasiquote macro.
...
quasiquoting is not (yet) supported as a special
form and has no syntactic sugar.
2018-11-30 01:58:52 -05:00
Calvin Rose
b2a1a4ec9b
Add classes to core library.
2018-11-25 15:58:50 -05:00