parser: fix newline checks after statements

since there is no EOL delimiter like ';', we have to check for newline to avoid something like `a = 4 + 4 b = a`
also added tests for expr parsing

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-08-14 00:56:09 +05:30
parent 360687f3c0
commit af30410aab
7 changed files with 150 additions and 30 deletions

View File

@@ -12,7 +12,7 @@ pub enum Entity {
Fn(Fn),
Class(Class),
Module(Module),
Static(Let)
Static(Let),
}
/// A module just provides an additional scope
@@ -106,7 +106,7 @@ pub enum ElseType {
Else(Vec<Statement>),
}
type Op = crate::lexer::TokenSymbol;
pub(crate) type Op = crate::lexer::TokenSymbol;
#[derive(Debug, PartialEq)]
pub enum Literal {