Skip to content

Lexer issue when parsing hexadecimal literal #568

@LESdylan

Description

@LESdylan

Norminette reports INVALID_SUFFIX on certain valid hexadecimal constants starting with 0xb or 0Xb also the version with capitalized letters

The error appears specifically when the hex literal contains:

  • A capital letter B or lower case version following by a number
    you can see this pattern of error using this code for testing.

This is likely a lexer bug where certain letter+digit patterns are misinterpreted as a type suffix.

void	fn1(void)
{
	uint32_t	hex;

	hex = 0xb401D3;	// suffix invalid
	hex = 0xb123AB;	// suffix invalid
	hex = 0xbBEEFCA;
	hex = 0xb1b1b1;	// suffix invalid
	hex = 0xb00BAD;	// suffix invalid
	hex = 0xbADDAD;
	hex = 0xb0DEAD;	// suffix invalid
	hex = 0xb00000;
	hex = 0xb11000;
	hex = 0xb00FF0;	// suffix invalid
	hex = 0xbFFFFF;
	hex = 0xbABABA;
	hex = 0xb12345;
	hex = 0xb00001;
	hex = 0xbC0FFEE;
	hex = 0xb;
	hex = 0xb0;
	hex = 0xb00;
	hex = 0xb000;
	hex = 0xb401D3;	// suffix invalid
	hex = 0xbFFFFF;
	hex = 0xb1b1b1;	// suffix invalid
	hex = 0xb11000;
	hex = 0xb123AB;	// suffix invalid
	hex = 0xbEEFCA;
	hex = 0xa401D3;
	hex = 0xc401D3;
	hex = 0x1401D3;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions