[Oberon] CASE without ELSE
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:
> 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.
>>> 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:
>> 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
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Oberon