Peter N Lewis wrote:
A lovely feature I added to my own language when I wrote one about a dozen years ago was the construct "not in", eg:
if Ch not in ['A'..'Z'] then ...
I always thought this was much nicer than the ugly:
if not (Ch in ['A'..'Z']) then
as well as much clearer.
It may be pretty to you, but think about the penalties. Even if the parsing could be contorted to fit, any code written with it is immediately incompatible with everything else. Pascal is a portable language. The original syntax was carefully designed for one char and one symbol lookahead. How do you then handle:
if not ch = 'A'; (* illegal *) or if not boolvar <> true; (* legal *)
I'm afraid I don't understand your comments at all, it doesn't seem that you actually read what I wrote, perhaps you read something you thought I wrote? I never discussed any change to the "not" unary operator, only adding a new binary operator made up of the two tokens "not" and "in". Parsing is easy, "not" cannot normally be used in places where a binary operator can be used, and then must be followed by "in".
I was not suggesting the ability to do not ch = 'A' (which would not make sense since you cannot negate a character). Only a companion binary operator for the "in" operator to be equivalent but negated.
That is "not in" is to "in" as "<>" is to "=".
So it is easy to parse with one char, one token look ahead, and has nothing to do with your two examples.
Yes, anything written to use it would not work on any other Pascal compiler. What's new? Anything written in GPC using the various extensions already present will not work on any other compiler either, unless you carefully choose which extensions you do and don't use, in which case, just turn on the relevant "standard" switch and you wont have any problems regardless.
Anything written in GPC is automatically portable - to all the systems that GPC works on.
Enjoy, Peter.