diff --git a/examples_out/out.js b/examples_out/out.js index 3c84eea..be3aad0 100644 --- a/examples_out/out.js +++ b/examples_out/out.js @@ -1,6 +1,6 @@ function main() { -return; +return "Hello World" } function fib() { } -main() \ No newline at end of file +console.log(main()) \ No newline at end of file diff --git a/src/lexer/mod.rs b/src/lexer/mod.rs index a1f563b..a693519 100644 --- a/src/lexer/mod.rs +++ b/src/lexer/mod.rs @@ -288,6 +288,11 @@ impl Cursor<'_> { loop { match self.first() { '"' | '\'' => break, + '\n' => panic!( + "String does not end on same line. At {}:{}", + self.pos().line, + self.pos().offset + ), _ => self.bump(), }; }