diff --git a/lexer.odin b/lexer.odin index d6f7fc5..dd397ad 100644 --- a/lexer.odin +++ b/lexer.odin @@ -93,6 +93,14 @@ lexer_skip_whitespace :: proc(lexer: ^Lexer) { lexer_next :: proc(lexer: ^Lexer) -> (ret: Token) { lexer_skip_whitespace(lexer) + if lexer.char == '\\' { + lexer_advance(lexer) + for lexer.char != '\n' && lexer.char != 0 { + lexer_advance(lexer) + } + return lexer_next(lexer) + } + if lexer.should_return_semicolon { lexer.should_return_semicolon = false return token_create(.Semicolon, TextRange { start = lexer.position, end = lexer.position }) diff --git a/test.cat b/test.cat index e6a0956..8b9aa51 100644 --- a/test.cat +++ b/test.cat @@ -1,10 +1,12 @@ use "fmt.cat" use lib "directory/long_library_name" +\ This is a comment, it should be ignored by the compiler + fmt.printf "%d + %d = %d File length: %d" a b a + b (io.file_size "file.txt") fmt.println "Hello world!" -let a := 123 +let a := 123 \ This is another comment, that should be ignored by the compiler let uninitialized : u32 let multiple variables here : u32 = 1 2 3 let string : str, number : i32