Using a binary literal will not compile
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Odin: dev-2023-12:040b90c
OS: Ubuntu 20.04.6 LTS, Linux 5.15.90.4-microsoft-standard-WSL2
CPU: Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
RAM: 15975 MiB
Expected Behavior
Binary literal should work
Current Behavior
Marked as syntax error expected ';' token
Failure Information (for bugs)
hello_world.odin(7:13) Syntax Error: Expected ';', got integer
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
- Create simple file
//test.odin
package main
main :: proc() {
x := 0b12
}
- Run file
odin run .
Failure Logs
hello_world.odin(7:13) Syntax Error: Expected ';', got integer
You can't have 2 in a binary literal; the error message should be improved, but it is a syntax error
The compiler parses the string 0b12 as two tokens: 0b1 and 2 due to how integer parsing is set up. It should probably scan the whole string including letters and digits in other bases, and if contains them output the error after the token has been parsed with token location. This should improve the error behavior.