comp.lang.ada
 help / color / mirror / Atom feed
From: Shark8 <onewingedshark@gmail.com>
Subject: Re: How to best make a custom range?
Date: Mon, 4 Nov 2019 09:56:13 -0800 (PST)
Date: 2019-11-04T09:56:13-08:00	[thread overview]
Message-ID: <21fa6db8-4b86-459f-bc5a-70993f92c28a@googlegroups.com> (raw)
In-Reply-To: <fb36f04f-353e-4e35-bd19-eb72d2e78955@googlegroups.com>

On Monday, November 4, 2019 at 10:26:22 AM UTC-7, Andrew Shvets wrote:
> Lets say I have the following code:
> 
> subtype Test_Char is Character range ‘A’ .. ‘Z’;
> 
> But what if I wanted to include ‘&’, ‘@‘ and ‘?’ in this custom range of characters as well?  I thought of doing the following, but this obviously failed:
> 
> subtype Test_Char is Character range ‘@‘ | ‘&’ | ‘?’ | ‘A’ .. ‘Z’;
> 
> Or is this impossible unless I use a different approach?


The approach I've been going with is splitting things apart into parts:

  Subtype Upper  is Character range 'A'..'Z';
  Subtype Lower  is Character range 'a'..'z';
  Subtype Symbol is Character
    with Static_Predicate => '&' | '@' | '?';

  Subtype Test_Character is Character
    with Static_Predicate => Upper | Lower | Symbol;


  reply	other threads:[~2019-11-04 17:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 17:26 How to best make a custom range? Andrew Shvets
2019-11-04 17:56 ` Shark8 [this message]
2019-11-04 18:49   ` Andrew Shvets
2019-11-04 19:16   ` Shark8
2019-11-05 14:02     ` Andrew Shvets
2019-11-05 15:10       ` Shark8
2019-11-08 15:55         ` AdaMagica
2019-11-08 16:07           ` AdaMagica
2019-11-08 22:28           ` Randy Brukardt
2019-11-05 17:14       ` Dmitry A. Kazakov
2019-11-05 17:28         ` Shark8
2019-11-04 18:34 ` Dmitry A. Kazakov
2019-11-04 18:49   ` Andrew Shvets
2019-11-04 18:55     ` Dmitry A. Kazakov
2019-11-04 19:13       ` Shark8
2019-11-04 21:41         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox