[fpc-devel] "case" with range stupidities
Florian Klaempfl
florian at freepascal.org
Thu Feb 15 15:28:35 CET 2007
Daniƫl Mantione schrieb:
>> Another minor issue is that a type declaration like:
>>
>> type
>> My_Range = (2500 - 500) .. (2500 + 500);
>>
>> is not accepted (message similar to ";" expected, ".." found) and
>> (basically the same declaration)
>>
>> type
>> My_Range = 2500 - 500 .. 2500 + 500;
>>
>> is. Sometimes I'd really like to add those parantheses just to make the
>> intention more clear.
>
> I think this is a parser limitation. I don't think it is a problem to
> allow it.
It is a problem. It's simply an inconsitency of pascal. When the parser
encounters
type
My_Range = (
it expects an enum declaration. Pascal is parsed without look ahead so
this can't be solved cleanly, just consider
in one unit
const
a = 1;
b = 2;
in another unit
type
atype = (a) .. (b);
Only at the .. the compiler could detect that this is an ord type
declaration.
More information about the fpc-devel
mailing list