Releases: yasl-lang/yasl
Releases · yasl-lang/yasl
v0.13.5
New Features:
- Added
try
function to allow recovery from errors. - Add
package.searchpath
, to allow us to see what files we attempt to open withrequire
. - Add
list->shuffle
, to allow randomly reordering alist
. - Add
list->has
,str->has
, andset->has
for checking membership.
Bug Fixes:
- Slicing with invalid range now correctly shows error message instead of crashing.
- Fixed bug with
str->replace(str, str, int)
incorrectly not doing enough replacements. table->copy
now correctly copies the metatable.
C API:
- Add
YASLX_checknoptstrz
, for checking forstr
/undef
and filling in a default value. - Deprecate
YASL_popcstr
,YASL_peekuserdata
, andYASL_popuserdata
.
Internal Changes:
- Most
str
s are now interned.
v0.13.4
New Features:
- Add
str.isupper
andstr.islower
. - Allow
list.sort(fn)
, for sorting with a custom function. - Add
io.tmpfile
.
Bug Fixes:
str.count('')
now returns the string length + 1.str.split('', int)
is now correctly an error.str.split(0)
now correctly handles leading whitespace.- Fix bug with
io.write
crashing.
v0.13.3
New Features:
- Add
os.command
, for running shell commands directly from YASL. - Add
os.clock
, for getting approximate time since program start. - Add
os.getenv
, for loading environment variables from YASL.
Bug Fixes:
- Correctly handle syntax errors with variables declared using
-D
flag. str.split(int)
now correctly returns alist
of length 1 when no splits occur.str.split(int)
now correctly handles whitespace after the last split.str.split(0)
no longer returns an emptylist
.
C API:
- Add
YASLX_print_value_err
. - Add
YASLX_print_err_bad_arg_type_n
, to cut down on boilerplate withYASLX_print_err_bad_arg_type
. - Add
YASLX_throw_value_err
andYASLX_throw_type_err
, to cut down on boilerplate withYASL_throw_err
. - Add
YASLX_checknoptint
,YASLX_checknoptfloat
,YASLX_checknoptbool
for checking if a value is the specific type orundef
. - Add
YASL_checknstr
.
v0.13.2
Bug Fixes:
- Fixed bug introduced in
v0.13.1
that caused incorrect handling of commandline arguments. - Fixed crash when there is a syntax error while using the
-D
flag. - Added function declarations for a few missing functions in
yasl.h
.
v0.13.1
New Features:
- Allow formatting of expressions in interpolated strings.
- Allow defining global variables from the command line with the
-D
flag.
Bug Fixes:
YASL_callfunction
now works correctly with YASL functions (rather than only with C ones).return
in the body of amatch
in a variadic function now works correctly.- Fixed bug with comparison operators causing a crash when used with
list
,table
, andset
literals.
v0.13.0
Breaking Changes:
- Add asserts to validate that global variables are valid YASL identifiers (previously allowed any string, which would be impossible to use if not a valid YASL identifier).
list->search
now looks from start of list (previously, looked from end due to bug)..
no longer looks in the metatable.collections.table
no longer adds an extraundef
, instead it removes the last argument, so it matches with the literal table constructors better.(variadic)
(a variadic pack surrounded by parentheses) now decays to a single expression.- Short lambdas
fn(...) -> ...
no longer allow parentheses around the return for variadics. - Only allow looking up metatables via
mt.get
fortable
,list
, anduserdata
. - Iteration now uses
in
instead of<-
.
New Features:
- Add
int->tochar
andstr->tobyte
functions, to allow turning numeric codes to strings and vice-versa (e.g.a
->97
and vice-versa). - Add
'r'
,'d'
,'x'
, and'b'
formats forint->tostr
. - Add
'r'
format tostr->tostr
. - Forward format args for
list->tostr
,set->tostr
, andtable->tostr
to their elements. - Add
str->isprint
function to check for printable characters.
C API:
- Add
YASLX_tablesetfunctions
to allow adding multiple functions at once to a table from C.
Bug Fixes:
YASLX_checknint
andYASLX_checknfloat
now correctly print out the type of the incorrect argument (previously, they always printed the type of the top of the stack).- Fix bug with writing
str
containing'\0'
to a file (previously, we used the C functionstrlen
for this, resulting in incorrectly writing too short of a length).
Other Changes:
- Allow
pure
,consteval
,constexpr
,constfold
andyield
as identifier names (previously, they were reserved).
v0.12.4
Bug Fixes:
- Fix Unicode output on Windows.
v0.12.3
New Features:
- Add
max_splits
argument tostr.split
, to allow only splitting up to a certain number of times. - Add
mt.setself
function. - Add
mt.lookup
function.
Bug Fixes:
- Fixes bug where comprehension not used as the only expression on the stack produced wrong result.
- Fix handling of files using only LF on Windows.
Internal Changes:
- Update tests to use
mt.lookup
.
v0.12.2
New Features:
- Added
ifdef
andelseifdef
to allow checking if a name has been declared. - Allow bitwise operators (
|
,&
,&^
,^
) to be used with boolean operands.
Bug Fixes:
- Indexing
str
with a negative index that is out of bounds now gives a proper error message.
v0.12.1
Bug Fixes:
- Fix crash when closure is created inside of a loop.