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: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!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> Date: Tue, 12 Apr 2011 19:22:32 +0200 Message-ID: <1ovsbvdul64pw$.1q49g3o7n296m$.dlg@40tude.net> NNTP-Posting-Date: 12 Apr 2011 19:22:31 CEST NNTP-Posting-Host: 5af956c6.newsspool3.arcor-online.net X-Trace: DXC=^13?PTa=ogm^Y=RbYBPl4`McF=Q^Z^V3h4Fo<]lROoRa8kF On Tue, 12 Apr 2011 16:13:30 +0000 (UTC), Natasha Kerensikova wrote: > On 2011-04-08, Simon Wright wrote: >> In other words, HTML.Emphasize ("bar") would return "bar", but >> No_Op ("bar") would just return "bar". > > And that's exactly why disabling emphasis should be done on the parser > level: the callback only has the semantic information ("render bar > emphasized") without any knowledge of how it was obtained (the source > could have been "foo *bar* baz" or "foo _bar_ baz"). Therefore no > callback can reconstruct the intact input. That looks wrong to me. I think that obvious design is to move it to the renderer: 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. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de