According to Jukka Virtanen:
[Making the parser more clever ...]
Then it remains the problem how to interpret the following:
foo_problem : false .. true = false;
Because that can be interpreted either as an initialized or uninitialized subrange.
If I were a Pascal compiler, I would read this as an initialized variable.
OTOH, a true Extended Pascal compiler *must* read this as a subrange.
I think it is save to exclude comparisions with `=' from the expressions valid for the upper bound. The reason for allowing expressions here is to have things like `+', `*', parentheses, etc. in the upper bound; subranges of the Boolean type are exotic enougth that we can immolate them.
(Hmm ... somebody might need something like
Var Foo: 1 .. 4 + ord ( bar = 3 ) + MyFunc ( A = B );
so I will switch on the `=' again in parentheses and such.)
Extended pascal does require that both bounds of a subrange can be arbitrary expressions. In GPC (as far as I recall) only the lower bound can be an expression, the upper bound needs to be constant, [...]
Vice versa.
Anyone who really knows how to hack parsers interested in this one?
I join Juki in asking this question. I think I can fool GPC not to recognize the `=' in upper bound expressions (unless, of course, `--extended-pascal' is on), but I have no idea what to do with the lower bound.
Peter
Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [970201] maintainer GNU Pascal [970420] - http://home.pages.de/~gnu-pascal/ [970125]