fix kv-rest destructure codegen
If you use the "rest" syntax to destructure a key-value table, it's
supposed to work regardless of which pattern you put. We had a bug where
fennel would try to evaluate the existing value unhygenically.
(local {& a} {}) ; emitted code accesses the global `a`
(local {& my-value} {}) ;; emitted code subtracts globals `my - value`
(local {& []} {}) ;; emitted code tries to evaluate `table: 0x5555df80`
This patch replaces the bad code output with `nil`.
Tidy up compile-time detection in quote.
Also remove external references to documentation in the man page since
they're already available as man pages.
Ensure newlines get compiled as expected.
Lua messes up \r when formatting it as %q and emits it as \13
unfortunately; we don't ever want numeric escapes for things that have
better options.
See https://todo.sr.ht/~technomancy/fennel/230
Fix parser warnings to use options.warn if given.
Reorganize some parser/view tests.
Add cross-references to manual.
Skip IRC reporting if we can't determine Git remote
This means either Git is not installed, or the test is being run from a
published tarball and not a Git checkout.
In either case, that means we don't want to report the build result
(many Linux distributions also build with network access disabled, so
reporting will fail anyway) - and we should exit with status code 0, as
this is not actually an error.
Signed-off-by: Michel Lind <salimma@fedoraproject.org>
Bump version to 1.5.2-dev, but we will probably go to 1.6.0 soon.
Document .inf and .nan in the reference.
Backport special nan handling to bootstrap compiler.
Ensure that "nan" parses as a symbol (not a number) on 5.1.
add syntax for infinity and NaN
.inf and -.inf were added to represent positive and negative infinity.
.nan and -.nan were added to represent positive and negative NaN (not
a number) values. For some reason, on x86 in PUC Lua 0/0 gives -nan,
but nan on ARM, so to generate positive NaN portably across most Lua
implementations, the nan is first converted to a string and is checked
to contain a minus sign. LuaJIT and many other implementations do not
differentiate between NaN and negative NaN, so the tests only check
for positive NaN
Fix huge numbers NPE, make best effort at keeping original integer format
In Lua, numbers bigger than 1e+308 compile to inf. Prior to this
patch, Fennel compiled such numbers to inf too. However, inf is not
a number in Lua, neither it is a reserved symbol, so the expression
(+ 1e+309 1) would compile to (inf + 1) resulting in attempt to add
nil with a number, because Lua treats inf as a regular, unbound,
variable.
This patch also tries to keep the number format of big numbers, bigger
than 1e+13 and less than 1e+309 in the e-notation. Numbers less than
1e+14 are formatted as integers, as done in PUC Lua. Starting from
1e+14 the e-notation is used.
If the number is big enough to be considered inf by Lua, it is
compiled to (1/0), a portable way to express infinity, without relying
on the existence of the math table. -inf is compiled to (-1/0).
Skip runtime check for table in matching when given a table literal.
Just a nice lil optimization.
Explain how to verify signatures.
don't modify non-string and non-nil values in compiler.traceback
Lua's debug.traceback entry from the manual:
If message is present but is neither a string nor nil, this function
returns message without further processing. Otherwise, it returns a
string with a traceback of the call stack. The optional message string
is appended at the beginning of the traceback. An optional level
number tells at which level to start the traceback (default is 1, the
function calling traceback).