Implement block / indent based parsing

... and enforce that defs can only occur in blocks (or, inside parenthesized expressions)
This commit is contained in:
Joshua Warner 2024-07-08 21:14:51 -07:00
parent d5db3137a3
commit 4f32f43048
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
304 changed files with 12050 additions and 8876 deletions

View file

@ -330,6 +330,7 @@ pub enum EExpr<'a> {
Start(Position),
End(Position),
BadExprEnd(Position),
StmtAfterExpr(Position),
Space(BadInputError, Position),
Dot(Position),
@ -355,6 +356,8 @@ pub enum EExpr<'a> {
QualifiedTag(Position),
BackpassComma(Position),
BackpassArrow(Position),
BackpassContinue(Position),
DbgContinue(Position),
When(EWhen<'a>, Position),
If(EIf<'a>, Position),
@ -383,6 +386,7 @@ pub enum EExpr<'a> {
IndentEnd(Position),
UnexpectedComma(Position),
UnexpectedTopLevelExpr(Position),
}
#[derive(Debug, Clone, PartialEq, Eq)]
@ -851,8 +855,9 @@ where
let cur_indent = INDENT.with(|i| *i.borrow());
println!(
"{:<5?}: {}{:<50}",
"{:<5?}:{:<2} {}{:<50}",
state.pos(),
min_indent,
&indent_text[..cur_indent * 2],
self.message
);
@ -868,8 +873,9 @@ where
};
println!(
"{:<5?}: {}{:<50} {:<15} {:?}",
"{:<5?}:{:<2} {}{:<50} {:<15} {:?}",
state.pos(),
min_indent,
&indent_text[..cur_indent * 2],
self.message,
format!("{:?}", progress),