owl icon indicating copy to clipboard operation
owl copied to clipboard

hex integer

Open ozbolt-abrantix opened this issue 2 years ago • 2 comments

If I try to implement another "built-in token class" like hexinteger (I will follow the implementation for other builtins), would the PR be excepted?

Unfortunately for my usecase I can not use 0xABC integer matcher with 0x.

ozbolt-abrantix avatar May 25 '22 08:05 ozbolt-abrantix

Sure, that sounds fine -- to be clear, the token would match hex integers like ABC rather than 0xABC, right? I'd also say the name of the token class should be hex-integer rather than hexinteger to match other hyphenated built-ins like .line-comment-token.

ianh avatar May 25 '22 08:05 ianh

Though, on second thought, there's an issue of which token type has priority between identifier, integer, and hex-integer, since 3 could be either decimal or hexadecimal and A could be either an identifier or a hex digit. It might be better to implement this as a custom token using the .token keyword in the grammar.

ianh avatar May 25 '22 08:05 ianh