Handle new lines

This commit is contained in:
2026-08-01 19:30:49 +10:00
parent ad9254b975
commit 476b401e55
2 changed files with 5 additions and 1 deletions

View File

@@ -3,7 +3,7 @@
#include <iostream>
int main() {
Solstice::Lexer lexer{"(2 + 2) / 5"};
Solstice::Lexer lexer{"(2 + 2) / 5\n(1, 2, 3)"};
auto lexed = lexer.lex();
Solstice::Parser parser{lexed};

View File

@@ -323,6 +323,10 @@ namespace Solstice {
case TT::OpenParen:
return parseOpenParen();
case TT::NewLine:
// ignore new line
return parseOneNode(precedence);
// stuff that causes errors
case TT::CloseParen:
throw std::runtime_error("Extra closing paren");