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,50e705cdf2767cc6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!weretis.net!feeder4.news.weretis.net!news.tornevall.net!.POSTED!not-for-mail From: Jeffrey Carter Newsgroups: comp.lang.ada Subject: Re: Parser interface design Date: Fri, 08 Apr 2011 12:06:43 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <4d9c8c19$0$6769$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 8a7d952c0ff95dd0e50e049f953f881a Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: 85754bba89b9ea4b12a3db7dc50e17c0 X-Complaints-To: abuse@tornevall.net User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: X-UserIDNumber: 1738 X-Validate-Post: http://news.tornevall.net/validate.php?trace=85754bba89b9ea4b12a3db7dc50e17c0 X-Complaints-Italiano: Non abbiamo padronanza della lingua italiana - se mandate una email scrivete solo in Inglese, grazie X-Posting-User: 0243687135df8c4b260dd4a9a93c79bd Xref: g2news2.google.com comp.lang.ada:19696 Date: 2011-04-08T12:06:43-07:00 List-Id: On 04/08/2011 07:03 AM, Natasha Kerensikova wrote: > > Yes, as I said in my reply to Dmitry, I thought of disabling in the > parser the feature associated to a callback set to null. In the > "foo *bar* baz" example I provided, using a No_Op for Emphasis would > result in "

foo baz

", while disabling the emphasis feature means > considering the star as an inactive character, resulting in > "

foo *bar* baz

". Without knowing much about your domain, I'd think type Parse_Result_Info is ...; generic -- Parse with procedure Render (Parse_Result : in Parse_Result_Info); procedure Parse (...); would provide you with this kind of discrimination. A Render that does something for the '*' construct would recognize it and take the desired action, while a Render that doesn't would give the results you want. Another advantage is that you have no limit on the number of constructs that you can handle, rather than the fixed number required when using a separate subprogram for each construct. The limitation here seems to be that Parse is going to parse according to a fixed grammar. Perhaps it could be given a grammar as a parameter to make it more flexible, or it may be possible to provide more generic formal parameters that define how it parses. -- Jeff Carter "Help! Help! I'm being repressed!" Monty Python & the Holy Grail 67