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!news4.google.com!feeder.news-service.com!feeder.erje.net!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Parser interface design Date: Tue, 12 Apr 2011 16:54:24 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <4d9c8c19$0$6769$9b4e6d93@newsspool3.arcor-online.net> <1ovsbvdul64pw$.1q49g3o7n296m$.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1302645268 24285 69.95.181.76 (12 Apr 2011 21:54:28 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 12 Apr 2011 21:54:28 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news2.google.com comp.lang.ada:19750 Date: 2011-04-12T16:54:24-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:1ovsbvdul64pw$.1q49g3o7n296m$.dlg@40tude.net... > 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. Right, that's how it works in the Ada standard formatter tool. The output class takes a high-level representation of items and then writes them appropriately for the desired output. Randy.