[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: To allow hex and oct %token values
From: |
Tim Van Holder |
Subject: |
Re: To allow hex and oct %token values |
Date: |
Thu, 04 Mar 2004 16:35:06 +0100 |
User-agent: |
Mozilla Thunderbird 0.5 (Windows/20040207) |
Odd Arild Olsen wrote:
- int [0-9]+
+ int (0x)?[0-9]+
This does not support 0x20a or 0x20A; that's easy enough to fix,
however.
The main problem is that this is a breaking change - the (few) people
that felt the need to specify specific token numbers may have done so
like this:
%token FOO 0800
%token BAR 0801
...
%token XYZZY 1077
which is valid according to the current situation. With your change
however, it breaks completely. Aside from the fact that you should
check that strtoul was able to parse the entire token and given an error
if not, the above can no longer work (FOO and BAR would likely both get
value 0 or ULONG_MAX, for example, as strtoul will error out when it
hits the 8, which isn't a valid octal digit).
Adding hex support would not cause such breakage, and may be a valid
extension to consider.
I'm also not sure how such changes would impact POSIX compliance.