Odin icon indicating copy to clipboard operation
Odin copied to clipboard

Incorrect hexadecimal literal is an invalid token

Open Feoramund opened this issue 1 year ago • 1 comments

Here's a minimal program to test. Note the space between the 0x and 1.

package silent

main :: proc() {
	a := 0x 1
}

And the error it reports (or would, if the issue that #3753 fixes wasn't stopping it):

/tmp/odin/silent.odin(4:7) Syntax Error: Failed to parse file: /tmp/odin/silent; invalid token found in file
	
	^

I'm assuming "invalid token" hints at a deeper issue here, since the compiler fails to display what the token is. It does give me a line and column though, which was helpful. I ran into this issue with a file full of hex tables.

Feoramund avatar Jun 13 '24 17:06 Feoramund

Better. I'm getting the error message now.

W:\Odin\bug>build
W:/Odin/bug/bug.odin(4:7) Syntax Error: Failed to parse file: W:/Odin/bug/bug; invalid token found in file

        ^
Error 1

Where build.bat

@echo off
odin run bug.odin -file -vet -strict-style
IF %ERRORLEVEL% NEQ 0 (
	echo Error %ERRORLEVEL%
)

Kelimion avatar Jun 13 '24 17:06 Kelimion