diff options
| -rw-r--r-- | crates/sloth/src/lexer.rs | 6 | ||||
| -rw-r--r-- | crates/sloth/src/parser/ast.rs | 4 | ||||
| -rw-r--r-- | crates/sloth/src/parser/expr.rs | 2 | ||||
| -rw-r--r-- | crates/sloth/src/parser/stmt.rs | 3 | ||||
| -rw-r--r-- | examples/hello.sloth | 2 |
5 files changed, 10 insertions, 7 deletions
diff --git a/crates/sloth/src/lexer.rs b/crates/sloth/src/lexer.rs index cc17b3d..0afaf1c 100644 --- a/crates/sloth/src/lexer.rs +++ b/crates/sloth/src/lexer.rs @@ -293,12 +293,14 @@ impl<'a> Iterator for Lexer<'a> { let tt = match self.window { ['#', '#', ..] => { self.advance_while(|it| it[0] != '\n'); - TokenType::DocComment + // TODO: TokenType::DocComment + return self.next(); } ['#', ..] => { self.advance_while(|it| it[0] != '\n'); - TokenType::Comment + // TODO: okenType::Comment + return self.next(); } // Blocks diff --git a/crates/sloth/src/parser/ast.rs b/crates/sloth/src/parser/ast.rs index 99bbf52..3c8cdeb 100644 --- a/crates/sloth/src/parser/ast.rs +++ b/crates/sloth/src/parser/ast.rs @@ -39,7 +39,7 @@ pub enum Literal { Char(char), String(String), Regex(String), - List(Vec<Expr>), // TODO: holy shit we forgor listys + List(Vec<Expr>), } #[derive(Debug, PartialEq)] pub enum Expr { @@ -59,7 +59,7 @@ pub enum Expr { }, Variable(String), Literal(Literal), - Lambda, // TODO: Lambda bitch + Lambda, // TODO: Lambda } #[derive(PartialEq, Debug)] pub struct FuncArgs { diff --git a/crates/sloth/src/parser/expr.rs b/crates/sloth/src/parser/expr.rs index 0cc3a93..ad35d20 100644 --- a/crates/sloth/src/parser/expr.rs +++ b/crates/sloth/src/parser/expr.rs @@ -134,7 +134,7 @@ macro_rules! binary_expr { TokenType::BangEq => BinaryOp::NotEq, TokenType::AmpAmp => BinaryOp::LogAnd, TokenType::PipePipe => BinaryOp::LogOr, - _ => panic!("uh oh spagghetio"), // TODO: Idk how to not have this shit + _ => panic!("uh oh spagghetio"), }; let rhs = self.$parent(); diff --git a/crates/sloth/src/parser/stmt.rs b/crates/sloth/src/parser/stmt.rs index 0d28131..2c48da8 100644 --- a/crates/sloth/src/parser/stmt.rs +++ b/crates/sloth/src/parser/stmt.rs @@ -51,7 +51,7 @@ impl<'a> AstParser<'a> { fn mut_statement(&mut self) -> Stmt { let TokenType::Identifier(ident) = self.peek().tt.clone() else { - panic!("uh oh {:?}", self.peek()); + panic!("Identifier error {:?}", self.peek()); }; self.advance(); @@ -195,6 +195,7 @@ impl<'a> AstParser<'a> { while !self.eof() && self.peek().tt != TokenType::ClosingBrace { body.push(self.statement()); } + self.advance(); Stmt::For { name: (binding), diff --git a/examples/hello.sloth b/examples/hello.sloth index 3dbc685..8201dae 100644 --- a/examples/hello.sloth +++ b/examples/hello.sloth @@ -1,6 +1,6 @@ print("Hello World!"); -## A basic for loop greeting the user in multiple languages +# Comment for greeting in ["Hello", "Hola", "你好"] { print(greeting + " World!"); } |
