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: g2news1.google.com!news3.google.com!proxad.net!feeder1-2.proxad.net!news.in2p3.fr!in2p3.fr!kanaga.switch.ch!news-zh.switch.ch!switch.ch!news.belwue.de!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Wed, 13 Apr 2011 13:06:16 +0200 From: Georg Bauhaus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Parser interface design References: <4d9c8c19$0$6769$9b4e6d93@newsspool3.arcor-online.net> <1ovsbvdul64pw$.1q49g3o7n296m$.dlg@40tude.net> <1tdiw6o462ewh$.g2nyrbgiat6e$.dlg@40tude.net> In-Reply-To: <1tdiw6o462ewh$.g2nyrbgiat6e$.dlg@40tude.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4da583a8$0$7670$9b4e6d93@newsspool1.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 13 Apr 2011 13:06:17 CEST NNTP-Posting-Host: c0c33570.newsspool1.arcor-online.net X-Trace: DXC=<8hL[KLFTSK02Sh8E_NfIAic==]BZ:afN4Fo<]lROoRA<`=YMgDjhgBB_QmXYGIhNHPCY\c7>ejVH9Lof0<]W;7H9m>>lgPQ8bC X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:18783 Date: 2011-04-13T13:06:17+02:00 List-Id: On 4/13/11 10:37 AM, Dmitry A. Kazakov wrote: > On Wed, 13 Apr 2011 08:20:59 +0000 (UTC), Natasha Kerensikova wrote: > >> On 2011-04-12, Simon Wright wrote: >>> "Dmitry A. Kazakov" writes: >>> >>>> HTML.Emphasize ("bar") -> "bar" >>>> ASCII.Emphasize ("bar") -> "*bar*" >>>> Plain_Text.Emphasize ("bar") -> "bar" >>>> Gtk_Text_Buffer.Emphasize ("bar") -> sets tags around the text slice >>>> ... >>>> >>>> Parser just calls On_Emphasize, the implementation of routes it to the >>>> renderer's Emphasize, which figures out what to do. >>> >>> Clearly you and I think similarly here. But Natasha is (as well as being >>> the potential implementer) the customer. >> >> I'm afraid you're both missing the issue. Dmitry's example is clearly >> about different kind of emphasis, while I'm talking about *disabling* >> emphasis. > > Which is a feature of the renderer: > > type Emphasis_Mode is (Off, On); > > HTML.Set_Emphasis (Off); > ASCII.Set_Emphasis (On); > ... > Are you sure? The design at issue might be that there are many possible mappings from input symbols to, let's say tokens, and then tokens are rendered into some format, and in multiple ways per format. Thus for example, with just HTML as output format, the software's intended function would be configurable to handle all of these cases (I might be making some up, though): *x* -> T'(Bold, 'x') -> "x" *x* -> T'(Bold, 'x') -> "*x*" *x* -> T'(Normal, 'x') -> "x" *x* -> T'(Empty, No_Character) -> "" *x* -> T'(Bold, No_Character) -> "" So *x* is parsed in different ways, and T'(X, C) is rendered in different ways, even though there is just one input text and just one output format (in this example; there would another multiple of these for other output formats). So either mapping would be configurable: both the parser and the renderer. The question then becomes, is it the best idea to configure the parser by selecting rendering callbacks and testing them for null?