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,36baec4d89e4ceb7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-15 03:12:08 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: maa@liacc.up.pt (=?ISO-8859-1?Q?M=E1rio_Amado_Alves?=) Newsgroups: comp.lang.ada Subject: Re: parse word from a string Date: 15 Nov 2002 03:12:08 -0800 Organization: http://groups.google.com/ Message-ID: <4a4de33a.0211150312.4180a570@posting.google.com> References: <4a4de33a.0211130923.6dfbb689@posting.google.com> NNTP-Posting-Host: 193.137.36.168 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1037358728 31166 127.0.0.1 (15 Nov 2002 11:12:08 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 15 Nov 2002 11:12:08 GMT Xref: archiver1.google.com comp.lang.ada:30933 Date: 2002-11-15T11:12:08+00:00 List-Id: "If you are using GNAT be sure to look at GNAT.AWK. (Pascal)" "Uhg, no! Look at GNAT.Spitbol ;-)" (MAA) "I disagree :) GNAT.AWK handles files directly. In GNAT.Spitbol you still have to open and read each lines. And since the problem at hand seems to justslice a string with a set of separators, GNAT.AWK seems just fine ;)" (Pascal) Actually the original problem is "read words from a file", and for that a simple character automaton in 'pure' Ada suffices, e.g. C : Character Word : Unbounded_String; begin loop Get_Immediate (C); if Is_Graphic (C) and C /= ' ' then Append (Word, C); else Process (Word); Word := Null_Unbounded_String; end if; end loop; exception when End_Error => if Word /= Null_Unbounded_String then Process (Word); end if; I was just advocating Spitbol over AWK in the case of general pattern matching. You seem to agree that Spitbol might be better for complex problems. And Spitbol is also good enough for simple problems. Ergo, Spitbol is better ;-) More seriously, it is better strictly in a Reduced Technology Mix framework. Again, for the simple problem at hand, I follow Robert Dewar's famous adage: "don't use pattern matching". Cheers, --MAA