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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,aed6eac65b3bc766 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-11 16:04:27 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!jfk3-feed1.news.digex.net!intermedia!news.stealth.net!newsfeed.nyc.globix.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: A quickie problem with an array and a right hand bracket X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3B254A10.5CB7796A@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: Mime-Version: 1.0 Date: Mon, 11 Jun 2001 22:45:36 GMT X-Mailer: Mozilla 4.5 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:8585 Date: 2001-06-11T22:45:36+00:00 List-Id: "chris.danx" wrote: > > Hello everyone, > > I'm trying to provide an array for quickie conversion between numbers and > character equivalents like this > > type array_16 is array (natural range 0..15) of character; > > basic_16 : constant array_16 := ('0'..'9'|'a'..'f'); > > The compiler corrected me on the use of a comma where the dda ("d divides a", > from math sorry, it's a bar or more symbol) but this doesn't help with > "unexpected parenthesis error" when it's compiled. What's the problem? It > looks correct to me but clearly i am missing something (very subtle) point. Your compiler is expecting something like ('0' .. '9' | 'a' .. 'f' => Some_Value) so hitting that right parenthesis is throwing it off. Later it would complain that the index type in the aggregate (characters) does not match the index type of Array_16 (Natural range 0 .. 15), but it's not getting to that point. Since Array_16 is a string type, you could simply use a string literal: Basic_16 : constant Array_16 := "0123456789abcdef"; You can also use a normal aggregate: Basic_16 : constant Array_16 := (0 => '0', 1 => '1', 2 => '2', 15 => 'f', 14 => 'e', 13 => 'd', 3 => '3', 4 => '4', 5 => '5', 12 => 'c', 11 => 'b', 10 => 'a', 6 => '6', 7 => '7', 8 => '8', 9 => '9'); -- Jeffrey Carter