improvements

This commit is contained in:
Daniel Bulant 2025-04-03 15:59:06 +02:00
parent 4501a4af58
commit 3686fb1cc5
No known key found for this signature in database
2 changed files with 23 additions and 1 deletions

View file

@ -160,6 +160,10 @@ pub fn parse<'a>() -> impl Parser<'a, &'a str, Vec<Statement>, chumsky::extra::D
let comment = just('#').then(any().and_is(just('\n').not()).repeated());
let empty = text::inline_whitespace().ignored()
.or(comment.ignored())
.or(eol.ignored());
recursive(|expr| {
let primitive = choice((
number.map(Primitive::Number),
@ -181,6 +185,7 @@ pub fn parse<'a>() -> impl Parser<'a, &'a str, Vec<Statement>, chumsky::extra::D
.map(|v| Value::Group(v));
let block = expr.clone()
.or(empty.to(vec![]))
.delimited_by(just('{'), just('}'));
let value = choice((

View file

@ -1 +1,18 @@
fn test() {echo}
fn test() {}
echo test
set test = test
if test { test } else test
while test { test }
for test in test { test }
loop {}
return 1
break
continue