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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e0fa6eae2c537e3d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!goblin2!goblin.stu.neva.ru!aioe.org!feeder.news-service.com!npeer.de.kpn-eurorings.net!npeer-ng0.de.kpn-eurorings.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: GNAT.Regpat problem. Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <41cae3ac-97b6-4b01-ad73-9ff1ec2fdf86@q12g2000prb.googlegroups.com> <1thhy53rdlhrs.1tygcc01f6i11$.dlg@40tude.net> Date: Thu, 24 Mar 2011 15:34:28 +0100 Message-ID: <5exbsdc3coio.1ke3vi3sk7ss4.dlg@40tude.net> NNTP-Posting-Date: 24 Mar 2011 15:34:32 CET NNTP-Posting-Host: 740c3699.newsspool3.arcor-online.net X-Trace: DXC=^Ln\IZDUj17^8FBo0_81f>McF=Q^Z^V384Fo<]lROoR18kF7enW;^6ZC`4\`mfM[68DC3Ucn@DfWdJ1< X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:19397 Date: 2011-03-24T15:34:32+01:00 List-Id: On Thu, 24 Mar 2011 10:04:43 -0400, Peter C. Chapin wrote: > On Thu, 24 Mar 2011, Dmitry A. Kazakov wrote: > >> Just curious, why are you using regular expressions when GNAT offers >> Spitbol patterns? > > Spitbol patterns seemed like overkill. In that case I would suggest wildcard patterns. > Are you saying that there is no valid > use case for the regular expression packages in GNAT's library (aside, > perhaps, for legacy support)? IMO regular expressions as a class of languages is far too weak for things more complex than trivial, but utterly unnatural for issues like matching *.adb. The syntax of RE is just horrific. So, yes, it is difficult to find a case where RE could find place. And in general, any patterns are unusable for syntax analyzers for many reasons, I don't want to go into. A manually written scanner is simpler and safer. For user-defined filters (e.g. for file search etc), lists of wild-card patterns or some reduced form of BNF is IMO the best choice. The reason why is that the user should instantly recognize what get matched and what does not. Any patterns more complex than brain-dead wildcards fail here. BTW, there recently was an article criticizing overuse of REs in UNIX, suggesting SNOBOL-like patterns instead. I don't remember where. Though it does not tell anything one would not know 25 years ago. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de