[Oberon] CASE without ELSE

Jörg Straube joerg.straube at iaeth.ch
Thu Feb 15 23:46:01 CET 2018


Okay, I see now what you mean. According to the EBNF production -1 is not an Integer.

Alternatively, you could write this:

>>> CASE String.Pos(ch, "ILTQX", 0)+1 OF
>>> 0: (* else case *)
>>> | 1: (* inspect *)
>>> | 2: (* load *)
>>> | 3: (* transfer *)
>>> | 4: (* quit *)
>>> | 5:
>>> END

Jörg


> Am 15.02.2018 um 23:31 schrieb Jörg <joerg.straube at iaeth.ch>:
> 
> I don‘t understand your comment; where exactly do you see problems?
> I know that the code below can not be compiled as ORP.Mod did not implement the numerical case (yet) but it is valid Oberon-07 code.
> Jörg
> 
> 
>>> Am 15.02.2018 um 22:42 schrieb Diego Sardina <dsar at eml.cc>:
>>> 
>>> On Thu, Feb 15, 2018, at 10:26 PM, Jörg Straube wrote:
>>> Based on Chris‘ example you could write
>>> 
>>> CASE String.Pos(ch, "ILTQX", 0) OF
>>> -1: (* else case *)
>>> | 0: (* inspect *)
>>> | 1: (* load *)
>>> | 2: (* transfer *)
>>> | 3: (* quit *)
>>> | 4:
>>> END
>>> 
>> 
>> Chris didn't write that form because case labels in Oberon-07 are not ConstExpression anymore (a negative number is considered a form of expression). Only integers, single character strings or qualidents (for the typecase form).
>> 
>> This is a sort of simplification because there is no more a need for an offset
>> 
>> 
>> 
>> 
>> 
>> --
>> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
>> https://lists.inf.ethz.ch/mailman/listinfo/oberon
> 
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20180215/f229353b/attachment.html>


More information about the Oberon mailing list