1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 09:09:31 +00:00

Allow no expression in return

This commit is contained in:
Étienne Fildadut 2023-12-28 13:04:29 +01:00
parent 53c1c764ba
commit f574e6a775
5 changed files with 25 additions and 6 deletions

View file

@ -42,7 +42,6 @@ local function_parameter_maybe_parenthesis = function_parameter_no_default {
end
}
-- signature type 1: unary prefix
-- :$-parameter exp
-- returns symbol, parameter_tuple, rem if success
@ -195,7 +194,7 @@ return primary {
-- parse expression
local right
s, right, rem = pcall(expression_to_ast, source, rem, limit_pattern, operator_priority["$_"])
if not s then error(("invalid expression after unop %q: %s"):format(self.operator, right), 0) end
if not s then error(("invalid expression in function definition: %s"):format(right), 0) end
-- return function
local fn = Function:new(parameters, right):set_source(source_start)