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-Thread: 103376,e037e74567eca23d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews1.google.com!not-for-mail From: aschwarz@acm.org (skidmarks) Newsgroups: comp.lang.ada Subject: Re: Question about Ada.Unchecked_Conversion Date: 30 Oct 2004 03:23:10 -0700 Organization: http://groups.google.com Message-ID: <35f054ea.0410300223.773b722b@posting.google.com> References: <2uf53sF2b165eU1@uni-berlin.de> NNTP-Posting-Host: 12.72.61.121 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1099131790 12432 127.0.0.1 (30 Oct 2004 10:23:10 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 30 Oct 2004 10:23:10 +0000 (UTC) Xref: g2news1.google.com comp.lang.ada:5907 Date: 2004-10-30T03:23:10-07:00 List-Id: I don't have the full picture of what you're trying to do so my answer may be off the mark. When I build a custom lexor I include a (usually) 256 cell array. The cell is mapped one-to-one with (any) 256 representation of the character set in use, and 256 has the property of guaranteeing nor constraint errors. The contents of each cell is a enumeration representing the purpose of the mapped character. My lexer is built around this. For example: type enum { ign, sep, op, sym, num, hex, ... ); type enum_Map is array ( Integer range 1 .. 256 ) of enum; Map : constant enum_Map := ( ign, ... sep, ... ); begin -- if ( enum_Map( Character'Pos(char) ) = <> ) then <> end if; or case enum_Map( Character'Pos(char) ) is when ign => <> when sep => <> when op => <> when sym => <> when num => <> and so on. I use a Moore Machine for my finite state machine, the arcs representing the transition states (ign, sep, ...) and actions associated with taking the transition. Hope this helps. art