mirror of
https://github.com/danbulant/rush
synced 2026-05-19 04:18:35 +00:00
improvements
This commit is contained in:
parent
4501a4af58
commit
3686fb1cc5
2 changed files with 23 additions and 1 deletions
|
|
@ -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((
|
||||
|
|
|
|||
|
|
@ -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
|
||||
Loading…
Reference in a new issue