From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ae9:ef06:: with SMTP id d6mr7029414qkg.168.1572894990369; Mon, 04 Nov 2019 11:16:30 -0800 (PST) X-Received: by 2002:a9d:4c05:: with SMTP id l5mr11149860otf.110.1572894990141; Mon, 04 Nov 2019 11:16:30 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!feeder4.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!j16no10656974qtl.0!news-out.google.com!p4ni146qtu.1!nntp.google.com!j16no10656961qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 4 Nov 2019 11:16:29 -0800 (PST) In-Reply-To: <21fa6db8-4b86-459f-bc5a-70993f92c28a@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=146.5.2.231; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 146.5.2.231 References: <21fa6db8-4b86-459f-bc5a-70993f92c28a@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <27cb5366-4b3d-4f33-b8ec-2bc71c70780c@googlegroups.com> Subject: Re: How to best make a custom range? From: Shark8 Injection-Date: Mon, 04 Nov 2019 19:16:30 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader01.eternal-september.org comp.lang.ada:57474 Date: 2019-11-04T11:16:29-08:00 List-Id: On Monday, November 4, 2019 at 10:56:15 AM UTC-7, Shark8 wrote: > On Monday, November 4, 2019 at 10:26:22 AM UTC-7, Andrew Shvets wrote: > > Lets say I have the following code: > >=20 > > subtype Test_Char is Character range =E2=80=98A=E2=80=99 .. =E2=80=98Z= =E2=80=99; > >=20 > > But what if I wanted to include =E2=80=98&=E2=80=99, =E2=80=98@=E2=80= =98 and =E2=80=98?=E2=80=99 in this custom range of characters as well? I = thought of doing the following, but this obviously failed: > >=20 > > subtype Test_Char is Character range =E2=80=98@=E2=80=98 | =E2=80=98&= =E2=80=99 | =E2=80=98?=E2=80=99 | =E2=80=98A=E2=80=99 .. =E2=80=98Z=E2=80= =99; > >=20 > > Or is this impossible unless I use a different approach? >=20 >=20 > The approach I've been going with is splitting things apart into parts: >=20 > Subtype Upper is Character range 'A'..'Z'; > Subtype Lower is Character range 'a'..'z'; > Subtype Symbol is Character > with Static_Predicate =3D> '&' | '@' | '?'; >=20 > Subtype Test_Character is Character > with Static_Predicate =3D> Upper | Lower | Symbol; Ah, I forgot the SUBTYPE_NAME IN check, as well as the PREDICATE_FAILURE as= pect. Try: Subtype Upper is Character range 'A'..'Z'; Subtype Lower is Character range 'a'..'z'; Subtype Symbol is Character with Static_Predicate =3D> Symbol in '&' | '@' | '?'; =20 Subtype Test_Character is Character with Static_Predicate =3D> Test_Character in Upper | Lower | Symbol, Predicate_Failure =3D> Raise Constraint_Error;