comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Parser interface design
Date: Tue, 12 Apr 2011 16:54:24 -0500
Date: 2011-04-12T16:54:24-05:00	[thread overview]
Message-ID: <io2hmk$nmt$1@munin.nbi.dk> (raw)
In-Reply-To: 1ovsbvdul64pw$.1q49g3o7n296m$.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> 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 <simon@pushface.org> wrote:
>
>>> In other words, HTML.Emphasize ("bar") would return "<b>bar</b>", 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")  -> "<b>bar</b>"
>   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.





  parent reply	other threads:[~2011-04-12 21:54 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 10:11 Parser interface design Natasha Kerensikova
2011-04-06 12:17 ` Georg Bauhaus
2011-04-07 18:56   ` Natasha Kerensikova
2011-04-08 11:49     ` Stephen Leake
2011-04-06 12:20 ` Dmitry A. Kazakov
2011-04-07 19:14   ` Natasha Kerensikova
2011-04-07 20:31     ` Dmitry A. Kazakov
2011-04-08 13:51       ` Natasha Kerensikova
2011-04-08 14:21         ` Dmitry A. Kazakov
2011-04-12 15:58           ` Natasha Kerensikova
2011-04-12 17:14             ` Dmitry A. Kazakov
2011-04-06 15:51 ` Georg Bauhaus
2011-04-07 19:44   ` Natasha Kerensikova
2011-04-07 20:52     ` Dmitry A. Kazakov
2011-04-07 22:09     ` Simon Wright
2011-04-08 14:03       ` Natasha Kerensikova
2011-04-08 19:06         ` Jeffrey Carter
2011-04-08 19:59         ` Simon Wright
2011-04-12 16:13           ` Natasha Kerensikova
2011-04-12 17:22             ` Dmitry A. Kazakov
2011-04-12 19:02               ` Simon Wright
2011-04-13  8:20                 ` Natasha Kerensikova
2011-04-13  8:37                   ` Dmitry A. Kazakov
2011-04-13 11:06                     ` Georg Bauhaus
2011-04-13 12:46                       ` Dmitry A. Kazakov
2011-04-13 22:33                   ` Randy Brukardt
2011-04-14  6:55                     ` Natasha Kerensikova
2011-04-15  0:22                       ` Randy Brukardt
2011-04-12 21:54               ` Randy Brukardt [this message]
2011-04-07 22:13     ` Georg Bauhaus
2011-04-08 15:30       ` Natasha Kerensikova
2011-04-07  0:36 ` Randy Brukardt
2011-04-08 11:16 ` Brian Drummond
2011-04-19  9:08 ` Natasha Kerensikova
2011-04-19 12:35   ` Ludovic Brenta
2011-04-20 10:44     ` Brian Drummond
2011-04-19 17:28   ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox