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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM 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!news4.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Parser interface design Date: Tue, 12 Apr 2011 16:13:30 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <4d9c8c19$0$6769$9b4e6d93@newsspool3.arcor-online.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Date: Tue, 12 Apr 2011 16:13:30 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="Mda950WjNwNLAFOE7yJXQw"; logging-data="2205"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+VgR7fTMEHw4xhatKVlDFE" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:7AvD7l00dRb6+mLCaO0nNoM+gYM= Xref: g2news1.google.com comp.lang.ada:18771 Date: 2011-04-12T16:13:30+00:00 List-Id: Hello, On 2011-04-08, Simon Wright wrote: > Natasha Kerensikova writes: > >>> Don't see what's wrong with providing a No_Op function which returns its >>> input unchanged? unless you do something specific for a null? >> >> Yes, as I said in my reply to Dmitry, I thought of disabling in the >> parser the feature associated to a callback set to null. In the >> "foo *bar* baz" example I provided, using a No_Op for Emphasis would >> result in "

foo baz

", while disabling the emphasis feature means >> considering the star as an inactive character, resulting in >> "

foo *bar* baz

". > > I had in mind more that using my No_Op (I think it was Georg who used > the better name Identity) would result in "

foo bar baz

". Indeed, and this is *not* the result I want: if the star is supposed to be a character like any other (and not the indicator of emphasis), then it should be in the result too: "

foo *bar* baz

". > 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. Natasha