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,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!feeder.news-service.com!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Parser interface design 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: <4d9c8c19$0$6769$9b4e6d93@newsspool3.arcor-online.net> <1ovsbvdul64pw$.1q49g3o7n296m$.dlg@40tude.net> <1tdiw6o462ewh$.g2nyrbgiat6e$.dlg@40tude.net> <4da583a8$0$7670$9b4e6d93@newsspool1.arcor-online.net> Date: Wed, 13 Apr 2011 14:46:40 +0200 Message-ID: <1lkc57upf8gsk$.1jnyd1a83zqat$.dlg@40tude.net> NNTP-Posting-Date: 13 Apr 2011 14:46:40 CEST NNTP-Posting-Host: 0536d3a5.newsspool1.arcor-online.net X-Trace: DXC=E=KoWb2FUk8d8Nb@@ZG@b=ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2UVH`WNGKX]6[6LHn;2LCV>7enW;^6ZC`4\`mfM[68DC3SlF>cHaCG<7 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:18784 Date: 2011-04-13T14:46:40+02:00 List-Id: On Wed, 13 Apr 2011 13:06:16 +0200, Georg Bauhaus wrote: > 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? Yes, if disabling emphasis was the issue. > The design at issue might be that there are > many possible mappings from input symbols to, That should not change the design. The mapping belongs neither to the parser nor to the renderer. The parser calls On_Emphasis. That may look into the current mapping and finally call to Renderer.Unformatted_Text (Text). > The question then becomes, is it the best idea to configure > the parser by selecting rendering callbacks and testing > them for null? The best idea is to decouple mapping from both. Parsers usually deal with some kind of intermediate object (syntax tree, operand/argument stacks, etc), which in this case were the mapping object: Source --> Parser --> Context |_ File |_ Computation |_ Stream |_ Compilation |_ String |_ Markup --> Renderer |_ HTML |_ ... -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de