~technomancy/fennel

Allow binary build paths to be overridden again.
Bump version to 0.9.0-dev.

This will probably be 1.0.0 but let's not jump to conclusions.
Perform cross-compilation for arm32; upgrade binaries to 5.4.2
Temporarily remove arm32 from release task.
Don't escape all control codes, just ones with backslash-letter form.

This removes the use of backslash-number control code escapes
altogether, since it can't be used safely when adjacent to normal
digits in a string.
Allow parsing of comments as an opt-in feature.

Normally we discard comments during parsing because it would be
confusing in macros to have to deal with nodes that have no semantic
value. But sometimes when you want to use the parser standalone (for
instance, when formatting code) you want the comments included.

Separated out the parser tests into their own file.
Ensure consistency in compiler opts key naming.

We should use Lua-friendly key names for keys to the
compiler. Fennelview keys can use Fennel-friendly keys because it's
more likely to be called from Fennel, but options to the compiler
itself should be consistently camelCase.
Escape some control codes in strings that precede digits.

This doesn't handle all of them and is not a complete fix.

Addresses https://todo.sr.ht/~technomancy/fennel/43
Wrap all literals in parens when looking up with dot accessor.

Fixes https://github.com/bakpakin/Fennel/issues/343
Document lua special form.
Fix ci target for makefile; bump dev version.
integrate fennelview into compiler

Tests are working on Lua 5.4 at least, and I've modified Makefile to
compile fennelview.lua from the new location. We now expose `view`
function from `fennel` public API.  Also I've added `view` as a
special to compiler environment, so now there's no need to require
`:fennel.view` in macros anymore.  `macrodebug` now also always uses it
and never fallbacks to `tostring`.

(The latter was a pain point for me when I've been working on my test
suite, and wanted to pretty print data in error results, but requiring
fennelview failed because I don't ship it, so I think this is good
option to have)

I've fixed failing test, and rebased on the current changes from main.
Don't mark things as experimental any more.
Fix error handling in repl reload command.

The on-values function takes a table of values, not separate arguments.

Fixes https://github.com/bakpakin/Fennel/issues/342
In assert-compile, don't assume ast argument is a table.

It shouldn't be a problem if a macro calls assert-compile with an ast
which is a non-table value, since the caller of the macro could
provide just about anything as the argument in question. Rather than
making every macro check for a table before calling it in
assert-compile, we should do the check once inside assert-compile. If
a non-table is provided, fall back to "unknown" values.

Note that this needs to be done twice, once for "friendly" errors and
once for the simpler fallback "unfriendly" assertions.

Fixes https://todo.sr.ht/~technomancy/fennel/38
added check in [i]collect macros for extra body expressions
better multi-line printing based on resulting length

This patch adds new `line-length` option to fennelview options
table. This option triggers multi-line output for tables, which
single-line representation at given indentation level will result in a
greater number, than one specified with the option.
Tables are no longer printed multi-line only because they contain
nested tables.

It also inverts the behavior of `__fennelview` second return value,
now it will be used to force multi-line output instead of forcing
single-line, which plays much nicer with introduced `line-length`
option. The check is now automated, so `__fennelview` can return just
table of lines most of the time, and `fennelview` will produce
multi-line output when needed.
Fall back to naive indentation in tests when utf8 is missing.

When we're running on older Lua versions we have no way to determine
that multi-byte characters are actually single characters, so we have
to indent incorrectly and test for that instead.
fennelview rewrite

This patch completely re-implements fennelview.fnl module, in order to
produce more concise indentation of printed data structure
representations, also changing how __fennelview metamethod works, to
make it possible to implement indentation semantics for custom data
structures.

This is a pretty big change, so I've tried to write as many new tests
as I could, and all existing tests remain working without
modifications (except for test-macrodebug which used its own line
concatenation method).

From now on fennelview will pretty-print tables in a more Lisp-y way,
putting opening and closing delimiters on the same line as the first
and last items in the table.  This required major changes in
indentation calculation algorithms, and modification of __fennelview
metamethod.

In this implementation __fennelview metamethod accepts 4 arguments.
First argument is a table being serialized, second argument is a
function, that holds fennelview function, third argument is the same
set of options as fennelview takes, and fourth argument is current
amount of indentation.  Nested data structures can receive meaningful
indentation amount from __fennelview and be printed correctly.

This requires __fennelview to return a table of strings, each
representing individual line, indented as if the data structure were
the only one printed.  Alternatively __fennelview can return a string,
which can be useful if you know if your data structure is never
multi-line, or you need to implement custom algorithm that transforms
data structure to single line more meaningfully (for example, if you
want key and value pairs to be separated with double spaces).

Inside __fennelview metamethod, the Options table contains same
options that were passed to fennelview, and also a new visible-cycle?
function - an fennelview API function to detect, and save information
about cycles in tables.  Should be used in combination with
options.seen table when __fennelview implements cycle
detection. fennelview function also accepts additional boolean
argument, which controls if strings should be printed as a
colon-strings when possible.
Use icollect in deep-tostring.
Next