I want to match these two tokens:
1. NUM: A series of characters in [0-9_] with an optional . in between.
2. ID: A series of characters in [a-zA-Z0-9_] with at-least one [a-zA-Z] character.
Flex rules for these will be:
[0-9_]+([.][0-9_]+)?/[^a-zA-Z0-9_] return NUM;
[a-zA-Z0-9_]*[a-zA-Z][a-zA-Z0-9_]* return ID;
.
.
.
Note that, trailing context is required for NUM since "123.456ab" should match 123-NUM, .-OPER & 456ab-ID. Without the trailing context, it would match 123.456-NUM & ab-ID.
But now the problem is, it will not match NUM followed by EOF. So, how to match EOF in trailing context of flex rule?
TL;DR:
What I want: NUM not followed by [a-zA-Z0-9_].
What I'm getting currently: NUM followed by a character other than [a-zA-Z0-9_].
These two differ in at EOF.
EDIT: Just got to know that Re/Flex supports word boundaries. If I shift from using Flex to Re/Flex, is there any performance downsides? or any other things that I should be aware of?